Skip to content

Commit

Permalink
Add version 3.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
leontobias committed Apr 27, 2023
1 parent 3d23e72 commit 83fd896
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 31 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
## [3.0.0]

### Changed

* Changed and aligned the error codes for the plugins.
* [imgly_sdk] Removed custom `Color` class and replaced its usage with the `dart:ui` `Color` class.
* [video_editor_sdk] Unlocking the license via `VESDK.unlockWithLicense` is now executing asynchronously.
* [photo_editor_sdk] Unlocking the license via `PESDK.unlockWithLicense` is now executing asynchronously.

### Fixed

* [video_editor_sdk] Fixed tint color of the toolbar would not be applied correctly in the trim tool on iOS.

## [2.9.0]

### Added
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Add the plugin package to the `pubspec.yaml` file in your project:

```yaml
dependencies:
video_editor_sdk: ^2.9.0
video_editor_sdk: ^3.0.0
```
Install the new dependency:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class FlutterVESDK: FlutterIMGLY() {

override fun onMethodCall(@NonNull call: MethodCall, @NonNull result: Result) {
if (this.result != null) {
result.error("Multiple requests.", "Cancelled due to multiple requests.", null)
result.error(IMGLYConstants.K_ERROR_MULTIPLE_REQUESTS, "Cancelled due to multiple requests.", null)
return
}

Expand Down Expand Up @@ -97,7 +97,7 @@ class FlutterVESDK: FlutterIMGLY() {
this.present(videoSegments, config, serialization, size)
}
} else {
result.error("VE.SDK", "The video must not be null", null)
result.error(IMGLYConstants.K_ERROR_UNABLE_TO_LOAD, "The video must not be null", null)
}
} else if (call.method == "unlock") {
val license = call.argument<String>("license")
Expand All @@ -106,7 +106,7 @@ class FlutterVESDK: FlutterIMGLY() {
} else if (call.method == "release") {
val identifier = call.argument<String>("identifier")
if (identifier == null) {
result.error("VE.SDK", "The identifier must not be null", null)
result.error(IMGLYConstants.K_ERROR_UNABLE_TO_RELEASE, "The identifier must not be null", null)
} else {
this.result = result
this.releaseTemporaryData(identifier)
Expand Down Expand Up @@ -170,7 +170,7 @@ class FlutterVESDK: FlutterIMGLY() {
if (videoArray.isNotEmpty()) {
if (source == null) {
if (size != null) {
result?.error("VE.SDK", "Invalid video size: width and height must be greater than zero.", null)
result?.error(IMGLYConstants.K_ERROR_UNABLE_TO_LOAD, "Invalid video size: width and height must be greater than zero.", null)
return
}
val video = videoArray.first()
Expand All @@ -184,7 +184,7 @@ class FlutterVESDK: FlutterIMGLY() {
}
} else {
if (source == null) {
result?.error("VE.SDK", "A video composition without assets must have a specific size.", null)
result?.error(IMGLYConstants.K_ERROR_UNABLE_TO_LOAD, "A video composition without assets must have a specific size.", null)
this.result = null
return
}
Expand Down Expand Up @@ -288,7 +288,7 @@ class FlutterVESDK: FlutterIMGLY() {
this.result?.success(null)
this.result = null
} catch (e: AuthorizationException) {
this.result?.error("VE.SDK", "The license is invalid.", e.message)
this.result?.error(IMGLYConstants.K_ERROR_UNABLE_TO_UNLOCK, "The license is invalid.", e.message)
this.result = null
}
}
Expand Down
10 changes: 5 additions & 5 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.9.0):
- imgly_sdk (3.0.0):
- Flutter
- imglyKit (~> 11.4)
- imglyKit (11.5.1)
- video_editor_sdk (2.9.0):
- video_editor_sdk (3.0.0):
- Flutter
- imgly_sdk (= 2.9.0)
- imgly_sdk (= 3.0.0)

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

SPEC CHECKSUMS:
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
imgly_sdk: a1937f3cd410756297d87d15086a37f24466d288
imgly_sdk: a114555e1d98e4a4fa5cc8f2b258353198c64e8b
imglyKit: b1b3b827799a50b090433ca7c61f90b078944898
video_editor_sdk: 2e3a8cbe6f1f09a8e12ba7cbac6f2bd7793bada5
video_editor_sdk: f113d4a2fc8838fdeee99a8461fb4c55ba6b9e3f

PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3

Expand Down
28 changes: 15 additions & 13 deletions ios/Classes/FlutterVESDK.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class FlutterVESDK: FlutterIMGLY, FlutterPlugin, VideoEditViewControllerD
guard let arguments = call.arguments as? IMGLYDictionary else { return }

if self.result != nil {
result(FlutterError(code: "Multiple requests.", message: "Cancelled due to multiple requests.", details: nil))
result(FlutterError(code: IMGLYConstants.kErrorMultipleRequests, message: "Cancelled due to multiple requests.", details: nil))
return
}

Expand Down Expand Up @@ -84,15 +84,15 @@ public class FlutterVESDK: FlutterIMGLY, FlutterPlugin, VideoEditViewControllerD
if valid == true {
video = Video(segments: assets)
} else {
result(FlutterError(code: "Invalid video size: width and height must be greater than zero.", message: nil, details: nil))
result(FlutterError(code: IMGLYConstants.kErrorUnableToLoad, message: "Invalid video size: width and height must be greater than zero.", details: nil))
return
}
}
} else {
if let videoSize = size {
video = Video(size: videoSize)
} else {
result(FlutterError(code: "A video composition without assets must have a specific size.", message: nil, details: nil))
result(FlutterError(code: IMGLYConstants.kErrorUnableToLoad, message: "A video composition without assets must have a specific size.", details: nil))
return
}
}
Expand All @@ -113,15 +113,15 @@ public class FlutterVESDK: FlutterIMGLY, FlutterPlugin, VideoEditViewControllerD
if valid == true {
video = Video(segments: resolvedSegments)
} else {
result(FlutterError(code: "Invalid video size: width and height must be greater than zero.", message: nil, details: nil))
result(FlutterError(code: IMGLYConstants.kErrorUnableToLoad, message: "Invalid video size: width and height must be greater than zero.", details: nil))
return
}
}
} else {
if let videoSize = size {
video = Video(size: videoSize)
} else {
result(FlutterError(code: "A video composition without assets must have a specific size.", message: nil, details: nil))
result(FlutterError(code: IMGLYConstants.kErrorUnableToLoad, message: "A video composition without assets must have a specific size.", details: nil))
return
}
}
Expand All @@ -134,13 +134,13 @@ public class FlutterVESDK: FlutterIMGLY, FlutterPlugin, VideoEditViewControllerD
video = Video(size: videoSize)
}
guard let finalVideo = video else {
result(FlutterError(code: "Could not load video.", message: nil, details: nil))
result(FlutterError(code: IMGLYConstants.kErrorUnableToLoad, message: "Could not load video.", details: nil))
return
}

