@imgly/camera-react-native 1.45.0 → 1.46.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 +40 -40
- package/android/src/main/kotlin/ly/img/camera/reactnative/module/IMGLYCameraModule.kt +14 -15
- package/android/src/main/kotlin/ly/img/camera/reactnative/module/IMGLYCameraPackage.kt +19 -21
- package/android/src/main/kotlin/ly/img/camera/reactnative/module/model/CameraResult.kt +7 -9
- package/android/src/main/kotlin/ly/img/camera/reactnative/module/model/Recording.kt +7 -9
- package/package.json +1 -1
- /package/android/src/oldarch/{IMGLYEditorModuleSpec.kt → IMGLYCameraModuleSpec.kt} +0 -0
package/android/build.gradle
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
buildscript {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
ext.safeExtGet = { prop, fallback ->
|
|
3
|
+
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
4
|
+
}
|
|
5
|
+
repositories {
|
|
6
|
+
google()
|
|
7
|
+
gradlePluginPortal()
|
|
8
|
+
}
|
|
9
|
+
dependencies {
|
|
10
|
+
classpath("com.android.tools.build:gradle:7.3.1")
|
|
11
|
+
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.22")
|
|
12
|
+
}
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
def isNewArchitectureEnabled() {
|
|
16
|
-
|
|
16
|
+
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
apply plugin: 'com.android.library'
|
|
@@ -21,44 +21,44 @@ apply plugin: 'com.facebook.react'
|
|
|
21
21
|
apply plugin: 'org.jetbrains.kotlin.android'
|
|
22
22
|
|
|
23
23
|
android {
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
compileSdkVersion safeExtGet('compileSdkVersion', 33)
|
|
25
|
+
namespace "ly.img.camera.reactnative.module"
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
defaultConfig {
|
|
28
|
+
minSdk = 24
|
|
29
|
+
buildConfigField("boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString())
|
|
30
|
+
}
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
32
|
+
sourceSets {
|
|
33
|
+
main {
|
|
34
|
+
if (isNewArchitectureEnabled()) {
|
|
35
|
+
java.srcDirs += ['src/newarch']
|
|
36
|
+
} else {
|
|
37
|
+
java.srcDirs += ['src/oldarch']
|
|
38
|
+
}
|
|
39
|
+
}
|
|
39
40
|
}
|
|
40
|
-
}
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
buildFeatures {
|
|
43
|
+
compose true
|
|
44
|
+
}
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
composeOptions {
|
|
47
|
+
kotlinCompilerExtensionVersion = "1.5.10"
|
|
48
|
+
}
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
repositories {
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
mavenCentral()
|
|
53
|
+
google()
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
dependencies {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
57
|
+
implementation findProject(":camera") ?: "ly.img:camera:1.46.0"
|
|
58
|
+
implementation platform("androidx.compose:compose-bom:2023.05.01")
|
|
59
|
+
implementation "androidx.activity:activity-compose:1.6.1"
|
|
60
|
+
implementation "androidx.activity:activity:1.7.0"
|
|
61
|
+
implementation "com.google.android.material:material:1.8.0"
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
implementation 'com.facebook.react:react-native'
|
|
64
64
|
}
|
|
@@ -77,14 +77,16 @@ class IMGLYCameraModule(
|
|
|
77
77
|
promise?.reject(IMGLYConstants.ERROR_MISSING_ARGUMENTS, IMGLYConstants.ERROR_MISSING_ARGUMENTS_MESSAGE)
|
|
78
78
|
} else {
|
|
79
79
|
val settingsHashMap = settings.toHashMap()
|
|
80
|
-
val cameraSettings =
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
80
|
+
val cameraSettings = kotlin.runCatching {
|
|
81
|
+
CameraSettings.createFromMap(settingsHashMap)
|
|
82
|
+
}.getOrElse {
|
|
83
|
+
promise?.reject(
|
|
84
|
+
IMGLYConstants.ERROR_PARSING,
|
|
85
|
+
IMGLYConstants.ERROR_PARSING_MESSAGE,
|
|
86
|
+
it,
|
|
87
|
+
)
|
|
88
|
+
return
|
|
89
|
+
}
|
|
88
90
|
val metadataHashMap = metadata?.toHashMap()
|
|
89
91
|
|
|
90
92
|
openCamera(cameraSettings, video, metadataHashMap) {
|
|
@@ -128,13 +130,10 @@ class IMGLYCameraModule(
|
|
|
128
130
|
val engineConfiguration =
|
|
129
131
|
EngineConfiguration(license = settings.license ?: "", userId = settings.userId)
|
|
130
132
|
val input: CaptureVideo.Input =
|
|
131
|
-
configurationClosure?.invoke(metadata) ?: CaptureVideo.Input(
|
|
132
|
-
|
|
133
|
-
)
|
|
134
|
-
|
|
135
|
-
Intent(activity, CameraActivity::class.java).apply {
|
|
136
|
-
putExtra(INTENT_KEY_CAMERA_INPUT, input)
|
|
137
|
-
}
|
|
133
|
+
configurationClosure?.invoke(metadata) ?: CaptureVideo.Input(engineConfiguration)
|
|
134
|
+
val intent = Intent(activity, CameraActivity::class.java).apply {
|
|
135
|
+
putExtra(INTENT_KEY_CAMERA_INPUT, input)
|
|
136
|
+
}
|
|
138
137
|
activity.startActivityForResult(intent, requestCode)
|
|
139
138
|
}
|
|
140
139
|
|
|
@@ -10,26 +10,24 @@ class IMGLYCameraPackage : TurboReactPackage() {
|
|
|
10
10
|
override fun getModule(
|
|
11
11
|
name: String,
|
|
12
12
|
reactContext: ReactApplicationContext,
|
|
13
|
-
): NativeModule? =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
13
|
+
): NativeModule? = if (name == IMGLYCameraModule.NAME) {
|
|
14
|
+
IMGLYCameraModule(reactContext)
|
|
15
|
+
} else {
|
|
16
|
+
null
|
|
17
|
+
}
|
|
19
18
|
|
|
20
|
-
override fun getReactModuleInfoProvider() =
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
19
|
+
override fun getReactModuleInfoProvider() = ReactModuleInfoProvider {
|
|
20
|
+
mapOf(
|
|
21
|
+
IMGLYCameraModule.NAME to
|
|
22
|
+
ReactModuleInfo(
|
|
23
|
+
IMGLYCameraModule.NAME,
|
|
24
|
+
IMGLYCameraModule.NAME,
|
|
25
|
+
false, // canOverrideExistingModule
|
|
26
|
+
false, // needsEagerInit
|
|
27
|
+
true, // hasConstants
|
|
28
|
+
false, // isCxxModule
|
|
29
|
+
true, // isTurboModule
|
|
30
|
+
),
|
|
31
|
+
)
|
|
32
|
+
}
|
|
35
33
|
}
|
|
@@ -39,10 +39,9 @@ data class CameraRecording(
|
|
|
39
39
|
override fun newArray(size: Int): Array<CameraResult?> = arrayOfNulls(size)
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
fun toMap(): Map<String, Any?> =
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
)
|
|
42
|
+
fun toMap(): Map<String, Any?> = mapOf(
|
|
43
|
+
"recordings" to recordings?.map { it.toMap() },
|
|
44
|
+
)
|
|
46
45
|
}
|
|
47
46
|
|
|
48
47
|
/**
|
|
@@ -110,9 +109,8 @@ data class CameraResult(
|
|
|
110
109
|
}
|
|
111
110
|
}
|
|
112
111
|
|
|
113
|
-
fun toMap(): Map<String, Any?> =
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
)
|
|
112
|
+
fun toMap(): Map<String, Any?> = mapOf(
|
|
113
|
+
"recording" to recording?.toMap(),
|
|
114
|
+
"metadata" to metadata,
|
|
115
|
+
)
|
|
118
116
|
}
|
|
@@ -41,11 +41,10 @@ data class Recording(
|
|
|
41
41
|
override fun newArray(size: Int): Array<Recording?> = arrayOfNulls(size)
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
fun toMap(): Map<String, Any?> =
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
)
|
|
44
|
+
fun toMap(): Map<String, Any?> = mapOf(
|
|
45
|
+
"videos" to videos.map { it.toMap() },
|
|
46
|
+
"duration" to duration.inWholeMilliseconds.toDouble(),
|
|
47
|
+
)
|
|
49
48
|
}
|
|
50
49
|
|
|
51
50
|
/**
|
|
@@ -76,8 +75,7 @@ data class Video(
|
|
|
76
75
|
override fun newArray(size: Int): Array<Video?> = arrayOfNulls(size)
|
|
77
76
|
}
|
|
78
77
|
|
|
79
|
-
fun toMap(): Map<String, Any?> =
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
)
|
|
78
|
+
fun toMap(): Map<String, Any?> = mapOf(
|
|
79
|
+
"uri" to uri.toString(),
|
|
80
|
+
)
|
|
83
81
|
}
|
package/package.json
CHANGED
|
File without changes
|