From c13a3cb375fb75c5d149077bbcdd51229e99fa1d Mon Sep 17 00:00:00 2001 From: Leon Dudlik Date: Mon, 17 Oct 2022 10:15:50 +0200 Subject: [PATCH] Add version 3.2.0 --- CHANGELOG.md | 17 +++++++++++++ README.md | 40 +++++++++++++++++++++++++++++-- hooks/dependencies-gradle-hook.js | 4 ++-- hooks/imglyConfig-gradle-hook.js | 1 + package.json | 2 +- plugin.xml | 4 ++-- src/android/VESDKPlugin.kt | 28 ++++++++++------------ src/android/build.gradle | 10 ++++---- types/configuration.ts | 34 +++++++++++++++++++++++++- types/index.d.ts | 2 +- 10 files changed, 112 insertions(+), 30 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fae808b..b74c330 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,20 @@ +## [3.2.0] + +### Changed + +* 🚨 With this version you might need to create symlinks when using Android Gradle Plugin version `4.x`. Please refer to the new [known issues](https://github.com/imgly/vesdk-cordova#known-issues) section of the README for details. +* 🚨 This version requires `minSdkVersion` `21` for Android. Please refer to the new "Supported Android versions" section in the [getting started](https://github.com/imgly/vesdk-cordova#android) section of the README for instructions on how to adjust it. +* Raised minimum VideoEditor SDK for Android version to 10.1.1. See the [changelog](https://github.com/imgly/vesdk-android-demo/blob/master/CHANGELOG.md) for more information. + +### Added + +* Added implementation and documentation for GIPHY sticker integration. + +### Fixed + +* Fixed `VESDK.openEditor` `success` callback type declaration to return `VideoEditorResult | null` instead of just `VideoEditorResult`. +* [Android] Fixed height and width of specified composition size would be flipped. + ## [3.1.0] ### Changed diff --git a/README.md b/README.md index 1ab4f3d..be7a682 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,27 @@ Add VideoEditor SDK plugin to your project as follows: cordova plugin add cordova-plugin-videoeditorsdk ``` +### Known Issues + +With version `3.2.0`, we recommend using `compileSdkVersion` not lower than `31` for Android. However, this might interfere with your application's Android Gradle Plugin version if this is set to `4.x`. + +If you don't use a newer Android Gradle Plugin version, you'll most likely encounter a build error similar to: +``` +FAILURE: Build failed with an exception. + +* What went wrong: +A problem occurred configuring project ':cordova-plugin-videoeditorsdk'. +> com.android.builder.errors.EvalIssueException: Installed Build Tools revision 31.0.0 is corrupted. Remove and install again using the SDK Manager. + +* Try: +Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. + +* Get more help at https://help.gradle.org +``` +As a workaround you can create the following symlinks: + 1. Inside `/Users/YOUR-USERNAME/Library/Android/sdk/build-tools/31.0.0/`: Create a `dx` symlink for the `d8` file with `ln -s d8 dx`. + 2. From there, go to `./lib/` and create a `dx.jar` symlink for the `d8.jar` file with `ln -s d8.jar dx.jar`. + ### Android From version `3.0.0` the plugin uses AndroidX. To enable AndroidX in your application please adjust your `config.xml`: @@ -36,16 +57,31 @@ If your application is using legacy Android Support Libraries you can use the [` #### Kotlin Version -If you are using `Cordova Android` version `10.+`, you might need to adjust the Kotlin version of your application in your `config.xml`, if your current Kotlin version is not compatible with our plugin: +If you are using `cordova-android` version `10.+`, you might need to adjust the Kotlin version of your application in your `config.xml`, if your current Kotlin version is not compatible with our plugin: ```diff ... -+ ++ ... ``` +#### Supported Android versions + +With version `3.2.0` the plugin requires `minSdkVersion` `21` or higher. Depending on your `cordova-android` version you might need to raise the `minSdkVersion` manually. For this, please add the following entry to your `config.xml`: + +```diff + +... ++ +... + +``` + +We further recommend you to update your `buildToolsVersion` to `31.0.0` as well as your `compileSdkVersion` to `31`. However, this is not mandatory. For further reference on how to update these variables, please refer to the official [Cordova documentation](https://cordova.apache.org/docs/en/11.x/guide/platforms/android/index.html#configuring-gradle). + + #### Module Configuration You can configure the modules used for the VideoEditor SDK for Android by opening `imglyConfig.gradle` and removing / commenting out the modules you do not need. This will also reduce the size of your application. diff --git a/hooks/dependencies-gradle-hook.js b/hooks/dependencies-gradle-hook.js index 0a2f80c..9980c65 100644 --- a/hooks/dependencies-gradle-hook.js +++ b/hooks/dependencies-gradle-hook.js @@ -9,13 +9,13 @@ module.exports = (context) => { const BLOCK_END = ` // DEPENDENCIES ADDED BY IMGLY - BLOCK END`; const VERSION_BLOCK_START = "// VERSION CHANGED BY IMGLY - START - "; const VERSION_BLOCK_END = "// VERSION CHANGED BY IMGLY - END -"; - const gradlePluginVersion = '1.4.10'; + const gradlePluginVersion = '1.5.32'; const imglyDependencies = "\n" + BLOCK_START + ` - classpath "ly.img.android.sdk:plugin:9.2.0"` + + classpath "ly.img.android.sdk:plugin:10.1.1"` + "\n" + BLOCK_END + "\n"; diff --git a/hooks/imglyConfig-gradle-hook.js b/hooks/imglyConfig-gradle-hook.js index fed725b..4124211 100644 --- a/hooks/imglyConfig-gradle-hook.js +++ b/hooks/imglyConfig-gradle-hook.js @@ -23,6 +23,7 @@ imglyConfig { include 'ui:video-composition' // for VideoEditor include 'ui:video-library' // for VideoEditor include 'ui:audio-composition' // for VideoEditor + include 'ui:giphy-sticker' // for VideoEditor // This module is big, remove the serializer if you don't need that feature. include 'backend:serializer' diff --git a/package.json b/package.json index 29d8557..5369d82 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "cordova-plugin-videoeditorsdk", "description": "A Cordova plugin for VideoEditor SDK. Integrate the video editor into your own HTML5, iOS or Android app - in minutes!", - "version": "3.1.0", + "version": "3.2.0", "types": "./types/index.d.ts", "main": "www/videoeditorsdk.js", "scripts": { diff --git a/plugin.xml b/plugin.xml index a9539f5..26e5a54 100644 --- a/plugin.xml +++ b/plugin.xml @@ -1,5 +1,5 @@ - + VideoEditorSDK A Cordova plugin for VideoEditor SDK. Integrate the video editor into your own HTML5, iOS or Android app - in minutes! BSD-3-Clause @@ -68,7 +68,7 @@ - + diff --git a/src/android/VESDKPlugin.kt b/src/android/VESDKPlugin.kt index c44d5ae..bc82b38 100644 --- a/src/android/VESDKPlugin.kt +++ b/src/android/VESDKPlugin.kt @@ -42,9 +42,6 @@ class VESDKPlugin : CordovaPlugin() { /** The callback used for the plugin. */ private var callback: CallbackContext? = null - /** The currently used settings list. */ - private var currentSettingsList: VideoEditorSettingsList? = null - /** The currently used configuration. */ private var currentConfig: Configuration? = null @@ -121,12 +118,10 @@ class VESDKPlugin : CordovaPlugin() { ) { callback = callbackContext IMGLY.authorize() - val settingsList = VideoEditorSettingsList() - - currentSettingsList = settingsList - currentConfig = ConfigLoader.readFrom(config).also { - it.applyOn(settingsList) - } + val configuration = ConfigLoader.readFrom(config) + val settingsList = VideoEditorSettingsList(configuration.export?.serialization?.enabled == true) + configuration.applyOn(settingsList) + currentConfig = configuration settingsList.configure { loadSettings -> loadSettings.source = retrieveURI(filepath) @@ -154,15 +149,14 @@ class VESDKPlugin : CordovaPlugin() { ) { callback = callbackContext IMGLY.authorize() - val settingsList = VideoEditorSettingsList() // Set the video size as the default source. var source = resolveSize(size) - currentSettingsList = settingsList - currentConfig = ConfigLoader.readFrom(config).also { - it.applyOn(settingsList) - } + val configuration = ConfigLoader.readFrom(config) + val settingsList = VideoEditorSettingsList(configuration.export?.serialization?.enabled == true) + configuration.applyOn(settingsList) + currentConfig = configuration if (videos != null && videos.count() > 0) { if (source == null) { @@ -204,6 +198,7 @@ class VESDKPlugin : CordovaPlugin() { EditorBuilder(currentActivity) .setSettingsList(settingsList) .startActivityForResult(currentActivity, EDITOR_RESULT_ID, arrayOfNulls(0)) + settingsList.release() }() } @@ -236,7 +231,7 @@ class VESDKPlugin : CordovaPlugin() { if (height == 0.0 || width == 0.0) { return null } - return LoadSettings.compositionSource(height.toInt(), width.toInt(), 60) + return LoadSettings.compositionSource(width.toInt(), height.toInt(), 60) } /** @@ -255,9 +250,9 @@ class VESDKPlugin : CordovaPlugin() { val resultPath = data.resultUri val serializationConfig = currentConfig?.export?.serialization - val settingsList = data.settingsList val serialization: Any? = if (serializationConfig?.enabled == true) { + val settingsList = data.settingsList skipIfNotExists { settingsList.let { settingsList -> if (serializationConfig.embedSourceImage == true) { @@ -282,6 +277,7 @@ class VESDKPlugin : CordovaPlugin() { Log.i("ImgLySdk", "You need to include 'backend:serializer' Module, to use serialisation!") null } + settingsList.release() } else { null } diff --git a/src/android/build.gradle b/src/android/build.gradle index a5ffb27..d2e5850 100644 --- a/src/android/build.gradle +++ b/src/android/build.gradle @@ -22,7 +22,7 @@ imglyConfig { } } -def MIN_LY_IMG_ANDROID_SDK_PLUGIN_VERSION = "9.1.0" +def MIN_LY_IMG_ANDROID_SDK_PLUGIN_VERSION = "10.1.1" task checkVESDKVersion { if (imglyConfig.convertToVersionNumber(imglyConfig.getVersion()) < imglyConfig.convertToVersionNumber(MIN_LY_IMG_ANDROID_SDK_PLUGIN_VERSION)) { @@ -41,11 +41,11 @@ task checkVESDKVersion { preBuild.dependsOn checkVESDKVersion android { - compileSdkVersion safeExtGet('compileSdkVersion', 29) - buildToolsVersion safeExtGet('buildToolsVersion', '29.0.2') + compileSdkVersion safeExtGet('compileSdkVersion', 31) + buildToolsVersion safeExtGet('buildToolsVersion', '31.0.0') defaultConfig { - minSdkVersion safeExtGet('minSdkVersion', 19) + minSdkVersion safeExtGet('minSdkVersion', 21) targetSdkVersion safeExtGet('targetSdkVersion', 29) } lintOptions { @@ -62,7 +62,7 @@ repositories { } dependencies { - api 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.4.10' + api 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.5.32' compileOnly "ly.img.android.sdk:serializer:$imglyConfig.version" implementation 'com.google.code.gson:gson:2.8.5' } \ No newline at end of file diff --git a/types/configuration.ts b/types/configuration.ts index e90d5e4..263a840 100644 --- a/types/configuration.ts +++ b/types/configuration.ts @@ -572,7 +572,7 @@ export interface Configuration { * ]}, * ] */ - categories?: (StickerCategory | ExistingStickerCategory)[]; + categories?: (StickerCategory | ExistingStickerCategory | ExistingStickerProviderCategory)[]; /** * Defines all available colors that can be applied to stickers with a `tintMode` other than `TintMode.NONE`. * The color pipette is always added. @@ -1567,6 +1567,38 @@ export interface StickerCategory extends NamedItem { items?: (Sticker | ExistingItem)[]; } +/** An existing sticker provider category. */ +export interface ExistingStickerProviderCategory extends ExistingItem { + /** + * The used sticker provider that must match the category's identifier. + */ + provider: GiphyStickerProvider; +} + +/** + * A GIPHY sticker provider. + * @note This sticker provider requires to use the identifier `imgly_sticker_category_giphy` for its `ExistingStickerProviderCategory`. + */ +export interface GiphyStickerProvider { + /** + * The key used to authorize API requests, obtained from GIPHY. + */ + apiKey: string; + /** + * The default language for regional content in 2-letter ISO 639-1 language code. + * If `null` the language setting of the current locale is used. + * @example // Defaults to: + * null + */ + language?: string; + /** + * The audience category used for content filtering. Available values are `"g"`, `"pg"`, `"pg-13"`, `"r"`. + * @example // Defaults to: + * "g" + */ + rating?: string; +} + /** A sticker. */ export interface Sticker extends NamedItem { /** diff --git a/types/index.d.ts b/types/index.d.ts index bc49679..e6df92f 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -47,7 +47,7 @@ declare class VESDK { * be fitted to the `videoSize` aspect by adding black bars on the left and right side or top and bottom. */ static openEditor( - success: (args: VideoEditorResult) => void, + success: (args: VideoEditorResult | null) => void, failure: (error: any) => void, video: string, configuration?: Configuration,