@imgly/camera-react-native 1.44.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.
@@ -1,19 +1,19 @@
1
1
  buildscript {
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
- }
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
- return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
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
- compileSdkVersion safeExtGet('compileSdkVersion', 33)
25
- namespace "ly.img.camera.reactnative.module"
24
+ compileSdkVersion safeExtGet('compileSdkVersion', 33)
25
+ namespace "ly.img.camera.reactnative.module"
26
26
 
27
- defaultConfig {
28
- minSdk = 24
29
- buildConfigField("boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString())
30
- }
27
+ defaultConfig {
28
+ minSdk = 24
29
+ buildConfigField("boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString())
30
+ }
31
31
 
32
- sourceSets {
33
- main {
34
- if (isNewArchitectureEnabled()) {
35
- java.srcDirs += ['src/newarch']
36
- } else {
37
- java.srcDirs += ['src/oldarch']
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
- buildFeatures {
43
- compose true
44
- }
42
+ buildFeatures {
43
+ compose true
44
+ }
45
45
 
46
- composeOptions {
47
- kotlinCompilerExtensionVersion = "1.5.10"
48
- }
46
+ composeOptions {
47
+ kotlinCompilerExtensionVersion = "1.5.10"
48
+ }
49
49
  }
50
50
 
51
51
  repositories {
52
- mavenCentral()
53
- google()
52
+ mavenCentral()
53
+ google()
54
54
  }
55
55
 
56
56
  dependencies {
57
- implementation findProject(":camera") ?: "ly.img:camera:1.44.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"
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
- implementation 'com.facebook.react:react-native'
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
- kotlin
82
- .runCatching {
83
- CameraSettings.createFromMap(settingsHashMap)
84
- }.getOrElse {
85
- promise?.reject(IMGLYConstants.ERROR_PARSING, IMGLYConstants.ERROR_PARSING_MESSAGE, it)
86
- return
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
- engineConfiguration,
133
- )
134
- val intent =
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
- if (name == IMGLYCameraModule.NAME) {
15
- IMGLYCameraModule(reactContext)
16
- } else {
17
- null
18
- }
13
+ ): NativeModule? = if (name == IMGLYCameraModule.NAME) {
14
+ IMGLYCameraModule(reactContext)
15
+ } else {
16
+ null
17
+ }
19
18
 
20
- override fun getReactModuleInfoProvider() =
21
- ReactModuleInfoProvider {
22
- mapOf(
23
- IMGLYCameraModule.NAME to
24
- ReactModuleInfo(
25
- IMGLYCameraModule.NAME,
26
- IMGLYCameraModule.NAME,
27
- false, // canOverrideExistingModule
28
- false, // needsEagerInit
29
- true, // hasConstants
30
- false, // isCxxModule
31
- true, // isTurboModule
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
- mapOf(
44
- "recordings" to recordings?.map { it.toMap() },
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
- mapOf(
115
- "recording" to recording?.toMap(),
116
- "metadata" to metadata,
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
- mapOf(
46
- "videos" to videos.map { it.toMap() },
47
- "duration" to duration.inWholeMilliseconds.toDouble(),
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
- mapOf(
81
- "uri" to uri.toString(),
82
- )
78
+ fun toMap(): Map<String, Any?> = mapOf(
79
+ "uri" to uri.toString(),
80
+ )
83
81
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@imgly/camera-react-native",
3
- "version": "1.44.0",
3
+ "version": "1.46.0",
4
4
  "description": "Camera SDK for React Native - provide a versatile video camera to your users on iOS and Android.",
5
5
  "react-native": "index.js",
6
6
  "source": "index.js",