@imgly/editor-react-native 1.69.0 → 1.71.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/android/build.gradle +1 -1
- package/android/src/main/kotlin/ly/img/editor/reactnative/module/builder/EditorBuilder.kt +9 -10
- package/android/src/main/kotlin/ly/img/editor/reactnative/module/model/EditorSettings.kt +4 -8
- package/ios/Extensions/OnCreate+.swift +6 -5
- package/ios/IMGLYEditorModule.mm +1 -4
- package/ios/Model/EditorBuilder.swift +1 -1
- package/ios/Model/EditorSettings.swift +4 -5
- package/package.json +1 -1
- package/src/NativeIMGLYEditor.ts +16 -15
package/android/build.gradle
CHANGED
|
@@ -142,7 +142,7 @@ repositories {
|
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
dependencies {
|
|
145
|
-
implementation findProject(":editor") ?: "ly.img:editor:1.
|
|
145
|
+
implementation findProject(":editor") ?: "ly.img:editor:1.71.0"
|
|
146
146
|
implementation platform("androidx.compose:compose-bom:2023.05.01")
|
|
147
147
|
implementation "androidx.activity:activity-compose:1.6.1"
|
|
148
148
|
implementation "androidx.activity:activity:1.7.0"
|
|
@@ -343,9 +343,7 @@ object EditorBuilderDefaults {
|
|
|
343
343
|
}
|
|
344
344
|
|
|
345
345
|
launch {
|
|
346
|
-
val
|
|
347
|
-
val isValid = isValidUri(Uri.parse(assetBaseUri))
|
|
348
|
-
val baseUri = Uri.parse(if (isValid) assetBaseUri else "https://cdn.img.ly/assets/v4")
|
|
346
|
+
val baseUri = Uri.parse(settings.baseUri)
|
|
349
347
|
engine.addDefaultAssetSources(baseUri = baseUri)
|
|
350
348
|
SystemGalleryPermission.setMode(SystemGalleryConfiguration.Disabled)
|
|
351
349
|
val context = engine.applicationContext
|
|
@@ -359,7 +357,7 @@ object EditorBuilderDefaults {
|
|
|
359
357
|
engine.addDemoAssetSources(
|
|
360
358
|
sceneMode = engine.scene.getMode(),
|
|
361
359
|
withUploadAssetSources = true,
|
|
362
|
-
baseUri =
|
|
360
|
+
baseUri = baseUri,
|
|
363
361
|
)
|
|
364
362
|
val defaultTypeface = TypefaceProvider().provideTypeface(engine, "Roboto")
|
|
365
363
|
requireNotNull(defaultTypeface)
|
|
@@ -388,12 +386,13 @@ object EditorBuilderDefaults {
|
|
|
388
386
|
val blob = engine.block.export(
|
|
389
387
|
block = requireNotNull(engine.scene.get()),
|
|
390
388
|
mimeType = mimeType,
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
389
|
+
onPreExport = {
|
|
390
|
+
scene.getPages().forEach { page ->
|
|
391
|
+
block.setScopeEnabled(page, key = "layer/visibility", enabled = true)
|
|
392
|
+
block.setVisible(page, visible = true)
|
|
393
|
+
}
|
|
394
|
+
},
|
|
395
|
+
)
|
|
397
396
|
val tempFile = EditorDefaults.writeToTempFile(blob, mimeType)
|
|
398
397
|
val scene = engine.scene.get()
|
|
399
398
|
val sceneString = scene?.let {
|
|
@@ -6,15 +6,14 @@ import android.os.Parcelable
|
|
|
6
6
|
/**
|
|
7
7
|
* A class containing all necessary information to configure an editor.
|
|
8
8
|
* @property license The license key. Pass `null` to run the SDK in evaluation mode with a watermark.
|
|
9
|
-
* @property baseUri The base
|
|
10
|
-
*
|
|
9
|
+
* @property baseUri The base URI used by the engine for built-in assets like emoji and fallback
|
|
10
|
+
* fonts, and by the editor for its default and demo asset sources (stickers, filters, and more).
|
|
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
15
|
val license: String? = null,
|
|
16
16
|
val baseUri: String,
|
|
17
|
-
val assetBaseUri: String?,
|
|
18
17
|
val userId: String?,
|
|
19
18
|
var source: Source?,
|
|
20
19
|
) : Parcelable {
|
|
@@ -26,7 +25,6 @@ data class EditorSettings(
|
|
|
26
25
|
parcel.readString(),
|
|
27
26
|
parcel.readString() ?: throw (Exception("Missing value for key 'baseUri.'")),
|
|
28
27
|
parcel.readString(),
|
|
29
|
-
parcel.readString(),
|
|
30
28
|
parcel.readParcelable(Source::class.java.classLoader),
|
|
31
29
|
)
|
|
32
30
|
|
|
@@ -36,7 +34,6 @@ data class EditorSettings(
|
|
|
36
34
|
) {
|
|
37
35
|
parcel.writeString(license)
|
|
38
36
|
parcel.writeString(baseUri)
|
|
39
|
-
parcel.writeString(assetBaseUri)
|
|
40
37
|
parcel.writeString(userId)
|
|
41
38
|
parcel.writeParcelable(source, flags)
|
|
42
39
|
}
|
|
@@ -50,11 +47,10 @@ data class EditorSettings(
|
|
|
50
47
|
|
|
51
48
|
fun createFromMap(map: Map<String, Any?>): EditorSettings? = try {
|
|
52
49
|
val license = map["license"] as? String
|
|
53
|
-
val
|
|
54
|
-
val assetBaseUri = map["assetBaseUri"] as? String
|
|
50
|
+
val baseUri = map["baseUri"] as? String ?: throw (Exception("Missing value for key 'baseUri.'"))
|
|
55
51
|
val userId = map["userId"] as? String
|
|
56
52
|
val source = (map["source"] as? Map<String, Any?>)?.let { Source.createFromMap(it) }
|
|
57
|
-
EditorSettings(license,
|
|
53
|
+
EditorSettings(license, baseUri, userId, source)
|
|
58
54
|
} catch (e: Exception) {
|
|
59
55
|
null
|
|
60
56
|
}
|
|
@@ -42,13 +42,13 @@ extension OnCreate {
|
|
|
42
42
|
try await OnCreate.default(engine)
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
var
|
|
46
|
-
if let
|
|
47
|
-
if let temp = URL(string:
|
|
48
|
-
|
|
45
|
+
var baseURL: URL?
|
|
46
|
+
if let baseUri = settings?.baseUri {
|
|
47
|
+
if let temp = URL(string: baseUri), temp.scheme != nil {
|
|
48
|
+
baseURL = temp
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
try await Self.loadDefaultAssets(baseURL:
|
|
51
|
+
try await Self.loadDefaultAssets(baseURL: baseURL)(engine)
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
|
|
@@ -60,6 +60,7 @@ extension OnCreate {
|
|
|
60
60
|
let baseURI = baseURL ?? Engine.assetBaseURL
|
|
61
61
|
try await engine.addDefaultAssetSources(baseURL: baseURI)
|
|
62
62
|
try await engine.addDemoAssetSources(
|
|
63
|
+
baseURL: baseURI,
|
|
63
64
|
sceneMode: engine.scene.getMode(),
|
|
64
65
|
withUploadAssetSources: true,
|
|
65
66
|
)
|
package/ios/IMGLYEditorModule.mm
CHANGED
|
@@ -14,14 +14,11 @@ RCT_EXPORT_MODULE(IMGLYEditor)
|
|
|
14
14
|
resolve:(RCTPromiseResolveBlock)resolve
|
|
15
15
|
reject:(RCTPromiseRejectBlock)reject {
|
|
16
16
|
NSMutableDictionary* mergedSettings = [@{
|
|
17
|
-
@"
|
|
17
|
+
@"baseUri" : settings.baseUri(),
|
|
18
18
|
} mutableCopy];
|
|
19
19
|
if (settings.license() != nil) {
|
|
20
20
|
mergedSettings[@"license"] = settings.license();
|
|
21
21
|
}
|
|
22
|
-
if (settings.assetBaseUri() != nil) {
|
|
23
|
-
mergedSettings[@"assetBaseUri"] = settings.assetBaseUri();
|
|
24
|
-
}
|
|
25
22
|
if (settings.userId() != nil) {
|
|
26
23
|
mergedSettings[@"userId"] = settings.userId();
|
|
27
24
|
}
|
|
@@ -103,7 +103,7 @@ extension EditorBuilder {
|
|
|
103
103
|
/// - Parameter settings: The `EditorSettings`.
|
|
104
104
|
/// - Returns: The derived `EngineSettings`.
|
|
105
105
|
private static func engineSettings(for settings: EditorSettings) -> EngineSettings {
|
|
106
|
-
if let url = URL(string: settings.
|
|
106
|
+
if let url = URL(string: settings.baseUri) {
|
|
107
107
|
EngineSettings(license: settings.license, userID: settings.userId, baseURL: url)
|
|
108
108
|
} else {
|
|
109
109
|
EngineSettings(license: settings.license, userID: settings.userId)
|
|
@@ -3,11 +3,10 @@
|
|
|
3
3
|
/// The license key. Pass `nil` to run the SDK in evaluation mode with a watermark.
|
|
4
4
|
public let license: String?
|
|
5
5
|
|
|
6
|
-
/// The base
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
public let assetBaseUri: String?
|
|
6
|
+
/// The base URI used by the engine for built-in assets like emoji and fallback
|
|
7
|
+
/// fonts, and by the editor for its default and demo asset sources (stickers,
|
|
8
|
+
/// filters, and more).
|
|
9
|
+
public let baseUri: String
|
|
11
10
|
|
|
12
11
|
/// The id of the current user.
|
|
13
12
|
public let userId: String?
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@imgly/editor-react-native",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.71.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",
|
package/src/NativeIMGLYEditor.ts
CHANGED
|
@@ -59,14 +59,18 @@ export interface EditorSettings {
|
|
|
59
59
|
license?: string;
|
|
60
60
|
|
|
61
61
|
/**
|
|
62
|
-
* The base URI
|
|
63
|
-
*
|
|
64
|
-
*
|
|
62
|
+
* The base URI used by the engine for built-in assets like emoji and
|
|
63
|
+
* fallback fonts, and by the editor for its default and demo asset
|
|
64
|
+
* sources (stickers, filters, and more).
|
|
65
|
+
*
|
|
66
|
+
* By default, assets are loaded from the IMG.LY CDN at
|
|
67
|
+
* `https://cdn.img.ly/packages/imgly/cesdk-react-native/<version>/assets`.
|
|
68
|
+
* For production use, we recommend downloading the assets from
|
|
69
|
+
* `https://cdn.img.ly/packages/imgly/cesdk-react-native/<version>/imgly-assets.zip`,
|
|
70
|
+
* hosting them on your own server, and setting `baseUri` to your
|
|
71
|
+
* hosted location.
|
|
65
72
|
*/
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
/** The base URI to the default assets of the asset library. */
|
|
69
|
-
assetBaseUri?: string;
|
|
73
|
+
baseUri: string;
|
|
70
74
|
|
|
71
75
|
/**
|
|
72
76
|
* Unique ID tied to your application's user.
|
|
@@ -87,15 +91,12 @@ export class EditorSettingsModel implements EditorSettings {
|
|
|
87
91
|
license?: string;
|
|
88
92
|
|
|
89
93
|
/**
|
|
90
|
-
* The base URI
|
|
91
|
-
*
|
|
92
|
-
*
|
|
94
|
+
* The base URI used by the engine for built-in assets like emoji and
|
|
95
|
+
* fallback fonts, and by the editor for its default and demo asset
|
|
96
|
+
* sources (stickers, filters, and more).
|
|
93
97
|
*/
|
|
94
|
-
|
|
95
|
-
'https://cdn.img.ly/packages/imgly/cesdk-
|
|
96
|
-
|
|
97
|
-
/** The base URI to the default assets of the asset library. */
|
|
98
|
-
assetBaseUri?: string;
|
|
98
|
+
baseUri: string =
|
|
99
|
+
'https://cdn.img.ly/packages/imgly/cesdk-react-native/1.71.0/assets';
|
|
99
100
|
|
|
100
101
|
/**
|
|
101
102
|
* Unique ID tied to your application's user.
|