Skip to content

Commit 715d24e

Browse files
committed
Add version 2.4.2
1 parent b1ecd4f commit 715d24e

File tree

7 files changed

+77
-58
lines changed

7 files changed

+77
-58
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
## [2.4.2]
2+
3+
### Fixed
4+
5+
* [Android] Fixed serialization export file URL to include the schema.
6+
* [Android] Fixed crash when exporting serialization for remote videos.
7+
* [Android] 🚨 Fixed export result type to `video` which was `image` before.
8+
19
## [2.4.1]
210

311
* Same version as 2.4.0. Bumped version to keep the version consistent with `react-native-photoeditorsdk`.

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
# React Native module for VideoEditor SDK
1919

20+
Check out our [video tutorial](https://blog.photoeditorsdk.com/a-photo-and-video-editor-for-your-react-native-apps) for a step-by-step integration guide which also details advanced SDK features, such as serializing and reusing previously applied editing operations.
21+
2022
## Getting started
2123

2224
Install the React Native module in your project as follows:
@@ -81,11 +83,11 @@ For older React Native versions autolinking is not available and VideoEditor SDK
8183
}
8284
dependencies {
8385
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.61"
84-
classpath 'ly.img.android.sdk:plugin:7.1.13'
86+
classpath 'ly.img.android.sdk:plugin:7.2.5'
8587
}
8688
}
8789
```
88-
In order to update VideoEditor SDK for Android replace the version string `7.1.13` with a [newer release](https://github.com/imgly/vesdk-android-demo/releases).
90+
In order to update VideoEditor SDK for Android replace the version string `7.2.5` with a [newer release](https://github.com/imgly/vesdk-android-demo/releases).
8991

9092
3. Configure VideoEditor SDK for Android by opening the `android/app/build.gradle` file (**not** `android/build.gradle`) and adding the following lines under `apply plugin: "com.android.application"`:
9193
```groovy

android/src/main/java/ly/img/react_native/vesdk/RNVideoEditorSDKModule.kt

Lines changed: 38 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import ly.img.android.pesdk.ui.activity.ImgLyIntent
2020
import ly.img.android.pesdk.ui.activity.VideoEditorBuilder
2121
import ly.img.android.pesdk.ui.utils.PermissionRequest
2222
import ly.img.android.pesdk.utils.MainThreadRunnable
23+
import ly.img.android.pesdk.utils.SequenceRunnable
2324
import ly.img.android.pesdk.utils.UriHelper
2425
import ly.img.android.sdk.config.*
2526
import ly.img.android.serializer._3._0._0.PESDKFileReader
@@ -29,6 +30,7 @@ import org.json.JSONException
2930
import org.json.JSONObject
3031
import java.io.File
3132

