react-native-move-sdk 0.1.4 → 0.2.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
@@ -15,7 +15,7 @@ yarn add react-native-move-sdk
15
15
  Add to the AppDelegate.m file
16
16
 
17
17
  ```objectivec
18
- #import <react-native-move-sdk/DolphinSdk.h>
18
+ #import <ReactMoveSDK/MoveSdk.h>
19
19
  ...
20
20
  - (BOOL)application:(UIApplication *)application willFinishLaunchingWithOptions:(NSDictionary *)launchOptions
21
21
  {
@@ -9,7 +9,7 @@ buildscript {
9
9
  }
10
10
 
11
11
  dependencies {
12
- classpath 'com.android.tools.build:gradle:3.2.1'
12
+ classpath 'com.android.tools.build:gradle:7.2.2'
13
13
  // noinspection DifferentKotlinGradleVersion
14
14
  classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
15
15
  }
@@ -28,13 +28,11 @@ def getExtOrIntegerDefault(name) {
28
28
 
29
29
  android {
30
30
  compileSdkVersion getExtOrIntegerDefault('compileSdkVersion')
31
- buildToolsVersion getExtOrDefault('buildToolsVersion')
32
31
  defaultConfig {
33
32
  minSdkVersion 16
34
33
  targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
35
34
  versionCode 1
36
35
  versionName "1.0"
37
-
38
36
  }
39
37
 
40
38
  buildTypes {
@@ -55,19 +53,18 @@ repositories {
55
53
 
56
54
  mavenLocal()
57
55
  mavenCentral()
56
+ google()
58
57
  maven {
59
- // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
60
- url "$rootDir/../node_modules/react-native/android"
58
+ // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
59
+ url "$rootDir/../node_modules/react-native/android"
61
60
  }
62
61
  maven {
63
- // Android JSC is installed from npm
64
- url "$rootDir/../node_modules/jsc-android/dist"
62
+ // Android JSC is installed from npm
63
+ url "$rootDir/../node_modules/jsc-android/dist"
64
+ }
65
+ maven {
66
+ url "https://dolphin.jfrog.io/artifactory/move-sdk-libs-release"
65
67
  }
66
- google()
67
-
68
-
69
-
70
-
71
68
 
72
69
  def found = false
73
70
  def defaultDir = null
@@ -77,8 +74,8 @@ repositories {
77
74
  defaultDir = rootProject.ext.get('reactNativeAndroidRoot')
78
75
  } else {
79
76
  defaultDir = new File(
80
- projectDir,
81
- '/../../../node_modules/react-native/android'
77
+ projectDir,
78
+ '/../../../node_modules/react-native/android'
82
79
  )
83
80
  }
84
81
 
@@ -97,40 +94,44 @@ repositories {
97
94
  if (found) return true
98
95
  parentDir = parentDir.parentFile
99
96
 
100
- def androidSourcesDir = new File(
101
- parentDir,
102
- 'node_modules/react-native'
103
- )
97
+ if (parentDir != null) {
104
98
 
105
- def androidPrebuiltBinaryDir = new File(
106
- parentDir,
107
- 'node_modules/react-native/android'
108
- )
109
99
 
110
- if (androidPrebuiltBinaryDir.exists()) {
111
- maven {
112
- url androidPrebuiltBinaryDir.toString()
113
- name androidSourcesName
114
- }
100
+ def androidSourcesDir = new File(
101
+ parentDir,
102
+ 'node_modules/react-native'
103
+ )
115
104
 
116
- logger.info(":${project.name}:reactNativeAndroidRoot ${androidPrebuiltBinaryDir.canonicalPath}")
117
- found = true
118
- } else if (androidSourcesDir.exists()) {
119
- maven {
120
- url androidSourcesDir.toString()
121
- name androidSourcesName
122
- }
105
+ def androidPrebuiltBinaryDir = new File(
106
+ parentDir,
107
+ 'node_modules/react-native/android'
108
+ )
109
+
110
+ if (androidPrebuiltBinaryDir.exists()) {
111
+ maven {
112
+ url androidPrebuiltBinaryDir.toString()
113
+ name androidSourcesName
114
+ }
123
115
 
124
- logger.info(":${project.name}:reactNativeAndroidRoot ${androidSourcesDir.canonicalPath}")
125
- found = true
116
+ logger.info(":${project.name}:reactNativeAndroidRoot ${androidPrebuiltBinaryDir.canonicalPath}")
117
+ found = true
118
+ } else if (androidSourcesDir.exists()) {
119
+ maven {
120
+ url androidSourcesDir.toString()
121
+ name androidSourcesName
122
+ }
123
+
124
+ logger.info(":${project.name}:reactNativeAndroidRoot ${androidSourcesDir.canonicalPath}")
125
+ found = true
126
+ }
126
127
  }
127
128
  })
128
129
  }
129
130
 
130
131
  if (!found) {
131
132
  throw new GradleException(
132
- "${project.name}: unable to locate React Native android sources. " +
133
- "Ensure you have you installed React Native as a dependency in your project and try again."
133
+ "${project.name}: unable to locate React Native android sources. " +
134
+ "Ensure you have you installed React Native as a dependency in your project and try again."
134
135
  )
135
136
  }
136
137
  }
@@ -141,5 +142,10 @@ dependencies {
141
142
  // noinspection GradleDynamicVersion
142
143
 
143
144
  implementation "com.facebook.react:react-native:+"
144
- api "io.dolphin.move:move-sdk:1.6.11.+"
145
+ api "io.dolphin.move:move-sdk:2.0.1.55"
146
+
147
+ testImplementation 'junit:junit:4.13.2'
148
+ testImplementation "androidx.test:core:1.4.0"
149
+ testImplementation 'androidx.test.ext:junit-ktx:1.1.3'
150
+ testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:2.1.0"
145
151
  }
@@ -1,5 +1,8 @@
1
1
  distributionBase=GRADLE_USER_HOME
2
2
  distributionPath=wrapper/dists
3
- distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-bin.zip
3
+ distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
4
4
  zipStoreBase=GRADLE_USER_HOME
5
5
  zipStorePath=wrapper/dists
6
+
7
+ android.useAndroidX=true
8
+ android.enableJetifier=true
@@ -1,4 +1,8 @@
1
- MoveSdk_kotlinVersion=1.4.32
2
- MoveSdk_compileSdkVersion=31
3
- MoveSdk_buildToolsVersion=29.0.2
4
- MoveSdk_targetSdkVersion=31
1
+ MoveSdk_kotlinVersion=1.7.10
2
+ MoveSdk_compileSdkVersion=33
3
+ MoveSdk_targetSdkVersion=32
4
+
5
+ android.useAndroidX=true
6
+ android.enableJetifier=true
7
+
8
+ org.gradle.jvmargs=-Xmx4g
@@ -0,0 +1,44 @@
1
+ package `in`.dolph.move.sdk
2
+
3
+ import io.dolphin.move.MoveDetectionService
4
+ import java.util.Locale
5
+ import java.util.regex.Pattern
6
+
7
+ /**
8
+ * https://stackoverflow.com/questions/60010298/how-can-i-convert-a-camel-case-string-to-snake-case-and-back-in-idiomatic-kotlin
9
+ */
10
+
11
+ val camelRegex = "(?<=[a-zA-Z])[A-Z]".toRegex()
12
+ val snakeRegex = "_[a-zA-Z]".toRegex()
13
+
14
+ // String extensions
15
+ private fun String.camelToSnakeCase(): String {
16
+ return camelRegex.replace(this) {
17
+ "_${it.value}"
18
+ }.uppercase(Locale.getDefault())
19
+ }
20
+
21
+ fun String.toSnakeCase(): String {
22
+ return if (Pattern.compile(".*[a-z].*").matcher(this).find()) {
23
+ camelRegex.replace(this) {
24
+ "_${it.value}"
25
+ }.uppercase(Locale.getDefault()).replace("-", "_")
26
+ } else {
27
+ uppercase()
28
+ }
29
+ }
30
+
31
+ fun String.snakeToLowerCamelCase(): String {
32
+ return snakeRegex.replace(this) {
33
+ it.value.replace("_", "")
34
+ .uppercase(Locale.getDefault())
35
+ }
36
+ }
37
+
38
+ fun String.snakeToUpperCamelCase(): String {
39
+ return this.snakeToLowerCamelCase().capitalize()
40
+ }
41
+
42
+ fun String.equalsService(service: MoveDetectionService): Boolean {
43
+ return equals(service.name().camelToSnakeCase(), ignoreCase = true)
44
+ }
@@ -8,34 +8,34 @@ import android.os.Build
8
8
  import androidx.core.app.NotificationCompat
9
9
 
10
10
  data class MoveNotificationConfig(
11
- var title: String,
12
- var text: String,
13
- var channelId: String,
14
- var channelName: String,
15
- var channelDescription: String
11
+ var title: String,
12
+ var text: String,
13
+ var channelId: String,
14
+ var channelName: String,
15
+ var channelDescription: String
16
16
  ) {
17
17
 
18
- fun toAndroidNotification(context: Context): NotificationCompat.Builder {
19
- createChannel(context)
20
- // TODO: Host app should decide on icon
21
- return NotificationCompat.Builder(context, this.channelId)
22
- .setSmallIcon(R.drawable.ic_notification)
23
- .setContentTitle(this.title)
24
- .setContentText(this.text)
25
- .setChannelId(this.channelId)
26
- .setSound(null)
27
- .setPriority(NotificationCompat.PRIORITY_MAX);
28
- }
18
+ fun toAndroidNotification(context: Context): NotificationCompat.Builder {
19
+ createChannel(context)
20
+ // TODO: Host app should decide on icon
21
+ return NotificationCompat.Builder(context, this.channelId)
22
+ .setSmallIcon(R.drawable.ic_notification)
23
+ .setContentTitle(this.title)
24
+ .setContentText(this.text)
25
+ .setChannelId(this.channelId)
26
+ .setSound(null)
27
+ .setPriority(NotificationCompat.PRIORITY_MAX);
28
+ }
29
29
 
30
- fun createChannel(context: Context) {
31
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
32
- // Create the NotificationChannel
33
- val importance = NotificationManager.IMPORTANCE_DEFAULT
34
- val mChannel = NotificationChannel(channelId, channelName, importance)
35
- mChannel.description = channelDescription
36
- val notificationManager =
37
- context.getSystemService(NOTIFICATION_SERVICE) as NotificationManager
38
- notificationManager.createNotificationChannel(mChannel)
39
- }
30
+ private fun createChannel(context: Context) {
31
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
32
+ // Create the NotificationChannel
33
+ val importance = NotificationManager.IMPORTANCE_DEFAULT
34
+ val channel = NotificationChannel(channelId, channelName, importance)
35
+ channel.description = channelDescription
36
+ val notificationManager =
37
+ context.getSystemService(NOTIFICATION_SERVICE) as NotificationManager
38
+ notificationManager.createNotificationChannel(channel)
40
39
  }
40
+ }
41
41
  }
@@ -1,18 +1,13 @@
1
1
  package `in`.dolph.move.sdk
2
2
 
3
- import io.dolphin.move.DrivingService
4
3
  import io.dolphin.move.MoveAuth
5
- import io.dolphin.move.OtherService
6
- import io.dolphin.move.TimelineDetectionService
7
- import io.dolphin.move.WalkingService
4
+ import io.dolphin.move.MoveDetectionService
8
5
 
9
6
  data class MoveSdkConfig(
10
- val auth: MoveAuth,
11
- val timelineDetectionServices: List<TimelineDetectionService>,
12
- val drivingServices: List<DrivingService>,
13
- val walkingServices: List<WalkingService>,
14
- val otherServices: List<OtherService>,
15
- val tripNotification: MoveNotificationConfig,
16
- val recognitionNotification: MoveNotificationConfig,
17
- val allowMockLocations: Boolean
18
- )
7
+ val auth: MoveAuth,
8
+ // not used for now
9
+ val timelineDetectionServices: List<MoveDetectionService>,
10
+ val tripNotification: MoveNotificationConfig,
11
+ val recognitionNotification: MoveNotificationConfig,
12
+ val walkingNotification: MoveNotificationConfig,
13
+ )
@@ -17,21 +17,30 @@ import com.facebook.react.bridge.ReactApplicationContext
17
17
  import com.facebook.react.bridge.ReactContextBaseJavaModule
18
18
  import com.facebook.react.bridge.ReactMethod
19
19
  import com.facebook.react.bridge.ReadableArray
20
+ import com.facebook.react.bridge.WritableArray
20
21
  import com.facebook.react.bridge.WritableMap
21
22
  import com.facebook.react.modules.core.DeviceEventManagerModule
22
23
  import io.dolphin.move.MoveSdk
23
-
24
- internal const val EVENT_INIT_ERROR = "DolphinSdk-InitError"
25
- internal const val EVENT_MOVE_STATE = "DolphinSdk-State"
26
- internal const val EVENT_TRIP_STATE = "DolphinSdk-TripState"
27
- internal const val EVENT_AUTH_STATE = "DolphinSdk-AuthState"
28
- internal const val EVENT_AUTH_BATTERY_PERMISSION = "DolphinSdk-Permission-BatteryOptimization"
29
- internal const val EVENT_AUTH_OVERLAY_PERMISSION = "DolphinSdk-Permission-Overlay"
24
+ import io.dolphin.move.MoveServiceFailure
25
+ import io.dolphin.move.MoveServiceWarning
26
+
27
+ internal const val EVENT_INIT_ERROR = "MoveSdk-InitError"
28
+ internal const val EVENT_MOVE_STATE = "MoveSdk-State"
29
+ internal const val EVENT_TRIP_STATE = "MoveSdk-TripState"
30
+ internal const val EVENT_AUTH_STATE = "MoveSdk-AuthState"
31
+ internal const val EVENT_ERRORS = "MoveSdk-Errors"
32
+ internal const val EVENT_WARNINGS = "MoveSdk-Warnings"
33
+ internal const val EVENT_AUTH_BATTERY_PERMISSION = "MoveSdk-Permission-BatteryOptimization"
34
+ internal const val EVENT_AUTH_OVERLAY_PERMISSION = "MoveSdk-Permission-Overlay"
30
35
 
31
36
  internal const val ARGUMENT_ACCESS_TOKEN = "accessToken"
32
37
  internal const val ARGUMENT_REFRESH_TOKEN = "refreshToken"
33
38
  internal const val ARGUMENT_STATE = "state"
34
- internal const val ARGUMENT_ERROR = "error"
39
+ internal const val ARGUMENT_ERROR = "errors"
40
+ internal const val ARGUMENT_ERRORS = "errors"
41
+ internal const val ARGUMENT_WARNINGS = "warnings"
42
+ internal const val ARGUMENT_LOG = "log"
43
+ internal const val ARGUMENT_WARNING = "warnings"
35
44
  internal const val ARGUMENT_ERROR_REASON = "errorReason"
36
45
 
37
46
  internal const val PROMISE_OK = "OK"
@@ -40,8 +49,8 @@ class MoveSdkModule(context: ReactApplicationContext) : ReactContextBaseJavaModu
40
49
  ActivityEventListener {
41
50
 
42
51
  companion object {
43
- const val LOG_TAG = "DOLPHIN_SDK"
44
- const val ERROR_CODE = "DOLPHIN_SDK_ERROR"
52
+ const val LOG_TAG = "MOVE_SDK"
53
+ const val ERROR_CODE = "MOVE_SDK_ERROR"
45
54
 
46
55
  // **** PERMISSIONS MODULE START *****
47
56
  const val OVERLAY_REQUEST_CODE = 1
@@ -68,16 +77,15 @@ class MoveSdkModule(context: ReactApplicationContext) : ReactContextBaseJavaModu
68
77
  // **** PERMISSIONS MODULE START *****
69
78
 
70
79
  @ReactMethod
71
- fun initialize(
72
- contractId: String,
80
+ fun setup(
81
+ userId: String,
73
82
  accessToken: String,
74
83
  refreshToken: String,
75
- productId: Int,
84
+ projectId: Int,
76
85
  // Config
77
86
  timelineDetectionServices: ReadableArray,
78
87
  drivingServices: ReadableArray,
79
88
  walkingServices: ReadableArray,
80
- otherServices: ReadableArray,
81
89
  // Platform config
82
90
  recognitionNotificationTitle: String,
83
91
  recognitionNotificationText: String,
@@ -89,20 +97,18 @@ class MoveSdkModule(context: ReactApplicationContext) : ReactContextBaseJavaModu
89
97
  tripNotificationChannelId: String,
90
98
  tripNotificationChannelName: String,
91
99
  tripNotificationChannelDescription: String,
92
- allowMockLocations: Boolean,
93
100
  promise: Promise?
94
101
  ) {
95
102
 
96
- nativeSdkWrapper.initialize(
97
- contractId,
103
+ nativeSdkWrapper.setup(
104
+ userId,
98
105
  accessToken,
99
106
  refreshToken,
100
- productId,
107
+ projectId,
101
108
  // Config
102
109
  timelineDetectionServices,
103
110
  drivingServices,
104
111
  walkingServices,
105
- otherServices,
106
112
  // Platform config
107
113
  recognitionNotificationTitle,
108
114
  recognitionNotificationText,
@@ -114,16 +120,25 @@ class MoveSdkModule(context: ReactApplicationContext) : ReactContextBaseJavaModu
114
120
  tripNotificationChannelId,
115
121
  tripNotificationChannelName,
116
122
  tripNotificationChannelDescription,
117
- allowMockLocations,
118
123
  promise = promise
119
124
  )
120
125
  }
121
126
 
127
+ @ReactMethod
128
+ fun init() {
129
+ MoveSdk.init(reactContext.applicationContext)
130
+ }
131
+
122
132
  @ReactMethod
123
133
  fun resolveError() {
124
134
  nativeSdkWrapper.resolveError()
125
135
  }
126
136
 
137
+ @ReactMethod
138
+ fun allowMockLocations(allowMockLocations: Boolean) {
139
+ nativeSdkWrapper.allowMockLocations(allowMockLocations)
140
+ }
141
+
127
142
  @ReactMethod
128
143
  fun startAutomaticDetection() {
129
144
  nativeSdkWrapper.startAutomaticDetection()
@@ -179,6 +194,20 @@ class MoveSdkModule(context: ReactApplicationContext) : ReactContextBaseJavaModu
179
194
  nativeSdkWrapper.getTripState(promise)
180
195
  }
181
196
 
197
+ @ReactMethod
198
+ fun geocode(latitude: Double, longitude: Double, promise: Promise) {
199
+ nativeSdkWrapper.geocode(latitude, longitude, promise)
200
+ }
201
+
202
+ @ReactMethod
203
+ fun setAssistanceMetaData(data: String) {
204
+ }
205
+
206
+ @ReactMethod
207
+ fun initiateAssistanceCall(promise: Promise) {
208
+ nativeSdkWrapper.initiateAssistanceCall(promise)
209
+ }
210
+
182
211
  @ReactMethod
183
212
  fun updateAuth(
184
213
  contractId: String,
@@ -195,7 +224,7 @@ class MoveSdkModule(context: ReactApplicationContext) : ReactContextBaseJavaModu
195
224
  }
196
225
 
197
226
  override fun getName(): String {
198
- return "DolphinSdk"
227
+ return "MoveSdk"
199
228
  }
200
229
 
201
230
  override fun getConstants(): MutableMap<String, Any> {
@@ -204,10 +233,23 @@ class MoveSdkModule(context: ReactApplicationContext) : ReactContextBaseJavaModu
204
233
  return constants
205
234
  }
206
235
 
207
- internal fun emitDeviceEvent(eventName: String, eventData: WritableMap?) {
236
+ internal fun emitDeviceEvent(eventName: String, data: Array<Any>) {
237
+ try {
238
+ val eventData: WritableArray = data.toWritableArray()
239
+ reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
240
+ .emit(eventName.toSnakeCase(), eventData)
241
+ } catch (t: Throwable) {
242
+ Log.e("SDK Module", t.message, t)
243
+ // java.lang.IllegalStateException: Tried to access a JS module before the React instance was fully set up.
244
+ // Calls to ReactContext#getJSModule should only happen once initialize() has been called on your native module.
245
+ }
246
+ }
247
+
248
+ internal fun emitDeviceEvent(eventName: String, data: Map<*, *>) {
208
249
  try {
250
+ val eventData: WritableMap = data.toWritableMap()
209
251
  reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
210
- .emit(eventName, eventData)
252
+ .emit(eventName.toSnakeCase(), eventData)
211
253
  } catch (t: Throwable) {
212
254
  Log.e("SDK Module", t.message, t)
213
255
  // java.lang.IllegalStateException: Tried to access a JS module before the React instance was fully set up.
@@ -225,6 +267,18 @@ class MoveSdkModule(context: ReactApplicationContext) : ReactContextBaseJavaModu
225
267
  // Remove upstream listeners, stop unnecessary background tasks
226
268
  }
227
269
 
270
+ @ReactMethod
271
+ fun getErrors(promise: Promise?) {
272
+ val errors: List<MoveServiceFailure> = nativeSdkWrapper.getErrors() ?: emptyList()
273
+ promise?.resolve(errors.failuresToArray().toWritableArray())
274
+ }
275
+
276
+ @ReactMethod
277
+ fun getWarnings(promise: Promise?) {
278
+ val warnings: List<MoveServiceWarning> = nativeSdkWrapper.getWarnings() ?: emptyList()
279
+ promise?.resolve(warnings.warningsToArray().toWritableArray())
280
+ }
281
+
228
282
  // **** PERMISSIONS MODULE START *****
229
283
  @SuppressLint("NewApi")
230
284
  override fun onActivityResult(
@@ -234,12 +288,12 @@ class MoveSdkModule(context: ReactApplicationContext) : ReactContextBaseJavaModu
234
288
  data: Intent?
235
289
  ) {
236
290
  if (requestCode == OVERLAY_REQUEST_CODE) {
237
- val eventData = Arguments.createMap()
238
- eventData.putBoolean(ARGUMENT_STATE, Settings.canDrawOverlays(reactContext))
291
+ val eventData = mutableMapOf<Any, Any>()
292
+ eventData[ARGUMENT_STATE] = Settings.canDrawOverlays(reactContext)
239
293
  emitDeviceEvent(EVENT_AUTH_OVERLAY_PERMISSION, eventData)
240
294
  } else if (requestCode == BATTERY_OPTIMIZATION_REQUEST_CODE) {
241
- val eventData = Arguments.createMap()
242
- eventData.putBoolean(ARGUMENT_STATE, isAppIgnoringBatteryOptimization())
295
+ val eventData = mutableMapOf<Any, Any>()
296
+ eventData[ARGUMENT_STATE] = isAppIgnoringBatteryOptimization()
243
297
  emitDeviceEvent(EVENT_AUTH_BATTERY_PERMISSION, eventData)
244
298
  }
245
299
  }
@@ -291,3 +345,59 @@ class MoveSdkModule(context: ReactApplicationContext) : ReactContextBaseJavaModu
291
345
  }
292
346
  // **** PERMISSIONS MODULE END *****
293
347
  }
348
+
349
+ internal fun Array<*>.toWritableArray(): WritableArray {
350
+ val data: WritableArray = Arguments.createArray()
351
+ for (value in iterator()) {
352
+ when (value) {
353
+ is String -> {
354
+ data.pushString(value)
355
+ }
356
+ is Boolean -> {
357
+ data.pushBoolean(value)
358
+ }
359
+ is Int -> {
360
+ data.pushInt(value)
361
+ }
362
+ is Array<*> -> {
363
+ data.pushArray(value.toWritableArray())
364
+ }
365
+ is List<*> -> {
366
+ data.pushArray(value.toTypedArray().toWritableArray())
367
+ }
368
+ is Map<*, *> -> {
369
+ data.pushMap(value.toWritableMap())
370
+ }
371
+ }
372
+ }
373
+ return data
374
+ }
375
+
376
+ internal fun Map<*, *>.toWritableMap(): WritableMap {
377
+ val data: WritableMap = Arguments.createMap()
378
+ for (entry in iterator()) {
379
+ val value = entry.value
380
+ print("${entry.key} : $value")
381
+ when (value) {
382
+ is String -> {
383
+ data.putString(entry.key.toString(), value)
384
+ }
385
+ is Boolean -> {
386
+ data.putBoolean(entry.key.toString(), value)
387
+ }
388
+ is Int -> {
389
+ data.putInt(entry.key.toString(), value)
390
+ }
391
+ is Array<*> -> {
392
+ data.putArray(entry.key.toString(), value.toWritableArray())
393
+ }
394
+ is List<*> -> {
395
+ data.putArray(entry.key.toString(), value.toTypedArray().toWritableArray())
396
+ }
397
+ is Map<*, *> -> {
398
+ data.putMap(entry.key.toString(), value.toWritableMap())
399
+ }
400
+ }
401
+ }
402
+ return data
403
+ }
@@ -16,4 +16,4 @@ class MoveSdkPackage : ReactPackage {
16
16
  override fun createNativeModules(reactContext: ReactApplicationContext): MutableList<NativeModule> {
17
17
  return mutableListOf(MoveSdkModule(reactContext))
18
18
  }
19
- }
19
+ }