@imgly/editor-react-native 1.65.0 → 1.67.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
CHANGED
|
@@ -6,6 +6,16 @@ buildscript {
|
|
|
6
6
|
google()
|
|
7
7
|
gradlePluginPortal()
|
|
8
8
|
}
|
|
9
|
+
|
|
10
|
+
dependencies {
|
|
11
|
+
if (rootProject.ext.has('kotlinVersion')) {
|
|
12
|
+
def kotlinVersion = rootProject.ext.get('kotlinVersion').toString()
|
|
13
|
+
def kotlinMajor = kotlinVersion.tokenize('.')[0].toInteger()
|
|
14
|
+
if (kotlinMajor >= 2) {
|
|
15
|
+
classpath "org.jetbrains.kotlin:compose-compiler-gradle-plugin:$kotlinVersion"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
9
19
|
}
|
|
10
20
|
|
|
11
21
|
def isNewArchitectureEnabled() {
|
|
@@ -26,12 +36,60 @@ def isKotlin2OrHigher() {
|
|
|
26
36
|
return false
|
|
27
37
|
}
|
|
28
38
|
|
|
29
|
-
def
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return
|
|
39
|
+
def getKotlinCompilerExtensionVersion() {
|
|
40
|
+
// User override takes precedence
|
|
41
|
+
if (gradle.ext.has("kotlinCompilerExtensionVersion")) {
|
|
42
|
+
return gradle.ext.kotlinCompilerExtensionVersion
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
def kotlinVersion = getKotlinVersion()
|
|
46
|
+
if (!kotlinVersion) {
|
|
47
|
+
logger.warn("Could not detect Kotlin version - using Compose Compiler 1.5.10")
|
|
48
|
+
return "1.5.10"
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
def mainVersion = kotlinVersion.split('-')[0]
|
|
52
|
+
|
|
53
|
+
// Kotlin to Compose Compiler compatibility map (from developer.android.com)
|
|
54
|
+
def compatibilityMap = [
|
|
55
|
+
// Kotlin 1.9.x
|
|
56
|
+
"1.9.25": "1.5.15",
|
|
57
|
+
"1.9.24": "1.5.14",
|
|
58
|
+
"1.9.23": "1.5.13",
|
|
59
|
+
"1.9.22": "1.5.10",
|
|
60
|
+
"1.9.21": "1.5.7",
|
|
61
|
+
"1.9.20": "1.5.5",
|
|
62
|
+
"1.9.10": "1.5.3",
|
|
63
|
+
"1.9.0": "1.5.2",
|
|
64
|
+
// Kotlin 1.8.x
|
|
65
|
+
"1.8.22": "1.4.8",
|
|
66
|
+
"1.8.21": "1.4.7",
|
|
67
|
+
"1.8.20": "1.4.6",
|
|
68
|
+
"1.8.10": "1.4.4",
|
|
69
|
+
"1.8.0": "1.4.1",
|
|
70
|
+
// Kotlin 1.7.x
|
|
71
|
+
"1.7.21": "1.4.0-alpha02",
|
|
72
|
+
"1.7.20": "1.3.2",
|
|
73
|
+
"1.7.10": "1.3.1",
|
|
74
|
+
// Kotlin 1.6.x
|
|
75
|
+
"1.6.21": "1.2.0",
|
|
76
|
+
"1.6.20": "1.2.0-beta03",
|
|
77
|
+
"1.6.10": "1.1.1",
|
|
78
|
+
"1.6.0": "1.1.0-rc02",
|
|
79
|
+
// Kotlin 1.5.x
|
|
80
|
+
"1.5.31": "1.0.5",
|
|
81
|
+
"1.5.30": "1.0.3",
|
|
82
|
+
"1.5.21": "1.0.2",
|
|
83
|
+
"1.5.10": "1.0.0",
|
|
84
|
+
]
|
|
85
|
+
|
|
86
|
+
if (compatibilityMap.containsKey(mainVersion)) {
|
|
87
|
+
return compatibilityMap[mainVersion]
|
|
33
88
|
}
|
|
34
|
-
|
|
89
|
+
|
|
90
|
+
// Fallback for unknown versions
|
|
91
|
+
logger.warn("Unknown Kotlin version '$mainVersion' - using Compose Compiler 1.5.10")
|
|
92
|
+
return "1.5.10"
|
|
35
93
|
}
|
|
36
94
|
|
|
37
95
|
apply plugin: 'com.android.library'
|
|
@@ -71,8 +129,9 @@ android {
|
|
|
71
129
|
}
|
|
72
130
|
|
|
73
131
|
if (!isKotlin2OrHigher()) {
|
|
132
|
+
def composeVersion = getKotlinCompilerExtensionVersion()
|
|
74
133
|
composeOptions {
|
|
75
|
-
kotlinCompilerExtensionVersion =
|
|
134
|
+
kotlinCompilerExtensionVersion = composeVersion
|
|
76
135
|
}
|
|
77
136
|
}
|
|
78
137
|
}
|
|
@@ -83,7 +142,7 @@ repositories {
|
|
|
83
142
|
}
|
|
84
143
|
|
|
85
144
|
dependencies {
|
|
86
|
-
implementation findProject(":editor") ?: "ly.img:editor:1.
|
|
145
|
+
implementation findProject(":editor") ?: "ly.img:editor:1.67.0"
|
|
87
146
|
implementation platform("androidx.compose:compose-bom:2023.05.01")
|
|
88
147
|
implementation "androidx.activity:activity-compose:1.6.1"
|
|
89
148
|
implementation "androidx.activity:activity:1.7.0"
|
|
@@ -32,7 +32,6 @@ import ly.img.editor.reactnative.module.model.EditorPreset
|
|
|
32
32
|
import ly.img.editor.reactnative.module.model.EditorResult
|
|
33
33
|
import ly.img.editor.reactnative.module.model.EditorSettings
|
|
34
34
|
import ly.img.editor.reactnative.module.model.EditorSourceType
|
|
35
|
-
import ly.img.engine.DemoAssetSource
|
|
36
35
|
import ly.img.engine.DesignBlock
|
|
37
36
|
import ly.img.engine.DesignBlockType
|
|
38
37
|
import ly.img.engine.Engine
|
|
@@ -357,12 +356,10 @@ object EditorBuilderDefaults {
|
|
|
357
356
|
).forEach { type ->
|
|
358
357
|
engine.asset.addSource(SystemGalleryAssetSource(context, type))
|
|
359
358
|
}
|
|
360
|
-
val excluded = setOf(DemoAssetSource.IMAGE, DemoAssetSource.VIDEO, DemoAssetSource.AUDIO)
|
|
361
359
|
engine.addDemoAssetSources(
|
|
362
360
|
sceneMode = engine.scene.getMode(),
|
|
363
361
|
withUploadAssetSources = true,
|
|
364
|
-
|
|
365
|
-
baseUri = Uri.parse("https://cdn.img.ly/assets/demo/v2"),
|
|
362
|
+
baseUri = Uri.parse("https://cdn.img.ly/assets/demo/v3"),
|
|
366
363
|
)
|
|
367
364
|
val defaultTypeface = TypefaceProvider().provideTypeface(engine, "Roboto")
|
|
368
365
|
requireNotNull(defaultTypeface)
|
|
@@ -60,7 +60,6 @@ extension OnCreate {
|
|
|
60
60
|
let baseURI = baseURL ?? Engine.assetBaseURL
|
|
61
61
|
try await engine.addDefaultAssetSources(baseURL: baseURI)
|
|
62
62
|
try await engine.addDemoAssetSources(
|
|
63
|
-
exclude: [.image, .video, .audio],
|
|
64
63
|
sceneMode: engine.scene.getMode(),
|
|
65
64
|
withUploadAssetSources: true,
|
|
66
65
|
)
|
package/ios/IMGLYEditorModule.mm
CHANGED
|
@@ -14,9 +14,11 @@ RCT_EXPORT_MODULE(IMGLYEditor)
|
|
|
14
14
|
resolve:(RCTPromiseResolveBlock)resolve
|
|
15
15
|
reject:(RCTPromiseRejectBlock)reject {
|
|
16
16
|
NSMutableDictionary* mergedSettings = [@{
|
|
17
|
-
@"license" : settings.license(),
|
|
18
17
|
@"sceneBaseUri" : settings.sceneBaseUri(),
|
|
19
18
|
} mutableCopy];
|
|
19
|
+
if (settings.license() != nil) {
|
|
20
|
+
mergedSettings[@"license"] = settings.license();
|
|
21
|
+
}
|
|
20
22
|
if (settings.assetBaseUri() != nil) {
|
|
21
23
|
mergedSettings[@"assetBaseUri"] = settings.assetBaseUri();
|
|
22
24
|
}
|
|
@@ -24,9 +26,10 @@ RCT_EXPORT_MODULE(IMGLYEditor)
|
|
|
24
26
|
mergedSettings[@"userId"] = settings.userId();
|
|
25
27
|
}
|
|
26
28
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
NSString* sourceValue = source.source();
|
|
30
|
+
NSString* typeValue = source.type();
|
|
31
|
+
if (sourceValue != nil && typeValue != nil) {
|
|
32
|
+
mergedSettings[@"source"] = @{@"source" : sourceValue, @"type" : typeValue};
|
|
30
33
|
}
|
|
31
34
|
|
|
32
35
|
[self open:mergedSettings preset:preset metadata:metadata resolve:resolve reject:reject];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@imgly/editor-react-native",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.67.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
|
@@ -159,6 +159,17 @@ const NativeModule = TurboModuleRegistry.get<Spec>(
|
|
|
159
159
|
'IMGLYEditor'
|
|
160
160
|
) as Spec | null;
|
|
161
161
|
|
|
162
|
+
/**
|
|
163
|
+
* Checks if the app is using the New Architecture (TurboModules or Bridgeless).
|
|
164
|
+
* @returns true if New Architecture is enabled, false for Bridge.
|
|
165
|
+
*/
|
|
166
|
+
function isNewArchitectureEnabled(): boolean {
|
|
167
|
+
const g = global as any;
|
|
168
|
+
// Check for TurboModules (Expo 51-52 / RN 0.74-0.76)
|
|
169
|
+
// Check for Bridgeless mode (Expo 53+ / RN 0.79+)
|
|
170
|
+
return g.__turboModuleProxy != null || g.RN$Bridgeless === true;
|
|
171
|
+
}
|
|
172
|
+
|
|
162
173
|
/**
|
|
163
174
|
* Resolves assets that are imported via `require`.
|
|
164
175
|
* @param assetSource The asset source, e.g. require('my-asset')
|
|
@@ -189,15 +200,27 @@ class IMGLYEditor {
|
|
|
189
200
|
): Promise<EditorResult | null> {
|
|
190
201
|
if (NativeModule == null) return null;
|
|
191
202
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
203
|
+
let modifiedSource: Source | undefined;
|
|
204
|
+
if (source?.source != null) {
|
|
205
|
+
modifiedSource = {
|
|
206
|
+
...source,
|
|
207
|
+
source: resolveStaticAsset(source.source)
|
|
208
|
+
};
|
|
209
|
+
} else if (isNewArchitectureEnabled()) {
|
|
210
|
+
// iOS New Architecture: Pass empty object to ensure struct conversion is triggered.
|
|
211
|
+
// Passing undefined leaves the C++ struct with garbage memory in release builds.
|
|
212
|
+
// See: https://github.com/facebook/react-native/issues/49920
|
|
213
|
+
modifiedSource = {} as unknown as Source;
|
|
214
|
+
}
|
|
215
|
+
// iOS Bridge (Old Architecture): Pass undefined, which the bridge handles
|
|
216
|
+
// gracefully. Passing {} causes decoding errors.
|
|
217
|
+
|
|
218
|
+
return NativeModule.openEditor(
|
|
219
|
+
settings,
|
|
220
|
+
modifiedSource,
|
|
221
|
+
preset,
|
|
222
|
+
metadata
|
|
223
|
+
);
|
|
201
224
|
}
|
|
202
225
|
}
|
|
203
226
|
|