From 4fef6e4334da4e2238014da5372693f349f28324 Mon Sep 17 00:00:00 2001 From: Leon Dudlik Date: Tue, 18 Oct 2022 11:32:39 +0200 Subject: [PATCH] Add version 3.3.0 --- CHANGELOG.md | 6 ++++++ README.md | 32 +++++++++++++++++++++++++------ hooks/dependencies-gradle-hook.js | 31 ++++++++++++++++++++++++++---- package.json | 2 +- plugin.xml | 2 +- 5 files changed, 61 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b74c330..27e9812 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## [3.3.0] + +### Added + +* Added option to specify the version of the native VideoEditor SDK for Android version via a `imglyConfig.json` file. See the [README](https://github.com/imgly/vesdk-cordova/blob/master/README.md#version) for more information. + ## [3.2.0] ### Changed diff --git a/README.md b/README.md index be7a682..88b67a3 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@

# Cordova & Ionic plugin for VideoEditor SDK + ## Getting started Add VideoEditor SDK plugin to your project as follows: @@ -25,6 +26,7 @@ cordova plugin add cordova-plugin-videoeditorsdk 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. @@ -37,12 +39,28 @@ Run with --stacktrace option to get the stack trace. Run with --info or --debug * 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`. + +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 +#### Version + +You can configure the native Android VideoEditor SDK version used by creating a `imglyConfig.json` file and specifying a specific version: + +```json +{ + "version": "10.3.3" +} +``` + +If no version / no configuration file is specified, the module will use the default minimum required version. + +#### AndroidX + From version `3.0.0` the plugin uses AndroidX. To enable AndroidX in your application please adjust your `config.xml`: ```diff @@ -81,8 +99,7 @@ With version `3.2.0` the plugin requires `minSdkVersion` `21` or higher. Dependi 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 +#### Modules 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. @@ -97,20 +114,23 @@ cordova plugin add cordova-plugin-enable-multidex Each platform requires a separate license file. Unlock VideoEditor SDK with a single line of code for both platforms via platform-specific file extensions. Rename your license files: + - Android license: `ANY_NAME.android` - iOS license: `ANY_NAME.ios` Pass the file path without the extension to the `unlockWithLicense` function to unlock both iOS and Android: + ```js -VESDK.unlockWithLicense('www/assets/ANY_NAME'); +VESDK.unlockWithLicense("www/assets/ANY_NAME"); ``` Open the editor with a video: + ```js VESDK.openEditor( successCallback, failureCallback, - VESDK.resolveStaticResource('www/assets/video.mp4') + VESDK.resolveStaticResource("www/assets/video.mp4") ); ``` diff --git a/hooks/dependencies-gradle-hook.js b/hooks/dependencies-gradle-hook.js index 9980c65..d594394 100644 --- a/hooks/dependencies-gradle-hook.js +++ b/hooks/dependencies-gradle-hook.js @@ -10,12 +10,30 @@ module.exports = (context) => { const VERSION_BLOCK_START = "// VERSION CHANGED BY IMGLY - START - "; const VERSION_BLOCK_END = "// VERSION CHANGED BY IMGLY - END -"; const gradlePluginVersion = '1.5.32'; + var sdkVersion = "10.1.1"; + + try { + const configFilePath = path.join( + context.opts.projectRoot, + "imglyConfig.json" + ); + const config = fs.readFileSync(configFilePath, "utf8"); + if (config != null) { + const configJson = JSON.parse(config); + const configVersion = configJson.version; + if (configVersion != null) sdkVersion = configVersion; + } + } catch { + console.log( + "Warning: There is no imglyConfig.json file in your root directory. Consider adding it to customize the IMG.LY Android SDK integration." + ); + } const imglyDependencies = "\n" + BLOCK_START + ` - classpath "ly.img.android.sdk:plugin:10.1.1"` + + classpath "ly.img.android.sdk:plugin:${sdkVersion}"` + "\n" + BLOCK_END + "\n"; @@ -57,10 +75,15 @@ module.exports = (context) => { const regex = /ext.kotlin_version = '([0-9]*).([0-9]*).([0-9]*)'/gm; const versionMatch = regex.exec(fileContents); - + if (versionMatch != null) { - const version = versionMatch[0].replace("ext.kotlin_version = ", ""); - const newVersion = `${VERSION_BLOCK_START + version}\n ext.kotlin_version = '${gradlePluginVersion}'\n ${VERSION_BLOCK_END}`; + const version = versionMatch[0].replace( + "ext.kotlin_version = ", + "" + ); + const newVersion = `${ + VERSION_BLOCK_START + version + }\n ext.kotlin_version = '${gradlePluginVersion}'\n ${VERSION_BLOCK_END}`; fileContents = fileContents.replace(regex, newVersion); } fs.writeFileSync(file, fileContents); diff --git a/package.json b/package.json index 5369d82..d094188 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.2.0", + "version": "3.3.0", "types": "./types/index.d.ts", "main": "www/videoeditorsdk.js", "scripts": { diff --git a/plugin.xml b/plugin.xml index 26e5a54..81ae11b 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