33+
3234
class RNVideoEditorSDKModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(reactContext), ActivityEventListener, PermissionListener {
3335
companion object {
3436
// This number must be unique. It is public to allow client code to change it if the same value is used elsewhere.
@@ -58,49 +60,51 @@ class RNVideoEditorSDKModule(reactContext: ReactApplicationContext) : ReactConte
5860
currentPromise?.resolve(null)
5961
}
6062
Activity.RESULT_OK -> {
61-
val sourcePath = data.getParcelableExtra<Uri>(ImgLyIntent.SOURCE_IMAGE_URI)
62-
val resultPath = data.getParcelableExtra<Uri>(ImgLyIntent.RESULT_IMAGE_URI)
63+
SequenceRunnable("Export Done") {
64+
val sourcePath = data.getParcelableExtra<Uri>(ImgLyIntent.SOURCE_IMAGE_URI)
65+
val resultPath = data.getParcelableExtra<Uri>(ImgLyIntent.RESULT_IMAGE_URI)
6366

64-
val serializationConfig = currentConfig?.export?.serialization
65-
val settingsList = data.getParcelableExtra<SettingsList>(ImgLyIntent.SETTINGS_LIST)
67+
val serializationConfig = currentConfig?.export?.serialization
68+
val settingsList = data.getParcelableExtra<SettingsList>(ImgLyIntent.SETTINGS_LIST)
6669

67-
val serialization: Any? = if (serializationConfig?.enabled == true) {
68-
skipIfNotExists {
69-
settingsList.let { settingsList ->
70-
if (serializationConfig.embedSourceImage == true) {
71-
Log.i("ImgLySdk", "EmbedSourceImage is currently not supported by the Android SDK")
72-
}
73-
when (serializationConfig.exportType) {
74-
SerializationExportType.FILE_URL -> {
75-
val file = serializationConfig.filename?.let { Export.convertPathToFile(it) }
76-
?: File.createTempFile("serialization", ".json")
77-
PESDKFileWriter(settingsList).writeJson(file)
78-
file.absolutePath
70+
val serialization: Any? = if (serializationConfig?.enabled == true) {
71+
skipIfNotExists {
72+
settingsList.let { settingsList ->
73+
if (serializationConfig.embedSourceImage == true) {
74+
Log.i("ImgLySdk", "EmbedSourceImage is currently not supported by the Android SDK")
7975
}
80-
SerializationExportType.OBJECT -> {
81-
ReactJSON.convertJsonToMap(
82-
JSONObject(
83-
PESDKFileWriter(settingsList).writeJsonAsString()
84-
)
85-
) as Any?
76+
when (serializationConfig.exportType) {
77+
SerializationExportType.FILE_URL -> {
78+
val file = serializationConfig.filename?.let { Export.convertPathToFile(it) }
79+
?: File.createTempFile("serialization", ".json")
80+
PESDKFileWriter(settingsList).writeJson(file)
81+
Uri.fromFile(file).toString()
82+
}
83+
SerializationExportType.OBJECT -> {
84+
ReactJSON.convertJsonToMap(
85+
JSONObject(
86+
PESDKFileWriter(settingsList).writeJsonAsString()
87+
)
88+
) as Any?
89+
}
8690
}
8791
}
92+
} ?: run {
93+
Log.i("ImgLySdk", "You need to include 'backend:serializer' Module, to use serialisation!")
94+
null
8895
}
89-
} ?: run {
90-
Log.i("ImgLySdk", "You need to include 'backend:serializer' Module, to use serialisation!")
96+
} else {
9197
null
9298
}
93-
} else {
94-
null
95-
}
9699

97-
currentPromise?.resolve(
98-
reactMap(
99-
"image" to resultPath?.toString(),
100-
"hasChanges" to (sourcePath?.path != resultPath?.path),
101-
"serialization" to serialization
102-
)
103-
)
100+
currentPromise?.resolve(
101+
reactMap(
102+
"video" to resultPath?.toString(),
103+
"hasChanges" to (sourcePath?.path != resultPath?.path),
104+
"serialization" to serialization
105+
)
106+
)
107+
}()
104108
}
105109
}
106110
}

index.d.ts

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
import { Component } from 'react';
22
import { Configuration } from './configuration';
33

4+
/**
5+
* The result of an export.
6+
*/
7+
interface VideoEditorResult {
8+
/** The edited video. */
9+
video: string;
10+
/** An indicator whether the input video was modified at all. */
11+
hasChanges: boolean;
12+
/** All modifications applied to the input video if `export.serialization.enabled` of the `Configuration` was set to `true`. */
13+
serialization?: string | object;
14+
}
15+
416
declare class VESDK {
517
/**
618
* Modally present a video editor.
@@ -17,17 +29,14 @@ declare class VESDK {
1729
* restores a previous state of the editor by re-applying all modifications to the loaded
1830
* video.
1931
*
20-
* @return {Promise<{video: string, hasChanges: boolean, serialization: object}>} Returns the
21-
* edited `video`, an indicator (`hasChanges`) whether the input video was modified at all, and
22-
* all modifications (`serialization`) applied to the input video if `export.serialization.enabled`
23-
* of the `configuration` was set. If the editor is dismissed without exporting the edited video
24-
* `null` is returned instead.
32+
* @return {Promise<VideoEditorResult>} Returns a `VideoEditorResult` or `null` if the editor
33+
* is dismissed without exporting the edited video.
2534
*/
2635
static openEditor(
2736
video: string | {uri: string} | number,
28-
configuration: Configuration,
29-
serialization: object
30-
): Promise<{image: string, hasChanges: boolean, serialization: object}>
37+
configuration?: Configuration,
38+
serialization?: object
39+
): Promise<VideoEditorResult>
3140

3241
/**
3342
* Unlock VideoEditor SDK with a license.
@@ -86,15 +95,11 @@ interface VideoEditorModalProps {
8695

8796
/**
8897
* This prop determines the callback function that will be called when the user exported a video.
89-
*
90-
* The object passed to this callback includes the edited `video`, an indicator (`hasChanges`) whether
91-
* the input video was modified at all, and all modifications (`serialization`) applied to the input video
92-
* if `export.serialization.enabled` of the `configuration` prop was set.
9398
*/
94-
onExport: ({video: string, hasChanges: boolean, serialization: object}) => void;
99+
onExport: (args: VideoEditorResult) => void;
95100

96101
/**
97-
* This prop determines the callback function that will be called when the user dissmisses the editor without
102+
* This prop determines the callback function that will be called when the user dismisses the editor without
98103
* exporting a video.
99104
*/
100105
onCancel?: () => void;

index.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,8 @@ class VESDK {
103103
* restores a previous state of the editor by re-applying all modifications to the loaded
104104
* video.
105105
*
106-
* @return {Promise<{video: string, hasChanges: boolean, serialization: object}>} Returns the
107-
* edited `video`, an indicator (`hasChanges`) whether the input video was modified at all, and
108-
* all modifications (`serialization`) applied to the input video if `export.serialization.enabled`
109-
* of the `configuration` was set. If the editor is dismissed without exporting the edited video
110-
* `null` is returned instead.
106+
* @return {Promise<VideoEditorResult>} Returns a `VideoEditorResult` or `null` if the editor
107+
* is dismissed without exporting the edited video.
111108
*/
112109
static openEditor(video, configuration = null, serialization = null) {
113110
resolveStaticAssets(configuration)

ios/RNImglyKit.m

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ - (void)present:(nonnull IMGLYMediaEditViewControllerBlock)createMediaEditViewCo
3636
#if RN_IMGLY_DEBUG
3737
{
3838
// For release debugging
39-
NSURL *debugURL = [RCTConvert IMGLYExportFileURL:@"imgly-debug" withExpectedUTI:kUTTypeJSON];
39+
NSURL *debugURL = [RCTConvert RN_IMGLY_ExportFileURL:@"imgly-debug" withExpectedUTI:kUTTypeJSON];
4040
if (debugURL) {
4141
NSError *error = nil;
4242
NSJSONWritingOptions debugOptions = NSJSONWritingPrettyPrinted;
@@ -106,7 +106,10 @@ - (void)present:(nonnull IMGLYMediaEditViewControllerBlock)createMediaEditViewCo
106106

107107
// Update configuration
108108
NSMutableDictionary *updatedDictionary = [NSMutableDictionary dictionaryWithDictionary:dictionary];
109-
[updatedDictionary setValue:exportFile.absoluteString forKeyPath:@"export.filename"];
109+
NSMutableDictionary *exportDictionary = [NSMutableDictionary dictionaryWithDictionary:[NSDictionary RN_IMGLY_dictionary:updatedDictionary valueForKeyPath:@"export" default:@{}]];
110+
[exportDictionary setValue:exportFile.absoluteString forKeyPath:@"filename"];
111+
[updatedDictionary setValue:exportDictionary forKeyPath:@"export"];
112+
110113
configuration = [[PESDKConfiguration alloc] initWithBuilder:^(PESDKConfigurationBuilder * _Nonnull builder) {
111114
builder.assetCatalog = assetCatalog;
112115
[builder configureFromDictionary:updatedDictionary error:&error];

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "react-native-videoeditorsdk",
33
"title": "React Native module for VideoEditor SDK",
4-
"version": "2.4.1",
4+
"version": "2.4.2",
55
"description": "A React Native module for VideoEditor SDK. Integrate the video editor into your own HTML5, iOS or Android app - in minutes!",
66
"main": "index.js",
77
"typings": "index.d.ts",

0 commit comments

Comments
 (0)