@imgly/editor-react-native 1.63.0 → 1.64.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.
package/README.md CHANGED
@@ -8,7 +8,7 @@ Visit our [documentation](https://img.ly/docs/cesdk) for more tutorials on how t
8
8
 
9
9
  ## License
10
10
 
11
- The CreativeEditor SDK is a commercial product. To use it and get access you need to unlock the SDK with a license file. You can purchase a license at https://img.ly/pricing.
11
+ The CreativeEditor SDK is a commercial product. You can purchase a license at https://img.ly/pricing. Alternatively, you can use `null` as the license parameter to run the SDK in evaluation mode with a watermark.
12
12
 
13
13
  ## Getting Started
14
14
 
@@ -79,7 +79,7 @@ repositories {
79
79
  }
80
80
 
81
81
  dependencies {
82
- implementation findProject(":editor") ?: "ly.img:editor:1.63.0"
82
+ implementation findProject(":editor") ?: "ly.img:editor:1.64.0"
83
83
  implementation platform("androidx.compose:compose-bom:2023.05.01")
84
84
  implementation "androidx.activity:activity-compose:1.6.1"
85
85
  implementation "androidx.activity:activity:1.7.0"
@@ -131,7 +131,7 @@ class IMGLYEditorModule(
131
131
  metadata: Map<String, Any?>?,
132
132
  completion: (Result<EditorResult?>) -> Unit,
133
133
  ) {
134
- val activity = this.currentActivity ?: return
134
+ val activity = this.reactApplicationContext.currentActivity ?: return
135
135
  this.completion = completion
136
136
 
137
137
  val intent = Intent(activity, EditorActivity::class.java).apply {
@@ -21,8 +21,11 @@ import ly.img.editor.PostcardEditor
21
21
  import ly.img.editor.ShowLoading
22
22
  import ly.img.editor.ShowVideoExportProgressEvent
23
23
  import ly.img.editor.VideoEditor
24
- import ly.img.editor.core.engine.addSystemGalleryAssetSources
25
24
  import ly.img.editor.core.event.EditorEventHandler
25
+ import ly.img.editor.core.library.data.AssetSourceType
26
+ import ly.img.editor.core.library.data.SystemGalleryAssetSource
27
+ import ly.img.editor.core.library.data.SystemGalleryConfiguration
28
+ import ly.img.editor.core.library.data.SystemGalleryPermission
26
29
  import ly.img.editor.core.library.data.TextAssetSource
27
30
  import ly.img.editor.core.library.data.TypefaceProvider
28
31
  import ly.img.editor.reactnative.module.model.EditorPreset
@@ -345,7 +348,15 @@ object EditorBuilderDefaults {
345
348
  val isValid = isValidUri(Uri.parse(assetBaseUri))
346
349
  val baseUri = Uri.parse(if (isValid) assetBaseUri else "https://cdn.img.ly/assets/v4")
347
350
  engine.addDefaultAssetSources(baseUri = baseUri)
348
- engine.addSystemGalleryAssetSources()
351
+ SystemGalleryPermission.setMode(SystemGalleryConfiguration.Disabled)
352
+ val context = engine.applicationContext
353
+ listOf(
354
+ AssetSourceType.GalleryAllVisuals,
355
+ AssetSourceType.GalleryImage,
356
+ AssetSourceType.GalleryVideo,
357
+ ).forEach { type ->
358
+ engine.asset.addSource(SystemGalleryAssetSource(context, type))
359
+ }
349
360
  val excluded = setOf(DemoAssetSource.IMAGE, DemoAssetSource.VIDEO, DemoAssetSource.AUDIO)
350
361
  engine.addDemoAssetSources(
351
362
  sceneMode = engine.scene.getMode(),
@@ -5,14 +5,14 @@ import android.os.Parcelable
5
5
 
6
6
  /**
7
7
  * A class containing all necessary information to configure an editor.
8
- * @property license The license key.
8
+ * @property license The license key. Pass `null` to run the SDK in evaluation mode with a watermark.
9
9
  * @property baseUri The base uri for the assets included in the scene that have a relative source.
10
10
  * @property assetBaseUri The base uri of the default assets in the asset library.
11
11
  * @property userId The id of the current user.
12
12
  * @property source The source to load into the editor.
13
13
  */
14
14
  data class EditorSettings(
15
- val license: String,
15
+ val license: String? = null,
16
16
  val baseUri: String,
17
17
  val assetBaseUri: String?,
18
18
  val userId: String?,
@@ -23,7 +23,7 @@ data class EditorSettings(
23
23
  * @param parcel The [Parcel].
24
24
  */
25
25
  constructor(parcel: Parcel) : this(
26
- parcel.readString() ?: throw (Exception("Missing value for key 'license.'")),
26
+ parcel.readString(),
27
27
  parcel.readString() ?: throw (Exception("Missing value for key 'baseUri.'")),
28
28
  parcel.readString(),
29
29
  parcel.readString(),
@@ -49,7 +49,7 @@ data class EditorSettings(
49
49
  override fun newArray(size: Int): Array<EditorSettings?> = arrayOfNulls(size)
50
50
 
51
51
  fun createFromMap(map: Map<String, Any?>): EditorSettings? = try {
52
- val license = map["license"] as? String ?: throw (Exception("Missing value for key 'license.'"))
52
+ val license = map["license"] as? String
53
53
  val sceneBaseUri = map["sceneBaseUri"] as? String ?: throw (Exception("Missing value for key 'sceneBaseUri.'"))
54
54
  val assetBaseUri = map["assetBaseUri"] as? String
55
55
  val userId = map["userId"] as? String
@@ -1,7 +1,7 @@
1
1
  /// A struct containing all necessary settings to setup the editor.
2
2
  @objc @objcMembers public class EditorSettings: NSObject, Codable {
3
- /// The license key.
4
- public let license: String
3
+ /// The license key. Pass `nil` to run the SDK in evaluation mode with a watermark.
4
+ public let license: String?
5
5
 
6
6
  /// The base uri for the assets included in the scene that have a relative source.
7
7
  public let sceneBaseUri: String
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@imgly/editor-react-native",
3
- "version": "1.63.0",
3
+ "version": "1.64.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",
@@ -55,8 +55,8 @@ export interface EditorResult {
55
55
  * information needed by the editor to operate.
56
56
  */
57
57
  export interface EditorSettings {
58
- /** The license of the editor. */
59
- license: string;
58
+ /** The license of the editor. Pass `null` to run the SDK in evaluation mode with a watermark. */
59
+ license?: string;
60
60
 
61
61
  /**
62
62
  * The base URI to the assets included in
@@ -83,8 +83,8 @@ export interface EditorSettings {
83
83
  * information needed by the editor to operate.
84
84
  */
85
85
  export class EditorSettingsModel implements EditorSettings {
86
- /** The license of the editor. */
87
- license: string;
86
+ /** The license of the editor. Pass `null` to run the SDK in evaluation mode with a watermark. */
87
+ license?: string;
88
88
 
89
89
  /**
90
90
  * The base URI to the assets included in