Skip to content

Commit

Permalink
Add version 2.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
leontobias committed Mar 28, 2023
1 parent 1b876f2 commit 69a8992
Show file tree
Hide file tree
Showing 12 changed files with 102 additions and 42 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## [2.8.0]

### Added

* [video_editor_sdk] Added `VideoEditorResult.segments`, `VideoEditorResult.videoSize`, and `VideoEditorResult.release()` which enable serialization of the individual video composition components if `VideoOptions.segments` is enabled.
* [video_editor_sdk] Added `FlutterVESDK.editorWillOpenClosure` and `FlutterVESDK.editorWillExportClosure` which allow further native configuration on Android.
* [photo_editor_sdk] Added `FlutterPESDK.editorWillOpenClosure` and `FlutterPESDK.editorWillExportClosure` which allow further native configuration on Android.

### Fixed

* [imgly_sdk] Fixed `TextOptions.canvasActions` would use `StickerCanvasAction` instead of `TextCanvasAction`.

## [2.7.1]

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
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-2023, img.ly GmbH
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ imglyConfig {
}
}

def MIN_LY_IMG_ANDROID_SDK_PLUGIN_VERSION = "10.4.0"
def MIN_LY_IMG_ANDROID_SDK_PLUGIN_VERSION = "10.4.1"

