@imgly/editor-react-native 1.77.0 → 1.80.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -143,7 +143,7 @@ repositories {
143
143
  }
144
144
 
145
145
  dependencies {
146
- api "ly.img:editor:1.77.0"
146
+ api "ly.img:editor:1.80.0-rc.0"
147
147
 
148
148
  implementation "androidx.activity:activity-ktx:1.9.0"
149
149
  implementation "androidx.appcompat:appcompat:1.7.1"
@@ -102,6 +102,7 @@ suspend fun PhotoConfigurationBuilder.onLoadAssetSources() {
102
102
  "ly.img.text.styles",
103
103
  "ly.img.text.curves",
104
104
  "ly.img.text.components",
105
+ "ly.img.image",
105
106
  )
106
107
  sourceIds.forEach { id ->
107
108
  launch {
@@ -3,7 +3,9 @@ package ly.img.editor.configuration.video.callback
3
3
  import kotlinx.coroutines.CancellationException
4
4
  import ly.img.editor.configuration.video.VideoConfigurationBuilder
5
5
  import ly.img.editor.configuration.video.model.ExportStatus
6
+ import ly.img.engine.ExportVideoOptions
6
7
  import ly.img.engine.MimeType
8
+ import ly.img.engine.VideoBitrate
7
9
  import java.nio.ByteBuffer
8
10
 
9
11
  /**
@@ -63,6 +65,8 @@ suspend fun VideoConfigurationBuilder.onExportByteBuffer(): ByteBuffer {
63
65
  exportStatus = ExportStatus.Loading(progress = newProgress)
64
66
  }
65
67
  },
68
+ // videoBitrate: VideoBitrate.Auto derives a bounded bitrate from the resolution/framerate.
69
+ options = ExportVideoOptions(videoBitrate = VideoBitrate.Auto),
66
70
  )
67
71
  }
68
72
  // highlight-starter-kit-on-export-byte-buffer
@@ -435,7 +435,7 @@ object EditorBuilderDefaults {
435
435
  }
436
436
 
437
437
  private suspend fun saveScene(scene: String): Uri = withContext(Dispatchers.IO) {
438
- val file = File.createTempFile("cesdk_export_scene_" + UUID.randomUUID().toString(), ".scene")
438
+ val file = File.createTempFile("cesdk_export_scene_" + UUID.randomUUID().toString(), ".imgly")
439
439
  file.writeText(scene)
440
440
  Uri.fromFile(file)
441
441
  }
@@ -7,7 +7,7 @@ import android.os.Parcelable
7
7
  enum class EditorSourceType(
8
8
  val value: String,
9
9
  ) : Parcelable {
10
- /** A `.scene` file. */
10
+ /** A scene file (`.imgly` or the legacy `.scene`). */
11
11
  SCENE("scene"),
12
12
 
13
13
  /** An image file, e.g. `.png`. */
@@ -3,5 +3,7 @@ import Foundation
3
3
  /// An extension to allow throwing strings.
4
4
  extension String: LocalizedError {
5
5
  /// The error description.
6
- public var errorDescription: String? { self }
6
+ public var errorDescription: String? {
7
+ self
8
+ }
7
9
  }
@@ -22,7 +22,9 @@ class ExportHelper {
22
22
  /// - Returns: The file `URL`.
23
23
  func saveScene(_ scene: String) throws -> URL? {
24
24
  let fileName = "cesdk_export_scene_" + UUID().uuidString
25
- let url = FileManager.default.temporaryDirectory.appendingPathComponent(fileName, conformingTo: .plainText)
25
+ let url = FileManager.default.temporaryDirectory
26
+ .appendingPathComponent(fileName)
27
+ .appendingPathExtension("imgly")
26
28
  if let data = scene.data(using: .utf8) {
27
29
  try data.write(to: url, options: [.atomic])
28
30
  return url
@@ -19,7 +19,7 @@ public enum EditorBuilder {
19
19
  _ settings: EditorSettings,
20
20
  _ preset: EditorPreset?,
21
21
  _ metadata: [String: Any]?,
22
- _ result: @escaping EditorBuilderResult
22
+ _ result: @escaping EditorBuilderResult,
23
23
  ) -> UIViewController
24
24
 
25
25
  /// The default design editor.
@@ -99,7 +99,9 @@ public enum EditorBuilder {
99
99
  let editorResult = try await OnExport.exportVideo(engine, eventHandler, .mp4)
100
100
  result(.success(editorResult))
101
101
  } catch {
102
- if error is CancellationError { return }
102
+ if error is CancellationError {
103
+ return
104
+ }
103
105
  result(.failure(error))
104
106
  }
105
107
  }
@@ -175,11 +177,10 @@ public enum EditorBuilder {
175
177
  _ settings: EditorSettings,
176
178
  _ preset: EditorPreset?,
177
179
  _ metadata: [String: Any]?,
178
- _ result: @escaping EditorBuilderResult
180
+ _ result: @escaping EditorBuilderResult,
179
181
  ) -> some View) -> Builder {
180
182
  { settings, preset, metadata, result in
181
- let hostingController = UIHostingController(rootView: contentProvider(settings, preset, metadata, result))
182
- return hostingController
183
+ UIHostingController(rootView: contentProvider(settings, preset, metadata, result))
183
184
  }
184
185
  }
185
186
  }
@@ -194,10 +195,11 @@ extension EditorBuilder {
194
195
  // Identify this engine as React-Native-hosted so v4 licenses scoped to
195
196
  // `host: react-native` validate. Hardcoded (not customer-configurable).
196
197
  let host = "react-native"
197
- if let url = URL(string: settings.baseUri) {
198
- return EngineSettings(license: settings.license, userID: settings.userId, baseURL: url, host: host)
199
- } else {
200
- return EngineSettings(license: settings.license, userID: settings.userId, host: host)
201
- }
198
+ return EngineSettings(
199
+ license: settings.license,
200
+ userID: settings.userId,
201
+ baseURL: URL(string: settings.baseUri),
202
+ host: host,
203
+ )
202
204
  }
203
205
  }
@@ -22,8 +22,7 @@
22
22
  public static func fromDictionary(_ dictionary: [String: Any]) -> EditorSettings? {
23
23
  do {
24
24
  let data = try JSONSerialization.data(withJSONObject: dictionary, options: [])
25
- let settings = try JSONDecoder().decode(EditorSettings.self, from: data)
26
- return settings
25
+ return try JSONDecoder().decode(EditorSettings.self, from: data)
27
26
  } catch {
28
27
  print("Error decoding dictionary: \(error)")
29
28
  return nil
@@ -15,32 +15,48 @@ public final class ApparelEditorConfiguration: EditorConfiguration {
15
15
  // MARK: - EditorConfiguration — Settings
16
16
 
17
17
  /// The zoom padding for the canvas.
18
- override public var zoomPadding: CGFloat? { 16 }
18
+ override public var zoomPadding: CGFloat? {
19
+ 16
20
+ }
19
21
 
20
22
  // MARK: - EditorConfiguration — Callbacks
21
23
 
22
24
  /// The `onCreate` handler.
23
- override public var onCreate: OnCreate.Handler? { Self.defaultOnCreateHandler }
25
+ override public var onCreate: OnCreate.Handler? {
26
+ Self.defaultOnCreateHandler
27
+ }
24
28
 
25
29
  /// The `onChanged` handler.
26
- override public var onChanged: OnChanged.Handler? { Self.defaultOnChangedHandler }
30
+ override public var onChanged: OnChanged.Handler? {
31
+ Self.defaultOnChangedHandler
32
+ }
27
33
 
28
34
  /// The export handler.
29
35
  ///
30
36
  /// Default: Exports the scene as PDF and opens the system share sheet.
31
- override public var onExport: OnExport.Handler? { Self.defaultOnExportHandler }
37
+ override public var onExport: OnExport.Handler? {
38
+ Self.defaultOnExportHandler
39
+ }
32
40
 
33
41
  // MARK: - EditorConfiguration — UI Components
34
42
 
35
43
  /// The navigation bar configuration.
36
- override public var navigationBar: NavigationBar.Configuration? { Self.defaultNavigationBar }
44
+ override public var navigationBar: NavigationBar.Configuration? {
45
+ Self.defaultNavigationBar
46
+ }
37
47
 
38
48
  /// The dock configuration.
39
- override public var dock: Dock.Configuration? { Self.defaultDock }
49
+ override public var dock: Dock.Configuration? {
50
+ Self.defaultDock
51
+ }
40
52
 
41
53
  /// The inspector bar configuration.
42
- override public var inspectorBar: InspectorBar.Configuration? { Self.defaultInspectorBar }
54
+ override public var inspectorBar: InspectorBar.Configuration? {
55
+ Self.defaultInspectorBar
56
+ }
43
57
 
44
58
  /// The canvas menu configuration.
45
- override public var canvasMenu: CanvasMenu.Configuration? { Self.defaultCanvasMenu }
59
+ override public var canvasMenu: CanvasMenu.Configuration? {
60
+ Self.defaultCanvasMenu
61
+ }
46
62
  }
@@ -15,29 +15,43 @@ public final class DesignEditorConfiguration: EditorConfiguration {
15
15
  // MARK: - EditorConfiguration — Settings
16
16
 
17
17
  /// The zoom padding for the canvas.
18
- override public var zoomPadding: CGFloat? { 16 }
18
+ override public var zoomPadding: CGFloat? {
19
+ 16
20
+ }
19
21
 
20
22
  // MARK: - EditorConfiguration — Callbacks
21
23
 
22
24
  /// The `onCreate` handler.
23
- override public var onCreate: OnCreate.Handler? { Self.defaultOnCreateHandler }
25
+ override public var onCreate: OnCreate.Handler? {
26
+ Self.defaultOnCreateHandler
27
+ }
24
28
 
25
29
  /// The export handler.
26
30
  ///
27
31
  /// Default: Exports the scene as PDF and opens the system share sheet.
28
- override public var onExport: OnExport.Handler? { Self.defaultOnExportHandler }
32
+ override public var onExport: OnExport.Handler? {
33
+ Self.defaultOnExportHandler
34
+ }
29
35
 
30
36
  // MARK: - EditorConfiguration — UI Components
31
37
 
32
38
  /// The navigation bar configuration.
33
- override public var navigationBar: NavigationBar.Configuration? { Self.defaultNavigationBar }
39
+ override public var navigationBar: NavigationBar.Configuration? {
40
+ Self.defaultNavigationBar
41
+ }
34
42
 
35
43
  /// The dock configuration.
36
- override public var dock: Dock.Configuration? { Self.defaultDock }
44
+ override public var dock: Dock.Configuration? {
45
+ Self.defaultDock
46
+ }
37
47
 
38
48
  /// The inspector bar configuration.
39
- override public var inspectorBar: InspectorBar.Configuration? { Self.defaultInspectorBar }
49
+ override public var inspectorBar: InspectorBar.Configuration? {
50
+ Self.defaultInspectorBar
51
+ }
40
52
 
41
53
  /// The canvas menu configuration.
42
- override public var canvasMenu: CanvasMenu.Configuration? { Self.defaultCanvasMenu }
54
+ override public var canvasMenu: CanvasMenu.Configuration? {
55
+ Self.defaultCanvasMenu
56
+ }
43
57
  }
@@ -14,35 +14,53 @@ public final class PhotoEditorConfiguration: EditorConfiguration {
14
14
  // MARK: - EditorConfiguration — Settings
15
15
 
16
16
  /// The zoom padding for the canvas.
17
- override public var zoomPadding: CGFloat? { 0 }
17
+ override public var zoomPadding: CGFloat? {
18
+ 0
19
+ }
18
20
 
19
21
  // MARK: - EditorConfiguration — Callbacks
20
22
 
21
23
  /// The `onCreate` handler.
22
- override public var onCreate: OnCreate.Handler? { Self.defaultOnCreateHandler }
24
+ override public var onCreate: OnCreate.Handler? {
25
+ Self.defaultOnCreateHandler
26
+ }
23
27
 
24
28
  /// The `onLoaded` handler.
25
- override public var onLoaded: OnLoaded.Handler? { Self.defaultOnLoadedHandler }
29
+ override public var onLoaded: OnLoaded.Handler? {
30
+ Self.defaultOnLoadedHandler
31
+ }
26
32
 
27
33
  /// The `onChanged` handler.
28
- override public var onChanged: OnChanged.Handler? { Self.defaultOnChangedHandler }
34
+ override public var onChanged: OnChanged.Handler? {
35
+ Self.defaultOnChangedHandler
36
+ }
29
37
 
30
38
  /// The export handler.
31
39
  ///
32
40
  /// Default: Exports the scene as PNG and opens the system share sheet.
33
- override public var onExport: OnExport.Handler? { Self.defaultOnExportHandler }
41
+ override public var onExport: OnExport.Handler? {
42
+ Self.defaultOnExportHandler
43
+ }
34
44
 
35
45
  // MARK: - EditorConfiguration — UI Components
36
46
 
37
47
  /// The navigation bar configuration.
38
- override public var navigationBar: NavigationBar.Configuration? { Self.defaultNavigationBar }
48
+ override public var navigationBar: NavigationBar.Configuration? {
49
+ Self.defaultNavigationBar
50
+ }
39
51
 
40
52
  /// The dock configuration.
41
- override public var dock: Dock.Configuration? { Self.defaultDock }
53
+ override public var dock: Dock.Configuration? {
54
+ Self.defaultDock
55
+ }
42
56
 
43
57
  /// The inspector bar configuration.
44
- override public var inspectorBar: InspectorBar.Configuration? { Self.defaultInspectorBar }
58
+ override public var inspectorBar: InspectorBar.Configuration? {
59
+ Self.defaultInspectorBar
60
+ }
45
61
 
46
62
  /// The canvas menu configuration.
47
- override public var canvasMenu: CanvasMenu.Configuration? { Self.defaultCanvasMenu }
63
+ override public var canvasMenu: CanvasMenu.Configuration? {
64
+ Self.defaultCanvasMenu
65
+ }
48
66
  }
@@ -84,6 +84,7 @@ public extension PhotoEditorConfiguration {
84
84
  "ly.img.sticker", "ly.img.vector.shape", "ly.img.filter", "ly.img.color.palette",
85
85
  "ly.img.effect", "ly.img.blur", "ly.img.typeface", "ly.img.crop.presets",
86
86
  "ly.img.page.presets", "ly.img.text", "ly.img.text.styles", "ly.img.text.curves", "ly.img.text.components",
87
+ "ly.img.image",
87
88
  ]
88
89
  try await withThrowingTaskGroup(of: String.self) { group in
89
90
  for id in defaultSourceIDs {
@@ -14,32 +14,48 @@ public final class PostcardEditorConfiguration: EditorConfiguration {
14
14
  // MARK: - EditorConfiguration — Settings
15
15
 
16
16
  /// The zoom padding for the canvas.
17
- override public var zoomPadding: CGFloat? { 16 }
17
+ override public var zoomPadding: CGFloat? {
18
+ 16
19
+ }
18
20
 
19
21
  // MARK: - EditorConfiguration — Callbacks
20
22
 
21
23
  /// The `onCreate` handler.
22
- override public var onCreate: OnCreate.Handler? { Self.defaultOnCreateHandler }
24
+ override public var onCreate: OnCreate.Handler? {
25
+ Self.defaultOnCreateHandler
26
+ }
23
27
 
24
28
  /// The `onChanged` handler.
25
- override public var onChanged: OnChanged.Handler? { Self.defaultOnChangedHandler }
29
+ override public var onChanged: OnChanged.Handler? {
30
+ Self.defaultOnChangedHandler
31
+ }
26
32
 
27
33
  /// The export handler.
28
34
  ///
29
35
  /// Default: Exports the scene as PDF and opens the system share sheet.
30
- override public var onExport: OnExport.Handler? { Self.defaultOnExportHandler }
36
+ override public var onExport: OnExport.Handler? {
37
+ Self.defaultOnExportHandler
38
+ }
31
39
 
32
40
  // MARK: - EditorConfiguration — UI Components
33
41
 
34
42
  /// The navigation bar configuration.
35
- override public var navigationBar: NavigationBar.Configuration? { Self.defaultNavigationBar }
43
+ override public var navigationBar: NavigationBar.Configuration? {
44
+ Self.defaultNavigationBar
45
+ }
36
46
 
37
47
  /// The dock configuration.
38
- override public var dock: Dock.Configuration? { Self.defaultDock }
48
+ override public var dock: Dock.Configuration? {
49
+ Self.defaultDock
50
+ }
39
51
 
40
52
  /// The inspector bar configuration.
41
- override public var inspectorBar: InspectorBar.Configuration? { Self.defaultInspectorBar }
53
+ override public var inspectorBar: InspectorBar.Configuration? {
54
+ Self.defaultInspectorBar
55
+ }
42
56
 
43
57
  /// The canvas menu configuration.
44
- override public var canvasMenu: CanvasMenu.Configuration? { Self.defaultCanvasMenu }
58
+ override public var canvasMenu: CanvasMenu.Configuration? {
59
+ Self.defaultCanvasMenu
60
+ }
45
61
  }
@@ -6,13 +6,24 @@ import SwiftUI
6
6
 
7
7
  extension Dock.Buttons.ID {
8
8
  /// The id of the ``Dock/Buttons/designColors(action:title:icon:isEnabled:isVisible:)`` button.
9
- static var designColors: EditorComponentID { "ly.img.component.dock.button.postcard.designColors" }
9
+ static var designColors: EditorComponentID {
10
+ "ly.img.component.dock.button.postcard.designColors"
11
+ }
12
+
10
13
  /// The id of the ``Dock/Buttons/greetingColors(action:title:icon:isEnabled:isVisible:)`` button.
11
- static var greetingColors: EditorComponentID { "ly.img.component.dock.button.postcard.namedColors" }
14
+ static var greetingColors: EditorComponentID {
15
+ "ly.img.component.dock.button.postcard.namedColors"
16
+ }
17
+
12
18
  /// The id of the ``Dock/Buttons/greetingFont(action:title:icon:isEnabled:isVisible:)`` button.
13
- static var greetingFont: EditorComponentID { "ly.img.component.dock.button.postcard.greetingFont" }
19
+ static var greetingFont: EditorComponentID {
20
+ "ly.img.component.dock.button.postcard.greetingFont"
21
+ }
22
+
14
23
  /// The id of the ``Dock/Buttons/greetingSize(action:title:icon:isEnabled:isVisible:)`` button.
15
- static var greetingSize: EditorComponentID { "ly.img.component.dock.button.postcard.greetingSize" }
24
+ static var greetingSize: EditorComponentID {
25
+ "ly.img.component.dock.button.postcard.greetingSize"
26
+ }
16
27
  }
17
28
 
18
29
  // MARK: - Dock Buttons
@@ -14,7 +14,9 @@ public final class VideoEditorConfiguration: EditorConfiguration {
14
14
  // MARK: - EditorConfiguration — Settings
15
15
 
16
16
  /// The zoom padding for the canvas.
17
- override public var zoomPadding: CGFloat? { 1 }
17
+ override public var zoomPadding: CGFloat? {
18
+ 1
19
+ }
18
20
 
19
21
  /// The asset library configuration.
20
22
  ///
@@ -28,27 +30,41 @@ public final class VideoEditorConfiguration: EditorConfiguration {
28
30
  // MARK: - EditorConfiguration — Callbacks
29
31
 
30
32
  /// The `onCreate` handler.
31
- override public var onCreate: OnCreate.Handler? { Self.defaultOnCreateHandler }
33
+ override public var onCreate: OnCreate.Handler? {
34
+ Self.defaultOnCreateHandler
35
+ }
32
36
 
33
37
  /// The export handler.
34
38
  ///
35
39
  /// Default: Exports the current page as MP4 and opens the system share sheet.
36
- override public var onExport: OnExport.Handler? { Self.defaultOnExportHandler }
40
+ override public var onExport: OnExport.Handler? {
41
+ Self.defaultOnExportHandler
42
+ }
37
43
 
38
44
  // MARK: - EditorConfiguration — UI Components
39
45
 
40
46
  /// The navigation bar configuration.
41
- override public var navigationBar: NavigationBar.Configuration? { Self.defaultNavigationBar }
47
+ override public var navigationBar: NavigationBar.Configuration? {
48
+ Self.defaultNavigationBar
49
+ }
42
50
 
43
51
  /// The dock configuration.
44
- override public var dock: Dock.Configuration? { Self.defaultDock }
52
+ override public var dock: Dock.Configuration? {
53
+ Self.defaultDock
54
+ }
45
55
 
46
56
  /// The inspector bar configuration.
47
- override public var inspectorBar: InspectorBar.Configuration? { Self.defaultInspectorBar }
57
+ override public var inspectorBar: InspectorBar.Configuration? {
58
+ Self.defaultInspectorBar
59
+ }
48
60
 
49
61
  /// The canvas menu configuration.
50
- override public var canvasMenu: CanvasMenu.Configuration? { Self.defaultCanvasMenu }
62
+ override public var canvasMenu: CanvasMenu.Configuration? {
63
+ Self.defaultCanvasMenu
64
+ }
51
65
 
52
66
  /// The bottom panel configuration.
53
- override public var bottomPanel: BottomPanel.Configuration? { Self.defaultBottomPanel }
67
+ override public var bottomPanel: BottomPanel.Configuration? {
68
+ Self.defaultBottomPanel
69
+ }
54
70
  }
@@ -16,7 +16,12 @@ extension VideoEditorConfiguration {
16
16
  }
17
17
  eventHandler.send(.exportProgress(.relative(0)))
18
18
  let mimeType: MIMEType = .mp4
19
- let stream = try await engine.block.exportVideo(page, mimeType: mimeType) { _ in }
19
+ // videoBitrate: .auto derives a bounded bitrate from the resolution/framerate.
20
+ let stream = try await engine.block.exportVideo(
21
+ page,
22
+ mimeType: mimeType,
23
+ options: VideoExportOptions(videoBitrate: .auto),
24
+ ) { _ in }
20
25
 
21
26
  var lastReportedProgress = 0
22
27
  for try await export in stream {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@imgly/editor-react-native",
3
- "version": "1.77.0",
3
+ "version": "1.80.0-rc.0",
4
4
  "description": "CreativeEditor SDK for React Native - enable photo, video and design editing for your users on iOS and Android.",
5
5
  "react-native": "index.js",
6
6
  "source": "index.js",
@@ -96,7 +96,7 @@ export class EditorSettingsModel implements EditorSettings {
96
96
  * sources (stickers, filters, and more).
97
97
  */
98
98
  baseUri: string =
99
- 'https://cdn.img.ly/packages/imgly/cesdk-react-native/1.77.0/assets';
99
+ 'https://cdn.img.ly/packages/imgly/cesdk-react-native/1.80.0-rc.0/assets';
100
100
 
101
101
  /**
102
102
  * Unique ID tied to your application's user.
@@ -115,7 +115,7 @@ export class EditorSettingsModel implements EditorSettings {
115
115
  * loaded into the editor.
116
116
  */
117
117
  export enum SourceType {
118
- /** A `.scene` file. */
118
+ /** A scene file (`.imgly` or the legacy `.scene`). */
119
119
  SCENE = 'scene',
120
120
 
121
121
  /** An image, e.g. `.png`. */