Skip to content

Commit

Permalink
Add version 3.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
leontobias committed Mar 27, 2024
1 parent 190a388 commit caac9c5
Show file tree
Hide file tree
Showing 11 changed files with 56 additions and 51 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## [3.4.0]

### Changed

* [Android] 🚨 With this version you will need to specify a suitable KSP depending on the Kotlin version you are using. Please visit our guide [here](https://github.com/imgly/pesdk-cordova/blob/master/README.md#ksp).
* [Android] Raised minimum PhotoEditor SDK for Android version to 10.9.0.
* [iOS] 🚨 Bumped iOS deployment target to 13.0.
* [iOS] Raised minimum PhotoEditor SDK for iOS version to 11.8.

## [3.3.0]

### Added
Expand Down
4 changes: 2 additions & 2 deletions LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ In order to run any samples or use any wrapper without a watermark,
you'll have to purchase a commercial PhotoEditor SDK or VideoEditor SDK
license. Visit https://img.ly for more details.

Copyright (c) 2014-2022, img.ly GmbH
Copyright (c) 2014-2024, IMG.LY GmbH
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand All @@ -17,7 +17,7 @@ modification, are permitted provided that the following conditions are met:
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

3. Neither the name img.ly GmbH, img.ly, PhotoEditor SDK, VideoEditor SDK
3. Neither the name IMG.LY GmbH, IMG.LY, PhotoEditor SDK, VideoEditor SDK
nor the names of its developers may be used to endorse or promote products
derived from this software without specific prior written permission.

Expand Down
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,20 @@ You can configure the native Android PhotoEditor SDK version used by creating a

If no version / no configuration file is specified, the module will use the default minimum required version.

#### KSP

With version `3.2.0` of the PhotoEditor SDK for Cordova, the integration of the native Android PE.SDK has changed. The new minimum Android PE.SDK version is `10.9.0` which requires [Kotlin Symbol Processing (KSP)](https://github.com/google/ksp).
The KSP version depends on the Kotlin version that you are using. In order to find the correct version, please visit the [official KSP release page](https://github.com/google/ksp/releases?page=1).
In order to specify the KSP version, please add an entry to the `imglyConfig.json`:

```json
{
"kspVersion": "1.7.21-1.0.8"
}
```

By default, version `1.7.21-1.0.8` is used which is suitable for Kotlin `1.7.21`.

#### AndroidX

From version `3.0.0` the plugin uses AndroidX. To enable AndroidX in your application please adjust your `config.xml`:
Expand Down Expand Up @@ -109,6 +123,10 @@ Because PhotoEditor SDK for Android with all its modules is quite large, there i
cordova plugin add cordova-plugin-enable-multidex
```

### iOS

With version `3.4.0` the plugin requires a deployment target of 13.0+ for iOS. If needed, please update your deployment target inside the `config.xml` as described [here](https://cordova.apache.org/docs/en/latest/config_ref/index.html).

### Usage

Each platform requires a separate license file. Unlock PhotoEditor SDK with a single line of code for both platforms via platform-specific file extensions.
Expand Down
17 changes: 2 additions & 15 deletions hooks/copy-imglyConfig-gradle-hook.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ module.exports = (context) => {
return new Promise((resolve, reject) => {
const BLOCK_START = `// imglyConfig ADDED BY IMGLY - BLOCK START`;
const BLOCK_END = `// imglyConfig ADDED BY IMGLY - BLOCK END`;
const imglyConfigHeader = `
apply plugin: 'ly.img.android.sdk'
apply plugin: 'kotlin-android'
`;

// The content of the gradle file in the cordova app root
const projectRoot = path.join(context.opts.projectRoot);
Expand All @@ -35,22 +31,13 @@ apply plugin: 'kotlin-android'
gradleFiles,
function (file, callback) {
let fileContents = fs.readFileSync(file, "utf8");

let whereToAdd = fileContents.indexOf(
"// PLUGIN GRADLE EXTENSIONS START"
);

fileContents =
fileContents.substr(0, whereToAdd) +
fileContents +
BLOCK_START +
imglyConfigHeader +
imglyConfig +
BLOCK_END +
"\n" +
fileContents.substr(whereToAdd);
BLOCK_END
fs.writeFileSync(file, fileContents, "utf8");
console.log("updated " + file + " to include imglyConfig");

callback();
},
function (err) {
Expand Down
8 changes: 6 additions & 2 deletions hooks/dependencies-gradle-hook.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ 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.5.32';
var sdkVersion = "10.1.1";
const gradlePluginVersion = '1.7.21';
var sdkVersion = "10.9.0";
var kspVersion = "1.7.21-1.0.8";

try {
const configFilePath = path.join(
Expand All @@ -21,7 +22,9 @@ module.exports = (context) => {
if (config != null) {
const configJson = JSON.parse(config);
const configVersion = configJson.version;
const configKspVersion = configJson.kspVersion;
if (configVersion != null) sdkVersion = configVersion;
if (configKspVersion != null) kspVersion = configKspVersion;
}
} catch {
console.log(
Expand All @@ -33,6 +36,7 @@ module.exports = (context) => {
"\n" +
BLOCK_START +
`
classpath "com.google.devtools.ksp:com.google.devtools.ksp.gradle.plugin:${kspVersion}"
classpath "ly.img.android.sdk:plugin:${sdkVersion}"` +
"\n" +
BLOCK_END +
Expand Down
3 changes: 1 addition & 2 deletions hooks/imglyConfig-gradle-hook.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
const fs = require("fs");
const path = require("path");
const async = require("async");

module.exports = (context) => {
"use strict";

const imglyConfig = `
// Comment out the modules you don't need, to save size.
imglyConfig {
IMGLY.configure {
modules {
include 'ui:text'
include 'ui:focus'
Expand Down
2 changes: 1 addition & 1 deletion hooks/repositories-gradle-hook.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ module.exports = (context) => {
fileContents = fileContents + "\n" + BLOCK_START + "\n" + `allprojects {\n repositories {\n ${mavenRepository}\n }\n}` + "\n" + BLOCK_END;
}
fs.writeFileSync(file, fileContents, "utf8");
console.log("Updated " + file + " to include img.ly repositories.");
console.log("Updated " + file + " to include IMG.LY repositories.");
return;
};
});
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": "cordova-plugin-photoeditorsdk",
"description": "A Cordova plugin for PhotoEditor SDK. Integrate the photo editor into your own HTML5, iOS or Android app - in minutes!",
"version": "3.3.0",
"version": "3.4.0",
"types": "./types/index.d.ts",
"main": "www/photoeditorsdk.js",
"scripts": {
Expand Down Expand Up @@ -37,7 +37,7 @@
},
"homepage": "https://www.photoeditorsdk.com",
"author": {
"name": "img.ly GmbH",
"name": "IMG.LY GmbH",
"email": "contact@img.ly"
},
"license": "BSD-3-Clause",
Expand Down
6 changes: 3 additions & 3 deletions plugin.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android" id="cordova-plugin-photoeditorsdk" version="3.3.0">
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android" id="cordova-plugin-photoeditorsdk" version="3.4.0">
<name>PhotoEditorSDK</name>
<description>A Cordova plugin for PhotoEditor SDK. Integrate the photo editor into your own HTML5, iOS or Android app - in minutes!</description>
<license>BSD-3-Clause</license>
<keywords>cordova,cordova-android,cordova-ios,image,image editor,imageeditor,photo,photo editor,photoeditor,photoeditorsdk,PhotoEditor SDK,SDK,ios,android</keywords>
<repo>https://github.com/imgly/pesdk-cordova.git</repo>
<author>img.ly GmbH, contact@img.ly</author>
<author>IMG.LY GmbH, contact@img.ly</author>

<engines>
<engine name="cordova" version=">=9.0.0"/>
Expand Down Expand Up @@ -68,7 +68,7 @@
<source url="https://github.com/CocoaPods/Specs.git"/>
</config>
<pods use-frameworks="true">
<pod name="PhotoEditorSDK" spec="~> 10.30"/>
<pod name="PhotoEditorSDK" spec="~> 11.8"/>
</pods>
</podspec>
</platform>
Expand Down
2 changes: 1 addition & 1 deletion src/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ apply plugin: 'ly.img.android.sdk'
apply plugin: 'kotlin-android'

// Configure the PESDKPlugin
imglyConfig {
IMGLY.predefine {
pesdk {
enabled true
}
Expand Down
34 changes: 11 additions & 23 deletions src/ios/PESDKPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -321,39 +321,26 @@ - (void)dismiss:(nullable PESDKMediaEditViewController *)mediaEditViewController
#pragma mark - PESDKPhotoEditViewControllerDelegate

// The PhotoEditViewController did save an image.
- (void)photoEditViewController:(PESDKPhotoEditViewController *)photoEditViewController
didSaveImage:(UIImage *)uiImage
imageAsData:(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:(PESDKPhotoEditViewController * _Nonnull)photoEditViewController result:(PESDKPhotoEditorResult * _Nonnull)result {
NSString *uti = result.output.uti;
if (uti == nil) {
CDVPluginResult *result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"Image could not be saved."];
[self closeControllerWithResult:result];
return;
}

NSData *imageData = result.output.data;
NSError *error = nil;
NSString *image = nil;
id serialization = nil;

if (imageData.length != 0) {

if ([self.exportType isEqualToString:CDV_IMGLY.kExportTypeFileURL]) {
if ([imageData CDV_IMGLY_writeToURL:self.exportFile andCreateDirectoryIfNecessary:YES error:&error]) {
image = self.exportFile.absoluteString;
}
} else if ([self.exportType isEqualToString:CDV_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 @@ -375,7 +362,7 @@ - (void)photoEditViewController:(PESDKPhotoEditViewController *)photoEditViewCon
CDVPluginResult *resultAsync;
NSDictionary *payload = [NSDictionary
dictionaryWithObjectsAndKeys:(image != nil) ? image : [NSNull null], @"image",
@(photoEditViewController.hasChanges), @"hasChanges",
@(result.status == PESDKPhotoEditorStatusRenderedWithChanges), @"hasChanges",
(serialization != nil) ? serialization : [NSNull null], @"serialization", nil];
resultAsync = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:payload];

Expand All @@ -394,11 +381,12 @@ - (void)photoEditViewControllerDidCancel:(PESDKPhotoEditViewController *)photoEd
}

// The PhotoEditViewController could not create an image.
- (void)photoEditViewControllerDidFailToGeneratePhoto:(PESDKPhotoEditViewController *)photoEditViewController {
- (void)photoEditViewControllerDidFail:(PESDKPhotoEditViewController * _Nonnull)photoEditViewController error:(PESDKPhotoEditorError * _Nonnull)error {
CDVPluginResult *result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR
messageAsString:@"Unable to generate image."];
[self closeControllerWithResult:result];
}

@end

@implementation NSDictionary (CDV_IMGLY_Category)
Expand Down

0 comments on commit caac9c5

Please sign in to comment.