Skip to content

Commit

Permalink
Add version 2.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
leontobias committed Jun 29, 2022
1 parent d10422a commit 6561fd5
Show file tree
Hide file tree
Showing 8 changed files with 108 additions and 83 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## [2.6.0]

### Changed

* 🚨 Bumped iOS deployment target to 13.0.
* [video_editor_sdk] 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.
* [photo_editor_sdk] 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

* [imgly_sdk] Added implementation and documentation for background removal.

## [2.5.0]

### Added
Expand Down
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,20 @@

# Flutter plugin for PhotoEditor SDK

## System requirements

- Flutter: 1.20.0
- Dart: 2.12.0
- iOS: 13
- Android: 5 (SDK 21)

## Getting started

Add the plugin package to the `pubspec.yaml` file in your project:

```yaml
dependencies:
photo_editor_sdk: ^2.5.0
photo_editor_sdk: ^2.6.0
```
Install the new dependency:
Expand Down Expand Up @@ -180,6 +187,7 @@ Run with --stacktrace option to get the stack trace. Run with --info or --debug
include 'assets:sticker-emoticons'

include 'backend:sticker-smart'
include 'backend:background-removal'
}
}
```
Expand Down
40 changes: 20 additions & 20 deletions example/ios/Flutter/AppFrameworkInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>App</string>
<key>CFBundleIdentifier</key>
<string>io.flutter.flutter.app</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>App</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>9.0</string>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>App</string>
<key>CFBundleIdentifier</key>
<string>io.flutter.flutter.app</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>App</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>13.0</string>
</dict>
</plist>
16 changes: 8 additions & 8 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
PODS:
- Flutter (1.0.0)
- imgly_sdk (2.5.0):
- imgly_sdk (2.6.0):
- Flutter
- imglyKit (~> 10.30)
- imglyKit (10.30.1)
- photo_editor_sdk (2.5.0):
- imglyKit (~> 11.1)
- imglyKit (11.2.0)
- photo_editor_sdk (2.6.0):
- Flutter
- imgly_sdk
- imgly_sdk (= 2.6.0)

DEPENDENCIES:
- Flutter (from `Flutter`)
Expand All @@ -27,9 +27,9 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a
imgly_sdk: d8f93e1cbb33f6c27d0ab8f88ccceeeb819ca60d
imglyKit: bb83829ba5d1af548772d61660556473f0391d1c
photo_editor_sdk: c77802987740ac84d84663162c311cae42b9b746
imgly_sdk: bb252939cfbf53a0199a40d565ab675db859a041
imglyKit: 505785f0467867523cdee38ebb7d60c5189faedf
photo_editor_sdk: 6f5cffbb6bff0ac2a5aac6b35320ab9e85faab60

PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c

Expand Down
21 changes: 16 additions & 5 deletions example/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 50;
objectVersion = 51;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -68,7 +68,6 @@
6540F4EA578D4F2F0FC3C7F7 /* Pods-Runner.release.xcconfig */,
4A899B02CDAABDD5638FDD09 /* Pods-Runner.profile.xcconfig */,
);
name = Pods;
path = Pods;
sourceTree = "<group>";
};
Expand Down Expand Up @@ -362,7 +361,11 @@
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
Expand Down Expand Up @@ -494,7 +497,11 @@
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
Expand All @@ -521,7 +528,11 @@
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
Expand Down
82 changes: 38 additions & 44 deletions ios/Classes/FlutterPESDK.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import CoreServices
import ImglyKit
import imgly_sdk

@available(iOS 9.0, *)
@available(iOS 13.0, *)
public class FlutterPESDK: FlutterIMGLY, FlutterPlugin, PhotoEditViewControllerDelegate {

// MARK: - Typealias
Expand Down Expand Up @@ -75,9 +75,9 @@ public class FlutterPESDK: FlutterIMGLY, FlutterPlugin, PhotoEditViewControllerD
if let finalData = serializationData {
var deserializationResult: Deserializer.DeserializationResult?
if let photo_ = photo {
deserializationResult = Deserializer.deserialize(data: finalData, imageDimensions: photo_.size, assetCatalog: configurationData?.assetCatalog ?? .shared)
deserializationResult = Deserializer.deserialize(data: finalData, imageDimensions: photo_.size, assetCatalog: configurationData?.assetCatalog ?? .defaultItems)
} else {
deserializationResult = Deserializer._objCDeserialize(data: finalData, assetCatalog: configurationData?.assetCatalog ?? .shared)
deserializationResult = Deserializer._objCDeserialize(data: finalData, assetCatalog: configurationData?.assetCatalog ?? .defaultItems)
if let serializationPhoto = deserializationResult?.photo {
finalPhotoAsset = Photo.from(photoRepresentation: serializationPhoto)
} else {
Expand Down Expand Up @@ -125,56 +125,53 @@ public class FlutterPESDK: FlutterIMGLY, FlutterPlugin, PhotoEditViewControllerD
}
}
}

private func handleError(_ photoEditViewController: PhotoEditViewController, code: String, message: String?, details: Any?) {
self.dismiss(mediaEditViewController: photoEditViewController, animated: true) {
self.result?(FlutterError(code: code, message: message, details: details))
self.result = nil
}
}
}

// MARK: - Delegate

/// The delegate for the `PhotoEditViewController`.
@available(iOS 9.0, *)
@available(iOS 13.0, *)
extension FlutterPESDK {

/// Delegate function called when the `PhotoEditViewController` has successfully exported the image.
/// - Parameter photoEditViewController: The editor who has finished exporting.
/// - Parameter image: The exported image.
/// - Parameter data: The image data.
public func photoEditViewController(_ photoEditViewController: PhotoEditViewController, didSave image: UIImage, and data: Data) {
let options = photoEditViewController.configuration.photoEditViewControllerOptions
var imageData: Data? = data

if imageData != nil {
switch options.outputImageFileFormat {
case .png:
imageData = image.pngData()
break
case .jpeg:
imageData = image.jpegData(compressionQuality: options.compressionQuality)
break
default:
break
}
/// - Parameter result: The `PhotoEditorResult` from the editor.
public func photoEditViewControllerDidFinish(_ photoEditViewController: PhotoEditViewController, result: PhotoEditorResult) {
guard let uti = result.output.uti else {
self.handleError(photoEditViewController, code: "Image could not be saved.", message: nil, details: nil)
return
}

var imageString: NSString?
let imageData = result.output.data
var imageString: String?
var serialization: Any?

if imageData?.isEmpty == false {
if imageData.isEmpty == false {
if self.exportType == IMGLYConstants.kExportTypeFileURL {
guard let fileURL = self.exportFile else {
self.result?(FlutterError(code: "Export type must not be nil.", message: "No valid export type has been specified.", details: self.exportFile))
self.result = nil
self.handleError(photoEditViewController, code: "Export type must not be nil.", message: "No valid export type has been specified.", details: self.exportFile)
return
}
do {
try imageData?.IMGLYwriteToUrl(fileURL, andCreateDirectoryIfNeeded: true)
imageString = (self.exportFile?.absoluteString ?? "nil") as NSString
try imageData.IMGLYwriteToUrl(fileURL, andCreateDirectoryIfNeeded: true)
imageString = fileURL.absoluteString
} catch let error {
self.result?(FlutterError(code: "Image could not be saved.", message: "Error message: \(error.localizedDescription)", details: error))
self.result = nil
self.handleError(photoEditViewController, code: "Image could not be saved.", message: "Error message: \(error.localizedDescription)", details: error)
return
}
} else if self.exportType == IMGLYConstants.kExportTypeDataURL {
let mediaType: NSString? = UTTypeCopyPreferredTagWithClass(options.outputImageFileFormatUTI, kUTTagClassMIMEType)?.takeRetainedValue()
imageString = String(format: "data:%@;base64,%@", mediaType!, imageData!.base64EncodedString()) as NSString
if let mediaType = UTTypeCopyPreferredTagWithClass(uti as CFString, kUTTagClassMIMEType)?.takeRetainedValue() as? NSString {
imageString = String(format: "data:%@;base64,%@", mediaType, imageData.base64EncodedString())
} else {
self.handleError(photoEditViewController, code: "Image could not be saved.", message: "The output UTI could not be read.", details: nil)
return
}
}
}

Expand All @@ -184,29 +181,28 @@ extension FlutterPESDK {
}
if self.serializationType == IMGLYConstants.kExportTypeFileURL {
guard let exportURL = self.serializationFile else {
self.result?(FlutterError(code: "Serialization failed.", message: "The URL must not be nil.", details: nil))
self.result = nil
self.handleError(photoEditViewController, code: "Serialization failed.", message: "The URL must not be nil.", details: nil)
return
}
do {
try serializationData.IMGLYwriteToUrl(exportURL, andCreateDirectoryIfNeeded: true)
serialization = self.serializationFile?.absoluteString
} catch let error {
self.result?(FlutterError(code: "Serialization failed.", message: error.localizedDescription, details: error))
self.result = nil
self.handleError(photoEditViewController, code: "Serialization failed.", message: error.localizedDescription, details: error)
return
}
} else if self.serializationType == IMGLYConstants.kExportTypeObject {
do {
serialization = try JSONSerialization.jsonObject(with: serializationData, options: .init(rawValue: 0))
} catch let error {
self.result?(FlutterError(code: "Serialization failed.", message: error.localizedDescription, details: error))
self.result = nil
self.handleError(photoEditViewController, code: "Serialization failed.", message: error.localizedDescription, details: error)
return
}
}
}

self.dismiss(mediaEditViewController: photoEditViewController, animated: true) {
let res: [String: Any?] = ["image": imageString ?? "no image exported", "hasChanges": photoEditViewController.hasChanges, "serialization": serialization]
let res: [String: Any?] = ["image": imageString ?? "no image exported", "hasChanges": result.status == .renderedWithChanges, "serialization": serialization]
self.result?(res)
self.result = nil
}
Expand All @@ -216,11 +212,9 @@ extension FlutterPESDK {
/// to export the image.
///
/// - Parameter photoEditViewController: The editor that failed to export.
public func photoEditViewControllerDidFailToGeneratePhoto(_ photoEditViewController: PhotoEditViewController) {
self.dismiss(mediaEditViewController: photoEditViewController, animated: true) {
self.result?(FlutterError(code: "editor_failed", message: "The editor did fail to generate the image.", details: nil))
self.result = nil
}
/// - Parameter error: The `PhotoEditorError` that caused the failure.
public func photoEditViewControllerDidFail(_ photoEditViewController: PhotoEditViewController, error: PhotoEditorError) {
self.handleError(photoEditViewController, code: "Editor failed", message: "The editor did fail to generate the image.", details: error)
}

/// Delegate function that is called if the `PhotoEditViewController` has
Expand Down
6 changes: 3 additions & 3 deletions ios/photo_editor_sdk.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ The official Flutter plugin for PhotoEditor SDK. Integrate the photo editor into
s.source = { :path => '.' }
s.source_files = 'Classes/**/*'
s.dependency 'Flutter'
s.platform = :ios, '9.0'
s.dependency 'imgly_sdk'
s.platform = :ios, '13.0'
s.dependency 'imgly_sdk', s.version.to_s

# Flutter.framework does not contain a i386 slice.
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' }
s.swift_version = '5.0'
s.swift_version = '5.6'
end
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: photo_editor_sdk
description: The official Flutter plugin for PhotoEditor SDK. Integrate the photo editor into your own iOS or Android app - in minutes!
version: 2.5.0
version: 2.6.0
homepage: https://www.photoeditorsdk.com
repository: https://github.com/imgly/pesdk-flutter

Expand All @@ -11,7 +11,7 @@ environment:
dependencies:
flutter:
sdk: flutter
imgly_sdk: 2.5.0
imgly_sdk: 2.6.0

dev_dependencies:
flutter_test:
Expand Down

0 comments on commit 6561fd5

Please sign in to comment.