self.present(video: finalVideo, configuration: configuration, serialization: serialization)
} else {
result(FlutterError(code: "The video must not be null.", message: nil, details: nil))
result(FlutterError(code: IMGLYConstants.kErrorUnableToLoad, message: "The video must not be null.", details: nil))
return
}
}
Expand Down Expand Up @@ -185,9 +185,11 @@ public class FlutterVESDK: FlutterIMGLY, FlutterPlugin, VideoEditViewControllerD
DispatchQueue.main.async {
do {
try VESDK.unlockWithLicense(from: url)
self.result?(nil)
self.result = nil
} catch let error {
self.handleLicenseError(with: error as NSError)
self.result?(FlutterError(code: IMGLYConstants.kErrorUnableToUnlock, message: "Unlocking the SDK failed due to:", details: error.localizedDescription))
self.result = nil
}
}
}
Expand Down Expand Up @@ -253,26 +255,26 @@ extension FlutterVESDK {

if self.serializationEnabled == true {
guard let serializationData = videoEditViewController.serializedSettings else {
self.handleError(videoEditViewController, code: "Serialization failed.", message: "No serialization data found.", details: nil)
self.handleError(videoEditViewController, code: IMGLYConstants.kErrorUnableToExport, message: "No serialization data found.", details: nil)
return
}
if self.serializationType == IMGLYConstants.kExportTypeFileURL {
guard let exportURL = self.serializationFile else {
self.handleError(videoEditViewController, code: "Serialization failed.", message: "The URL must not be nil.", details: nil)
self.handleError(videoEditViewController, code: IMGLYConstants.kErrorUnableToExport, 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.handleError(videoEditViewController, code: "Serialization failed.", message: error.localizedDescription, details: error.localizedDescription)
self.handleError(videoEditViewController, code: IMGLYConstants.kErrorUnableToExport, message: error.localizedDescription, details: error.localizedDescription)
return
}
} else if self.serializationType == IMGLYConstants.kExportTypeObject {
do {
serialization = try JSONSerialization.jsonObject(with: serializationData, options: .init(rawValue: 0))
} catch let error {
self.handleError(videoEditViewController, code: "Serialization failed.", message: error.localizedDescription, details: error.localizedDescription)
self.handleError(videoEditViewController, code: IMGLYConstants.kErrorUnableToExport, message: error.localizedDescription, details: error.localizedDescription)
return
}
}
Expand All @@ -294,7 +296,7 @@ extension FlutterVESDK {
/// - Parameter videoEditViewController: The `VideoEditViewController` that failed to export the video.
/// - Parameter error: The `VideoEditorError` that caused the failure.
public func videoEditViewControllerDidFail(_ videoEditViewController: VideoEditViewController, error: VideoEditorError) {
self.handleError(videoEditViewController, code: "Editor failed", message: "The editor did fail to generate the video.", details: error.localizedDescription)
self.handleError(videoEditViewController, code: IMGLYConstants.kErrorUnableToExport, message: "The editor did fail to generate the video.", details: error.localizedDescription)
}

/// Called if the `VideoEditViewController` was cancelled.
Expand Down
4 changes: 2 additions & 2 deletions lib/video_editor_sdk.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ class VESDK {
/// to include one license for each platform with the same name, but where
/// the iOS license has `.ios` as its file extension and the
/// Android license has `.android` as its file extension.
static void unlockWithLicense(String path) async {
await _channel.invokeMethod('unlock', <String, dynamic>{'license': path});
static Future<void> unlockWithLicense(String path) async {
return _channel.invokeMethod('unlock', <String, dynamic>{'license': path});
}

/// Opens a new video editor.
Expand Down
6 changes: 3 additions & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: video_editor_sdk
description: The official Flutter plugin for VideoEditor SDK. Integrate the video editor into your own iOS or Android app - in minutes!
version: 2.9.0
homepage: https://www.videoeditorsdk.com
version: 3.0.0
homepage: https://img.ly/products/video-sdk
repository: https://github.com/imgly/vesdk-flutter

environment:
Expand All @@ -11,7 +11,7 @@ environment:
dependencies:
flutter:
sdk: flutter
imgly_sdk: 2.9.0
imgly_sdk: 3.0.0

dev_dependencies:
flutter_test:
Expand Down
2 changes: 1 addition & 1 deletion test/video_editor_sdk_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';

void main() {
const MethodChannel channel = MethodChannel('video_editor_sdk');
const channel = MethodChannel('video_editor_sdk');

TestWidgetsFlutterBinding.ensureInitialized();

Expand Down

0 comments on commit 83fd896

Please sign in to comment.