task checkVersion {
if (imglyConfig.convertToVersionNumber(imglyConfig.getVersion()) < imglyConfig.convertToVersionNumber(MIN_LY_IMG_ANDROID_SDK_PLUGIN_VERSION)) {
Expand Down
15 changes: 12 additions & 3 deletions android/src/main/kotlin/ly/img/flutter/imgly_sdk/FlutterIMGLY.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ import io.flutter.plugin.common.MethodChannel
import io.flutter.plugin.common.PluginRegistry
import ly.img.android.pesdk.backend.decoder.ImageSource
import ly.img.android.pesdk.backend.model.state.manager.SettingsList
import ly.img.android.pesdk.backend.model.state.manager.StateHandler
import ly.img.android.pesdk.backend.model.state.manager.configure
import ly.img.android.pesdk.ui.activity.EditorActivity
import ly.img.android.pesdk.ui.activity.EditorBuilder
import ly.img.android.pesdk.ui.model.state.UiConfigTheme
import org.json.JSONArray
Expand All @@ -24,7 +26,11 @@ import ly.img.android.pesdk.utils.MainThreadRunnable
import ly.img.android.sdk.config.Configuration
import ly.img.android.sdk.config.skipIfNotExists
import ly.img.android.serializer._3.IMGLYFileReader
import java.util.*
import kotlin.collections.ArrayList
import kotlin.collections.HashMap

/** FlutterIMGLY */
open class FlutterIMGLY: FlutterPlugin, MethodChannel.MethodCallHandler, ActivityAware, PluginRegistry.RequestPermissionsResultListener, PluginRegistry.ActivityResultListener, PermissionRequest.Response {

/** The *MethodChannel* that will handle the communication between Flutter and native Android.
Expand All @@ -40,12 +46,14 @@ open class FlutterIMGLY: FlutterPlugin, MethodChannel.MethodCallHandler, Activit
/** The current *Result* handling the message channel. */
var result: MethodChannel.Result? = null

/** The currently used `Configuration`. */
/** The currently used *Configuration*. */
var currentConfig: Configuration? = null

/** The currently used *FlutterPluginBinding*. */
private var binding: FlutterPlugin.FlutterPluginBinding? = null

private var currentEditorUID: String = UUID.randomUUID().toString()

/** Called as soon as the plugin is attached to the engine. */
override fun onAttachedToEngine(binding: FlutterPlugin.FlutterPluginBinding) {
this.binding = binding
Expand Down Expand Up @@ -105,10 +113,11 @@ open class FlutterIMGLY: FlutterPlugin, MethodChannel.MethodCallHandler, Activit
*
* @param settingsList The *SettingsList* which configures the editor.
*/
fun startEditor(settingsList: SettingsList, resultID: Int) {
fun startEditor(settingsList: SettingsList, resultID: Int, activity: Class<out EditorActivity>) {
val currentActivity = this.currentActivity ?: throw RuntimeException("Can't start the Editor because there is no current activity")
currentEditorUID = UUID.randomUUID().toString()
MainThreadRunnable {
EditorBuilder(currentActivity)
EditorBuilder(currentActivity, activity)
.setSettingsList(settingsList)
.startActivityForResult(currentActivity, resultID, arrayOfNulls(0))
settingsList.release()
Expand Down
2 changes: 1 addition & 1 deletion example/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
buildscript {
ext.kotlin_version = '1.5.32'
ext.pesdk_version = '10.4.0'
ext.pesdk_version = '10.4.1'

repositories {
google()
Expand Down
8 changes: 4 additions & 4 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
PODS:
- Flutter (1.0.0)
- imgly_sdk (2.7.1):
- imgly_sdk (2.8.0):
- Flutter
- imglyKit (~> 11.3)
- imglyKit (11.3.3)
- imglyKit (11.5.1)

DEPENDENCIES:
- Flutter (from `Flutter`)
Expand All @@ -21,8 +21,8 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
imgly_sdk: e80792e7f6cc62a47d621e11c49f35182f8c2354
imglyKit: 5dba5e59e819f4dd1cb65e1591102459c41d006b
imgly_sdk: 35dd26c1125c92f628f3464075ad4c24fcdbce26
imglyKit: b1b3b827799a50b090433ca7c61f90b078944898

PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3

Expand Down
4 changes: 3 additions & 1 deletion 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 = 51;
objectVersion = 54;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -221,6 +221,7 @@
};
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
Expand All @@ -235,6 +236,7 @@
};
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
Expand Down
2 changes: 2 additions & 0 deletions example/ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,7 @@
<false/>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
</dict>
</plist>
30 changes: 15 additions & 15 deletions ios/Classes/FlutterIMGLY.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ open class FlutterIMGLY: NSObject {
/// within the serialization.
public var serializationEmbedImage: Bool?

/// Indicates whether the VideoEditor SDK should export the individual video segments.
public var serializeVideoSegments: Bool = false

/// IMGLY constants for the plugin use.
public struct IMGLYConstants {
public static let kErrorUnableToUnlock = "E_UNABLE_TO_UNLOCK"
Expand Down Expand Up @@ -151,7 +154,8 @@ open class FlutterIMGLY: NSObject {
let serializationEnabledValue = self.IMGLYDictionary(with: resolvedConfiguration, valueForKeyPath: "export.serialization.enabled", defaultValue: false) as? Bool,
let serializationTypeValue = self.IMGLYDictionary(with: resolvedConfiguration, valueForKeyPath: "export.serialization.exportType", defaultValue: IMGLYConstants.kExportTypeFileURL) as? String,
let serializationFileValue = self.IMGLYDictionary(with: resolvedConfiguration, valueForKeyPath: "export.serialization.filename", defaultValue: "imgly-export/\(UUID().uuidString)") as? String,
let serializationEmbedImageValue = self.IMGLYDictionary(with: resolvedConfiguration, valueForKeyPath: "export.serialization.embedSourceImage", defaultValue: false) as? Bool else {
let serializationEmbedImageValue = self.IMGLYDictionary(with: resolvedConfiguration, valueForKeyPath: "export.serialization.embedSourceImage", defaultValue: false) as? Bool,
let serializeVideoSegments = self.IMGLYDictionary(with: resolvedConfiguration, valueForKeyPath: "export.video.segments", defaultValue: false) as? Bool else {
self.result?(FlutterError(code: "Configuration invalid.", message: "The configuration could not be parsed.", details: nil))
self.result = nil
return
Expand All @@ -168,6 +172,7 @@ open class FlutterIMGLY: NSObject {
self.serializationType = serializationTypeValue
self.serializationFile = serializationFile
self.serializationEmbedImage = serializationEmbedImageValue
self.serializeVideoSegments = serializeVideoSegments

// Check whether the export settings are valid.
if (self.exportType == nil) || (self.exportFile == nil && self.exportType == IMGLYConstants.kExportTypeFileURL) || (serializationFile == nil && self.serializationType == IMGLYConstants.kExportTypeFileURL) {
Expand Down Expand Up @@ -207,20 +212,15 @@ open class FlutterIMGLY: NSObject {
let navigationController = UINavigationController(rootViewController: controller)
navigationController.modalPresentationStyle = .fullScreen

if #available(iOS 13.0, *) {
let appearance = UINavigationBarAppearance()
appearance.configureWithOpaqueBackground()
appearance.backgroundColor = configuration?.theme.toolbarBackgroundColor
appearance.shadowColor = configuration?.theme.toolbarBackgroundColor
navigationController.navigationBar.standardAppearance = appearance
navigationController.navigationBar.scrollEdgeAppearance = appearance
navigationController.navigationBar.compactAppearance = appearance
if #available(iOS 15.0, *) {
navigationController.navigationBar.compactScrollEdgeAppearance = appearance
}
} else {
navigationController.navigationBar.barTintColor = configuration?.theme.toolbarBackgroundColor
navigationController.navigationBar.shadowImage = UIImage()
let appearance = UINavigationBarAppearance()
appearance.configureWithOpaqueBackground()
appearance.backgroundColor = configuration?.theme.toolbarBackgroundColor
appearance.shadowColor = configuration?.theme.toolbarBackgroundColor
navigationController.navigationBar.standardAppearance = appearance
navigationController.navigationBar.scrollEdgeAppearance = appearance
navigationController.navigationBar.compactAppearance = appearance
if #available(iOS 15.0, *) {
navigationController.navigationBar.compactScrollEdgeAppearance = appearance
}

UIApplication.shared.keyWindow?.rootViewController?.present(navigationController, animated: true, completion: nil)
Expand Down
62 changes: 50 additions & 12 deletions lib/imgly_sdk.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'dart:io';
import 'dart:ui' as dart_ui;

/// Configuration options and asset definitions for image and
Expand Down Expand Up @@ -1210,12 +1209,8 @@ final _serializationExportTypeValues = _EnumValues({
/// Video export configuration if the editor supports video editing.
class VideoOptions {
/// Creates new [VideoOptions].
VideoOptions({
this.bitRate,
this.codec,
this.format,
this.quality,
});
VideoOptions(
{this.bitRate, this.codec, this.format, this.quality, this.segments});
/// The bit rate in bits per second to use when exporting to VideoCodec.H264.
/// ```
Expand Down Expand Up @@ -1245,12 +1240,24 @@ class VideoOptions {
/// ```
final double? quality;
/// Whether the video editor should include the video segments of the
/// composition in the `VideoEditorResult`.
/// **Please note:** If enabled, you need to release the result via
/// `VideoEditorResult.release()` after processing the video segments
/// in order to prevent memory leaks.
/// ```
/// // Defaults to:
/// false
/// ```
final bool? segments;
/// Converts [VideoOptions] for JSON parsing.
Map<String, dynamic> _toJson() => {
"bitRate": bitRate,
"codec": codec == null ? null : _videoCodecValues.reverse[codec],
"format": format == null ? null : _videoFormatValues.reverse[format],
"quality": quality,
"segments": segments
}..removeWhere((key, value) => value == null);
}
Expand Down Expand Up @@ -2490,11 +2497,11 @@ class TextOptions {
/// overlay buttons on the canvas.
/// ```
/// // Defaults to:
/// [CanvasAction.add, CanvasAction.delete,
/// CanvasAction.bringToFront, CanvasAction.undo,
/// CanvasAction.redo]
/// [TextCanvasAction.add, TextCanvasAction.delete,
/// TextCanvasAction.bringToFront, TextCanvasAction.undo,
/// TextCanvasAction.redo]
/// ```
final List<StickerCanvasAction>? canvasActions;
final List<TextCanvasAction>? canvasActions;
/// Defines the default text color for newly created text.
/// ```
Expand Down Expand Up @@ -2594,7 +2601,7 @@ class TextOptions {
"canvasActions": _canvasActions == null
? null
: List<dynamic>.from(
_canvasActions.map((x) => _stickerCanvasActionValues.reverse[x])),
_canvasActions.map((x) => _textCanvasActionValues.reverse[x])),
"defaultTextColor": defaultTextColor?._toJson(),
"fonts": _fonts == null
? null
Expand Down Expand Up @@ -2633,6 +2640,37 @@ final _textActionValues = _EnumValues({
"duration": TextAction.duration
});
/// A text canvas action.
enum TextCanvasAction {
/// Add a new text.
add,
/// Bring the selected text to the front.
bringToFront,
/// Delete the selected text.
delete,
/// Flip the selected text.
flip,
/// Redo the action(s).
redo,
/// Undo the action(s).
undo
}
/// The corresponding values to the [TextCanvasAction].
final _textCanvasActionValues = _EnumValues({
"add": TextCanvasAction.add,
"bringtofront": TextCanvasAction.bringToFront,
"delete": TextCanvasAction.delete,
"flip": TextCanvasAction.flip,
"redo": TextCanvasAction.redo,
"undo": TextCanvasAction.undo
});
/// A font.
abstract class Font extends _NamedItem {
/// Retrieves an existing font with the given [identifier].
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: imgly_sdk
description: The official base plugin for the photo_editor_sdk and video_editor_sdk Flutter plugins.
version: 2.7.1
version: 2.8.0
homepage: https://img.ly
repository: https://github.com/imgly/imgly-flutter

Expand Down
3 changes: 0 additions & 3 deletions test/imgly_sdk_test.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';

void main() {}

0 comments on commit 69a8992

Please sign in to comment.