Skip to content

Commit

Permalink
Add version 2.16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
leontobias committed Oct 25, 2022
1 parent 6722946 commit 159561e
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 33 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## [2.16.0]

### Added

* [react-native-videoeditorsdk] Added duration action for text and stickers.
* [react-native-videoeditorsdk] Added `VideoEditorResult.segments`, `VideoEditorResult.videoSize`, and `VideoEditorResult.release()` which enable serialization of the individual video composition components if `configuration.export.video.segments` is enabled.

## [2.15.0]

### Changed
Expand Down
34 changes: 22 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Check out our [video tutorial](https://img.ly/blog/a-photo-and-video-editor-for-
With version `2.13.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, e.g., by updating at least to RN 0.68.0, you'll most likely encounter a build error similar to:

```
FAILURE: Build failed with an exception.
Expand All @@ -44,9 +45,11 @@ 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`.

### Expo CLI

Expand All @@ -63,7 +66,7 @@ In order to use this module with the Expo CLI you can make use of our integrated
```sh
expo install react-native-photoeditorsdk
```

This will automatically install [`react-native-imglysdk`](https://npmjs.org/package/react-native-imglysdk) which you can use to configure your application with our Expo config plugin.

2. Inside your app's `app.json` or `app.config.js` add our config plugin:
Expand All @@ -83,7 +86,7 @@ In order to use this module with the Expo CLI you can make use of our integrated
"react-native-imglysdk",
{
"android": {
"version": "10.1.1",
"version": "10.4.0",
"modules": [
"ui:core",
"ui:transform",
Expand All @@ -103,7 +106,7 @@ In order to use this module with the Expo CLI you can make use of our integrated
```
For further information on the available modules, please refer to step 4 of the React Native CLI [Android](#android) guide below.
**Please note that the `react-native-imglysdk` module manages both VideoEditor SDK as well as PhotoEditor SDK so you only need to add the Expo config plugin once even when using both SDKs.**
3. From version `2.15.0` the iOS deployment target needs to be set to at least iOS 13. You can use the `expo-build-properties` config plugin for this. Please refer to the [official Expo docs](https://docs.expo.dev/versions/v45.0.0/sdk/build-properties/).
Expand Down Expand Up @@ -149,6 +152,7 @@ For older React Native versions autolinking is not available and PhotoEditor SDK
#### Android

1. Add the img.ly repository and plugin by opening the `android/build.gradle` file (**not** `android/app/build.gradle`) and adding these lines at the top:

```groovy
buildscript {
repositories {
Expand All @@ -157,11 +161,12 @@ For older React Native versions autolinking is not available and PhotoEditor SDK
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.32"
classpath 'ly.img.android.sdk:plugin:10.1.1'
classpath 'ly.img.android.sdk:plugin:10.4.0'
}
}
```
In order to update PhotoEditor SDK for Android replace the version string `10.1.1` with a [newer release](https://github.com/imgly/pesdk-android-demo/releases).
In order to update PhotoEditor SDK for Android replace the version string `10.4.0` with a [newer release](https://github.com/imgly/pesdk-android-demo/releases).
2. Still in the `android/build.gradle` file (**not** `android/app/build.gradle`), add these lines at the bottom:
Expand Down Expand Up @@ -189,7 +194,8 @@ For older React Native versions autolinking is not available and PhotoEditor SDK
}
```
4. Configure PhotoEditor 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"`:
4. Configure PhotoEditor 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"`:
```groovy
apply plugin: 'ly.img.android.sdk'
apply plugin: 'kotlin-android'
Expand Down Expand Up @@ -230,25 +236,29 @@ For older React Native versions autolinking is not available and PhotoEditor SDK
Import the module in your `App.js`:
```js
import {PESDK, PhotoEditorModal, Configuration} from 'react-native-photoeditorsdk';
import {
PESDK,
PhotoEditorModal,
Configuration,
} from "react-native-photoeditorsdk";
```
Each platform requires a separate license file. [Unlock PhotoEditor SDK](./index.d.ts#L41-L53) with a single line of code for both platforms via [platform-specific file extensions](https://reactnative.dev/docs/platform-specific-code#platform-specific-extensions):
```js
PESDK.unlockWithLicense(require('./pesdk_license'));
PESDK.unlockWithLicense(require("./pesdk_license"));
```
Open the editor with an image:
```js
PESDK.openEditor(require('./image.jpg'));
PESDK.openEditor(require("./image.jpg"));
```
Or use the component to open the editor:
```jsx
<PhotoEditorModal visible={true} image={require('./image.jpg')}/>
<PhotoEditorModal visible={true} image={require("./image.jpg")} />
```
Please see the [code documentation](./index.d.ts) for more details and additional [customization and configuration options](./configuration.ts).
Expand Down
2 changes: 1 addition & 1 deletion RNPhotoEditorSDK.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ Pod::Spec.new do |s|

s.dependency 'React'
s.dependency 'React-RCTImage'
s.dependency 'PhotoEditorSDK', '~> 11.1'
s.dependency 'PhotoEditorSDK', '~> 11.3'
end
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ imglyConfig {
}
}

def MIN_LY_IMG_ANDROID_SDK_PLUGIN_VERSION = "10.1.1"
def MIN_LY_IMG_ANDROID_SDK_PLUGIN_VERSION = "10.4.0"

task checkVersion {
if (imglyConfig.convertToVersionNumber(imglyConfig.getVersion()) < imglyConfig.convertToVersionNumber(MIN_LY_IMG_ANDROID_SDK_PLUGIN_VERSION)) {
Expand Down
18 changes: 16 additions & 2 deletions configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -606,8 +606,9 @@ export interface Configuration {
/**
* Defines all allowed actions for the sticker tool menu. Only buttons for allowed actions are visible and shown in the given order.
* @note The `StickerAction.REMOVE_BACKGROUND` action is only shown for personal and external (non-animated) stickers where a person could be detected. This feature is only supported on devices running iOS 15+.
* @note The `StickerAction.DURATION` action is only shown when editing videos.
* @example // Defaults to:
* [StickerAction.REPLACE, StickerAction.OPACITY, StickerAction.COLOR, StickerAction.REMOVE_BACKGROUND]
* [StickerAction.DURATION, StickerAction.REPLACE, StickerAction.OPACITY, StickerAction.COLOR, StickerAction.REMOVE_BACKGROUND]
*/
actions?: StickerAction[];
/**
Expand Down Expand Up @@ -685,8 +686,9 @@ export interface Configuration {
fonts?: (Font | ExistingItem)[];
/**
* Defines all allowed actions for the text tool menu. Only buttons for allowed actions are visible and shown in the given order.
* @note The `TextAction.DURATION` action is only shown when editing videos.
* @example // Defaults to:
* [TextAction.FONT, TextAction.COLOR, TextAction.BACKGROUND_COLOR, TextAction.ALIGNMENT]
* [TextAction.DURATION, TextAction.FONT, TextAction.COLOR, TextAction.BACKGROUND_COLOR, TextAction.ALIGNMENT]
*/
actions?: TextAction[];
/**
Expand Down Expand Up @@ -1030,6 +1032,16 @@ export interface Configuration {
* null
*/
bitRate?: number | null;
/**
* Whether the video editor should include the video segments of the composition
* in the `VideoEditorResult`.
* @note If enabled, you need to release the result via `VideoEditorResult.release()`
* after processing the video segments in order to prevent memory leaks.
*
* @example // Defaults to:
* false
*/
segments?: boolean;
}
/**
* The filename for the exported data if the `exportType` is not `ImageExportType.DATA_URL`.
Expand Down Expand Up @@ -1313,6 +1325,7 @@ export enum StickerAction {
REPLACE = "replace",
OPACITY = "opacity",
REMOVE_BACKGROUND = "removebackground",
DURATION = "duration"
}

/** A text action. */
Expand All @@ -1321,6 +1334,7 @@ export enum TextAction {
COLOR = "color",
BACKGROUND_COLOR = "backgroundcolor",
ALIGNMENT = "alignment",
DURATION = "duration"
}

/** A frame action. */
Expand Down
34 changes: 19 additions & 15 deletions ios/RNImglyKit.m
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,15 @@ - (void)present:(nonnull IMGLYMediaEditViewControllerBlock)createMediaEditViewCo
id valueSerializationType = [NSDictionary RN_IMGLY_dictionary:dictionary valueForKeyPath:@"export.serialization.exportType" default:RN_IMGLY.kExportTypeFileURL];
id valueSerializationFile = [NSDictionary RN_IMGLY_dictionary:dictionary valueForKeyPath:@"export.serialization.filename" default:valueExportFile];
id valueSerializationEmbedImage = [NSDictionary RN_IMGLY_dictionary:dictionary valueForKeyPath:@"export.serialization.embedSourceImage" default:@(NO)];
id valueExportVideoSegments = [NSDictionary RN_IMGLY_dictionary:dictionary valueForKeyPath:@"export.video.segments" default:@(NO)];

NSString *exportType = [RCTConvert NSString:valueExportType];
NSURL *exportFile = [RCTConvert RN_IMGLY_ExportFileURL:valueExportFile withExpectedUTI:getUTI(configuration)];
BOOL serializationEnabled = [RCTConvert BOOL:valueSerializationEnabled];
NSString *serializationType = [RCTConvert NSString:valueSerializationType];
NSURL *serializationFile = [RCTConvert RN_IMGLY_ExportFileURL:valueSerializationFile withExpectedUTI:kUTTypeJSON];
BOOL serializationEmbedImage = [RCTConvert BOOL:valueSerializationEmbedImage];
BOOL exportVideoSegments = [RCTConvert BOOL:valueExportVideoSegments];

// Make sure that the export settings are valid
if ((exportType == nil) ||
Expand Down Expand Up @@ -138,6 +140,7 @@ - (void)present:(nonnull IMGLYMediaEditViewControllerBlock)createMediaEditViewCo
self.resolve = resolve;
self.reject = reject;
self.mediaEditViewController = mediaEditViewController;
self.exportVideoSegments = exportVideoSegments;

UIViewController *currentViewController = RCTPresentedViewController();
[currentViewController presentViewController:self.mediaEditViewController animated:YES completion:NULL];
Expand All @@ -159,6 +162,7 @@ - (void)dismiss:(nullable PESDKMediaEditViewController *)mediaEditViewController
self.resolve = nil;
self.reject = nil;
self.mediaEditViewController = nil;
self.exportVideoSegments = nil;

dispatch_async(dispatch_get_main_queue(), ^{
[mediaEditViewController.presentingViewController dismissViewControllerAnimated:animated completion:completion];
Expand Down Expand Up @@ -351,22 +355,22 @@ + (nullable RN_IMGLY_ExportFileURL *)RN_IMGLY_ExportFileURL:(nullable id)json wi

+ (nullable RN_IMGLY_URLRequestArray *)RN_IMGLY_URLRequestArray:(nullable id)json
{
NSArray *array = [RCTConvert NSArray:json];
NSMutableArray<NSURLRequest *> *requests = [NSMutableArray<NSURLRequest *> new];
if (array.count == 0) { return [requests copy]; }
for (id value in array) {
if (value == (id)[NSNull null]) {
RCTLogConvertError(json, @"a valid NSArray<NSURLRequest *>");
return nil;
}
NSURLRequest *request = [RCTConvert NSURLRequest:value];
if (request == nil) {
RCTLogConvertError(value, @"a valid NSURLRequest");
return nil;
}
[requests addObject:request];
NSArray *array = [RCTConvert NSArray:json];
NSMutableArray<NSURLRequest *> *requests = [NSMutableArray<NSURLRequest *> new];
if (array.count == 0) { return [requests copy]; }
for (id value in array) {
if (value == (id)[NSNull null]) {
RCTLogConvertError(json, @"a valid NSArray<NSURLRequest *>");
return nil;
}
return [requests copy];
NSURLRequest *request = [RCTConvert NSURLRequest:value];
if (request == nil) {
RCTLogConvertError(value, @"a valid NSURLRequest");
return nil;
}
[requests addObject:request];
}
return [requests copy];
}

@end
Expand Down
2 changes: 2 additions & 0 deletions ios/RNImglyKitSubclass.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ typedef void (^IMGLYCompletionBlock)(void);
@property (strong, atomic, nullable) RCTPromiseResolveBlock resolve;
@property (strong, atomic, nullable) RCTPromiseRejectBlock reject;
@property (strong, atomic, nullable) PESDKMediaEditViewController* mediaEditViewController;
@property (atomic) BOOL exportVideoSegments;
@property (strong, atomic, nullable) NSString* uuid;

- (void)present:(nonnull IMGLYMediaEditViewControllerBlock)createMediaEditViewController withUTI:(nonnull IMGLYUTIBlock)getUTI
configuration:(nullable NSDictionary *)dictionary serialization:(nullable NSDictionary *)state
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "react-native-photoeditorsdk",
"title": "React Native module for PhotoEditor SDK",
"version": "2.15.0",
"version": "2.16.0",
"description": "A React Native module for PhotoEditor SDK. Integrate the photo editor into your own HTML5, iOS or Android app - in minutes!",
"main": "index.js",
"typings": "index.d.ts",
Expand Down Expand Up @@ -38,6 +38,6 @@
"react-native": ">=0.60.0 <1.0.x"
},
"dependencies": {
"react-native-imglysdk": "2.15.0"
"react-native-imglysdk": "2.16.0"
}
}

0 comments on commit 159561e

Please sign in to comment.