Skip to content

Commit

Permalink
Add version 2.15.0
Browse files Browse the repository at this point in the history
  • Loading branch information
leontobias committed Jun 30, 2022
1 parent d645aba commit 6722946
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 36 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## [2.15.0]

### Changed

* 🚨 Bumped iOS deployment target to 13.0.
* [react-native-videoeditorsdk] Raised minimum VideoEditor SDK for iOS version to 11.1.0. See the [changelog](https://github.com/imgly/vesdk-ios-build/blob/master/CHANGELOG.md) for more information.
* [react-native-photoeditorsdk] Raised minimum PhotoEditor SDK for iOS version to 11.1.0. See the [changelog](https://github.com/imgly/pesdk-ios-build/blob/master/CHANGELOG.md) for more information.

### Added

* Added implementation and documentation for background removal.

## [2.14.0]

### Added
Expand Down
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@

Check out our [video tutorial](https://img.ly/blog/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.

## System requirements

- React Native: 0.60
- iOS: 13
- Android: 5 (SDK 21)

## Getting started

### Known Issues
Expand Down Expand Up @@ -100,7 +106,9 @@ In order to use this module with the Expo CLI you can make use of our integrated
**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. The changes will be applied on `expo prebuild` or during the prebuild phase of `eas build`.
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/).
4. The changes will be applied on `expo prebuild` or during the prebuild phase of `eas build`.
For further information on how to integrate Expo config plugins please also refer to the official [docs](https://docs.expo.dev/guides/config-plugins/#using-a-plugin-in-your-app).
Expand Down Expand Up @@ -212,6 +220,7 @@ For older React Native versions autolinking is not available and PhotoEditor SDK
include 'assets:sticker-emoticons'
include 'backend:sticker-smart'
include 'backend:background-removal'
}
}
```
Expand Down
4 changes: 2 additions & 2 deletions RNPhotoEditorSDK.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ Pod::Spec.new do |s|
s.homepage = package['homepage']
s.license = { :type => package['license'], :file => package['licenseFilename'] }
s.author = { package['author']['name'] => package['author']['email'] }
s.platform = :ios, '9.0'
s.platform = :ios, '13.0'
s.source = { :git => package['repository']['url'], :tag => "#{s.version}" }
s.source_files = 'ios/**/*.{h,m,swift}'
s.public_header_files = ['ios/RNPhotoEditorSDK.h', 'ios/RNImglyKit.h']
s.requires_arc = true

s.dependency 'React'
s.dependency 'React-RCTImage'
s.dependency 'PhotoEditorSDK', '~> 10.30'
s.dependency 'PhotoEditorSDK', '~> 11.1'
end
7 changes: 6 additions & 1 deletion configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@ export interface Configuration {
/**
* Defines all allowed actions for the main screen that are displayed as overlay buttons on the canvas.
* Only buttons for allowed actions are visible.
* @note The `CanvasAction.REMOVE_BACKGROUND` action is only shown when editing photos where a person could be detected. This feature is only supported on devices running iOS 15+.
* @note The `CanvasAction.SOUND_ON_OFF` and `CanvasAction.PLAY_PAUSE` action is only shown when editing videos.
* @example // Defaults to:
* [CanvasAction.SOUND_ON_OFF, CanvasAction.PLAY_PAUSE, CanvasAction.UNDO, CanvasAction.REDO]
*/
mainCanvasActions?: Array<
CanvasAction.REMOVE_BACKGROUND |
CanvasAction.SOUND_ON_OFF |
CanvasAction.PLAY_PAUSE |
CanvasAction.UNDO |
Expand Down Expand Up @@ -603,8 +605,9 @@ export interface Configuration {
colors?: ColorPalette;
/**
* 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+.
* @example // Defaults to:
* [StickerAction.REPLACE, StickerAction.OPACITY, StickerAction.COLOR]
* [StickerAction.REPLACE, StickerAction.OPACITY, StickerAction.COLOR, StickerAction.REMOVE_BACKGROUND]
*/
actions?: StickerAction[];
/**
Expand Down Expand Up @@ -1297,6 +1300,7 @@ export enum CanvasAction {
INVERT = "invert",
SOUND_ON_OFF = "soundonoff",
PLAY_PAUSE = "playpause",
REMOVE_BACKGROUND = "removebackground",
}

/** A sticker action. */
Expand All @@ -1308,6 +1312,7 @@ export enum StickerAction {
SATURATION = "saturation",
REPLACE = "replace",
OPACITY = "opacity",
REMOVE_BACKGROUND = "removebackground",
}

/** A text action. */
Expand Down
55 changes: 25 additions & 30 deletions ios/RNPhotoEditorSDK.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ + (void)setWillPresentPhotoEditViewController:(RNPESDKWillPresentBlock)willPrese
_willPresentPhotoEditViewController = willPresentBlock;
}

- (void)handleError:(nonnull PESDKPhotoEditViewController *)photoEditViewController code:(nullable NSString *)code message:(nullable NSString *)message error:(nullable NSError *)error {
RCTPromiseRejectBlock reject = self.reject;
[self dismiss:photoEditViewController animated:YES completion:^{
reject(code, message, error);
}];
}

@synthesize bridge = _bridge;

- (void)present:(nullable PESDKPhoto *)photo withConfiguration:(nullable NSDictionary *)dictionary andSerialization:(nullable NSDictionary *)state
Expand Down Expand Up @@ -140,23 +147,15 @@ - (void)present:(nullable PESDKPhoto *)photo withConfiguration:(nullable NSDicti

#pragma mark - PESDKPhotoEditViewControllerDelegate

- (void)photoEditViewController:(nonnull PESDKPhotoEditViewController *)photoEditViewController didSaveImage:(nonnull UIImage *)uiImage imageAsData:(nonnull NSData *)imageData {
PESDKPhotoEditViewControllerOptions *photoEditViewControllerOptions = photoEditViewController.configuration.photoEditViewControllerOptions;

if (imageData.length == 0) {
// Export image without any changes to target format if possible.
switch (photoEditViewControllerOptions.outputImageFileFormat) {
case PESDKImageFileFormatPng:
imageData = UIImagePNGRepresentation(uiImage);
break;
case PESDKImageFileFormatJpeg:
imageData = UIImageJPEGRepresentation(uiImage, photoEditViewControllerOptions.compressionQuality);
break;
default:
break;
}
- (void)photoEditViewControllerDidFinish:(nonnull PESDKPhotoEditViewController *)photoEditViewController result:(nonnull PESDKPhotoEditorResult *)result {
NSString *uti = result.output.uti;

if (uti == nil) {
[self handleError:photoEditViewController code:RN_IMGLY.kErrorUnableToExport message:@"Image could not be saved." error:nil];
return;
}

NSData *imageData = result.output.data;
NSError *error = nil;
NSString *image = nil;
id serialization = nil;
Expand All @@ -167,7 +166,7 @@ - (void)photoEditViewController:(nonnull PESDKPhotoEditViewController *)photoEdi
image = self.exportFile.absoluteString;
}
} else if ([self.exportType isEqualToString:RN_IMGLY.kExportTypeDataURL]) {
NSString *mediaType = CFBridgingRelease(UTTypeCopyPreferredTagWithClass(photoEditViewControllerOptions.outputImageFileFormatUTI, kUTTagClassMIMEType));
NSString *mediaType = CFBridgingRelease(UTTypeCopyPreferredTagWithClass((__bridge CFStringRef)uti, kUTTagClassMIMEType));
image = [NSString stringWithFormat:@"data:%@;base64,%@", mediaType, [imageData base64EncodedStringWithOptions: 0]];
}
}
Expand All @@ -184,17 +183,16 @@ - (void)photoEditViewController:(nonnull PESDKPhotoEditViewController *)photoEdi
}
}

RCTPromiseResolveBlock resolve = self.resolve;
RCTPromiseRejectBlock reject = self.reject;
[self dismiss:photoEditViewController animated:YES completion:^{
if (error == nil) {
if (error == nil) {
RCTPromiseResolveBlock resolve = self.resolve;
[self dismiss:photoEditViewController animated:YES completion:^{
resolve(@{ @"image": (image != nil) ? image : [NSNull null],
@"hasChanges": @(photoEditViewController.hasChanges),
@"hasChanges": @(result.status == PESDKPhotoEditorStatusRenderedWithChanges),
@"serialization": (serialization != nil) ? serialization : [NSNull null] });
} else {
reject(RN_IMGLY.kErrorUnableToExport, [NSString RN_IMGLY_string:@"Unable to export image or serialization." withError:error], error);
}
}];
}];
} else {
[self handleError:photoEditViewController code:RN_IMGLY.kErrorUnableToExport message:[NSString RN_IMGLY_string:@"Unable to export image or serialization." withError:error] error:error];
}
}

- (void)photoEditViewControllerDidCancel:(nonnull PESDKPhotoEditViewController *)photoEditViewController {
Expand All @@ -204,11 +202,8 @@ - (void)photoEditViewControllerDidCancel:(nonnull PESDKPhotoEditViewController *
}];
}

- (void)photoEditViewControllerDidFailToGeneratePhoto:(nonnull PESDKPhotoEditViewController *)photoEditViewController {
RCTPromiseRejectBlock reject = self.reject;
[self dismiss:photoEditViewController animated:YES completion:^{
reject(RN_IMGLY.kErrorUnableToExport, @"Unable to generate image", nil);
}];
- (void)photoEditViewControllerDidFail:(nonnull PESDKPhotoEditViewController *)photoEditViewController error:(PESDKPhotoEditorError *)error {
[self handleError:photoEditViewController code:RN_IMGLY.kErrorUnableToExport message:@"Unable to generate image" error:error];
}

@end
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.14.0",
"version": "2.15.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.14.0"
"react-native-imglysdk": "2.15.0"
}
}

0 comments on commit 6722946

Please sign in to comment.