@sency/react-native-smkit-ui 2.0.2 → 2.0.4

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.
Files changed (28) hide show
  1. package/README.md +368 -525
  2. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/AndroidManifest.xml +7 -0
  3. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/output-metadata.json +18 -0
  4. package/android/build/intermediates/annotation_processor_list/debug/javaPreCompileDebug/annotationProcessors.json +1 -0
  5. package/android/build/intermediates/compile_r_class_jar/debug/generateDebugRFile/R.jar +0 -0
  6. package/android/build/intermediates/compile_symbol_list/debug/generateDebugRFile/R.txt +0 -0
  7. package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +1 -0
  8. package/android/build/intermediates/incremental/debug/packageDebugResources/merger.xml +2 -0
  9. package/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +2 -0
  10. package/android/build/intermediates/incremental/mergeDebugShaders/merger.xml +2 -0
  11. package/android/build/intermediates/incremental/packageDebugAssets/merger.xml +2 -0
  12. package/android/build/intermediates/local_only_symbol_list/debug/parseDebugLocalResources/R-def.txt +2 -0
  13. package/android/build/intermediates/manifest_merge_blame_file/debug/processDebugManifest/manifest-merger-blame-debug-report.txt +7 -0
  14. package/android/build/intermediates/merged_manifest/debug/processDebugManifest/AndroidManifest.xml +7 -0
  15. package/android/build/intermediates/nested_resources_validation_report/debug/generateDebugResources/nestedResourcesValidationReport.txt +1 -0
  16. package/android/build/intermediates/symbol_list_with_package_name/debug/generateDebugRFile/package-aware-r.txt +1 -0
  17. package/android/build/outputs/logs/manifest-merger-debug-report.txt +16 -0
  18. package/android/build.gradle +1 -1
  19. package/android/src/main/java/com/smkituilibrary/SmkitUiLibraryModule.kt +91 -4
  20. package/ios/SMKitUIManager.swift +161 -135
  21. package/lib/commonjs/index.js +4 -0
  22. package/lib/commonjs/index.js.map +1 -1
  23. package/lib/module/index.js +2 -0
  24. package/lib/module/index.js.map +1 -1
  25. package/package.json +2 -2
  26. package/react-native-smkit-ui.podspec +1 -1
  27. package/src/index.tsx +11 -9
  28. package/android/build/intermediates/aar_metadata/debug/writeDebugAarMetadata/aar-metadata.properties +0 -6
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android"
3
+ package="com.smkituilibrary" >
4
+
5
+ <uses-sdk android:minSdkVersion="26" />
6
+
7
+ </manifest>
@@ -0,0 +1,18 @@
1
+ {
2
+ "version": 3,
3
+ "artifactType": {
4
+ "type": "AAPT_FRIENDLY_MERGED_MANIFESTS",
5
+ "kind": "Directory"
6
+ },
7
+ "applicationId": "com.smkituilibrary",
8
+ "variantName": "debug",
9
+ "elements": [
10
+ {
11
+ "type": "SINGLE",
12
+ "filters": [],
13
+ "attributes": [],
14
+ "outputFile": "AndroidManifest.xml"
15
+ }
16
+ ],
17
+ "elementType": "File"
18
+ }
@@ -0,0 +1 @@
1
+ {"moshi-kotlin-codegen-1.15.0.jar (com.squareup.moshi:moshi-kotlin-codegen:1.15.0)":"INCREMENTAL_AP"}
@@ -0,0 +1,2 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <merger version="3"><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="main$Generated" generated="true" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/offryhayon/PycharmProjects/smkit_ui_library/react-native-smkit-ui/android/src/main/res"/></dataSet><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="main" generated-set="main$Generated" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/offryhayon/PycharmProjects/smkit_ui_library/react-native-smkit-ui/android/src/main/res"/></dataSet><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="debug$Generated" generated="true" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/offryhayon/PycharmProjects/smkit_ui_library/react-native-smkit-ui/android/src/debug/res"/></dataSet><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="debug" generated-set="debug$Generated" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/offryhayon/PycharmProjects/smkit_ui_library/react-native-smkit-ui/android/src/debug/res"/></dataSet><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="generated$Generated" generated="true" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/offryhayon/PycharmProjects/smkit_ui_library/react-native-smkit-ui/android/build/generated/res/resValues/debug"/></dataSet><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="generated" generated-set="generated$Generated" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/offryhayon/PycharmProjects/smkit_ui_library/react-native-smkit-ui/android/build/generated/res/resValues/debug"/></dataSet><mergedItems/></merger>
@@ -0,0 +1,2 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <merger version="3"><dataSet config="main" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/offryhayon/PycharmProjects/smkit_ui_library/react-native-smkit-ui/android/src/main/jniLibs"/></dataSet><dataSet config="debug" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/offryhayon/PycharmProjects/smkit_ui_library/react-native-smkit-ui/android/src/debug/jniLibs"/></dataSet></merger>
@@ -0,0 +1,2 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <merger version="3"><dataSet config="main" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/offryhayon/PycharmProjects/smkit_ui_library/react-native-smkit-ui/android/src/main/shaders"/></dataSet><dataSet config="debug" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/offryhayon/PycharmProjects/smkit_ui_library/react-native-smkit-ui/android/src/debug/shaders"/></dataSet></merger>
@@ -0,0 +1,2 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <merger version="3"><dataSet config="main" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/offryhayon/PycharmProjects/smkit_ui_library/react-native-smkit-ui/android/src/main/assets"/></dataSet><dataSet config="debug" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/offryhayon/PycharmProjects/smkit_ui_library/react-native-smkit-ui/android/src/debug/assets"/></dataSet><dataSet config="generated" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/offryhayon/PycharmProjects/smkit_ui_library/react-native-smkit-ui/android/build/intermediates/shader_assets/debug/compileDebugShaders/out"/></dataSet></merger>
@@ -0,0 +1,2 @@
1
+ R_DEF: Internal format may change without notice
2
+ local
@@ -0,0 +1,7 @@
1
+ 1<?xml version="1.0" encoding="utf-8"?>
2
+ 2<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3
+ 3 package="com.smkituilibrary" >
4
+ 4
5
+ 5 <uses-sdk android:minSdkVersion="26" />
6
+ 6
7
+ 7</manifest>
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android"
3
+ package="com.smkituilibrary" >
4
+
5
+ <uses-sdk android:minSdkVersion="26" />
6
+
7
+ </manifest>
@@ -0,0 +1,16 @@
1
+ -- Merging decision tree log ---
2
+ manifest
3
+ ADDED from /Users/offryhayon/PycharmProjects/smkit_ui_library/react-native-smkit-ui/android/src/main/AndroidManifestNew.xml:1:1-2:12
4
+ INJECTED from /Users/offryhayon/PycharmProjects/smkit_ui_library/react-native-smkit-ui/android/src/main/AndroidManifestNew.xml:1:1-2:12
5
+ package
6
+ INJECTED from /Users/offryhayon/PycharmProjects/smkit_ui_library/react-native-smkit-ui/android/src/main/AndroidManifestNew.xml
7
+ xmlns:android
8
+ ADDED from /Users/offryhayon/PycharmProjects/smkit_ui_library/react-native-smkit-ui/android/src/main/AndroidManifestNew.xml:1:11-69
9
+ uses-sdk
10
+ INJECTED from /Users/offryhayon/PycharmProjects/smkit_ui_library/react-native-smkit-ui/android/src/main/AndroidManifestNew.xml reason: use-sdk injection requested
11
+ INJECTED from /Users/offryhayon/PycharmProjects/smkit_ui_library/react-native-smkit-ui/android/src/main/AndroidManifestNew.xml
12
+ INJECTED from /Users/offryhayon/PycharmProjects/smkit_ui_library/react-native-smkit-ui/android/src/main/AndroidManifestNew.xml
13
+ android:targetSdkVersion
14
+ INJECTED from /Users/offryhayon/PycharmProjects/smkit_ui_library/react-native-smkit-ui/android/src/main/AndroidManifestNew.xml
15
+ android:minSdkVersion
16
+ INJECTED from /Users/offryhayon/PycharmProjects/smkit_ui_library/react-native-smkit-ui/android/src/main/AndroidManifestNew.xml
@@ -95,7 +95,7 @@ dependencies {
95
95
  implementation "com.facebook.react:react-android"
96
96
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
97
97
 
98
- implementation("com.sency.smkitui:smkitui:1.4.2") {
98
+ implementation("com.sency.smkitui:smkitui:1.4.3") {
99
99
  exclude group: 'com.facebook.fbjni', module: 'fbjni-java-only'
100
100
  // // Don't exclude native libraries
101
101
  // exclude group: 'com.facebook.react', module: 'react-native'
@@ -19,7 +19,9 @@ import com.sency.smkitui.listener.SMKitUIWorkoutListener
19
19
  import com.sency.smkitui.model.ExerciseData
20
20
  import com.sency.smkitui.model.ScoringParamsData
21
21
  import com.sency.smkitui.model.UserData
22
+ import com.sency.smkitui.model.UIColorTheme
22
23
  import com.sency.smkitui.model.WorkoutSummaryData
24
+ import com.sency.smkitui.model.Gender
23
25
  import com.sency.smkitui.model.smkitui.Body360
24
26
  import com.sency.smkitui.model.smkitui.Custom
25
27
  import com.sency.smkitui.model.smkitui.Fitness
@@ -179,6 +181,73 @@ class SmkitUiLibraryModule(reactContext: ReactApplicationContext) :
179
181
  promise.resolve("")
180
182
  }
181
183
 
184
+ private fun mapColorToTheme(primaryColor: String): UIColorTheme {
185
+ // Remove # if present and convert to lowercase for comparison
186
+ val color = primaryColor.replace("#", "").lowercase()
187
+
188
+ return when (color) {
189
+ "blue", "2196f3", "1976d2" -> UIColorTheme.BLUE
190
+ "green", "4caf50", "388e3c" -> UIColorTheme.GREEN
191
+ "orange", "ff9800", "f57c00" -> UIColorTheme.ORANGE
192
+ "purple", "9c27b0", "7b1fa2" -> UIColorTheme.PURPLE
193
+ "red", "f44336", "d32f2f" -> UIColorTheme.ORANGE // Red maps to orange
194
+ "silver" -> UIColorTheme.SILVER
195
+ "gold" -> UIColorTheme.GOLD
196
+ "pink" -> UIColorTheme.PINK
197
+ else -> UIColorTheme.GREEN // Default
198
+ }
199
+ }
200
+
201
+ private fun processModifications(modificationsJson: String?): Pair<String?, Boolean> {
202
+ if (modificationsJson.isNullOrEmpty()) {
203
+ return Pair(null, true) // Default: show phone calibration
204
+ }
205
+
206
+ try {
207
+ val modificationsMap = gson.fromJson(modificationsJson, Map::class.java) as? Map<String, Any> ?: return Pair(modificationsJson, true)
208
+
209
+ // Create a copy to avoid modifying the original
210
+ val processedMods = modificationsMap.toMutableMap()
211
+
212
+ // Extract and set color theme from modifications
213
+ val primaryColor = processedMods["primaryColor"] as? String
214
+ if (primaryColor != null) {
215
+ val theme = mapColorToTheme(primaryColor)
216
+ UIColorTheme.current = theme
217
+ }
218
+
219
+ // Extract phone calibration settings
220
+ var showPhoneCalibration = true // Default value
221
+ val phoneCalibration = processedMods["phoneCalibration"] as? Map<*, *>
222
+ if (phoneCalibration != null) {
223
+ val enabled = phoneCalibration["enabled"] as? Boolean
224
+ if (enabled != null) {
225
+ showPhoneCalibration = enabled
226
+ }
227
+ }
228
+
229
+ // Remove UI-related keys from modifications as they're not exercise parameters
230
+ processedMods.remove("primaryColor")
231
+ processedMods.remove("accentColor")
232
+ processedMods.remove("backgroundColor")
233
+ processedMods.remove("showProgressBar")
234
+ processedMods.remove("showCounters")
235
+ processedMods.remove("phoneCalibration")
236
+
237
+ // Return JSON only if there are exercise-related modifications left
238
+ val finalModificationsJson = if (processedMods.isNotEmpty()) {
239
+ gson.toJson(processedMods)
240
+ } else {
241
+ null
242
+ }
243
+
244
+ return Pair(finalModificationsJson, showPhoneCalibration)
245
+ } catch (e: Exception) {
246
+ Log.e(TAG, "Error processing modifications: ${e.message}")
247
+ return Pair(modificationsJson, true)
248
+ }
249
+ }
250
+
182
251
  @ReactMethod
183
252
  fun startAssessment(
184
253
  type: String,
@@ -201,12 +270,16 @@ class SmkitUiLibraryModule(reactContext: ReactApplicationContext) :
201
270
  val user = if(userData == null) null else if (forceShowUserDataScreen) null else {
202
271
  serializeUserData(userData)
203
272
  }
273
+
274
+ val (finalModifications, showPhoneCalibration) = processModifications(modifications)
275
+
204
276
  smKitUI?.startAssessment(
205
277
  listener = listener,
206
278
  assessmentType = assessmentType,
207
279
  userData = user,
208
280
  showSummary = showSummary,
209
- modifications = modifications
281
+ modifications = finalModifications,
282
+ showPhoneCalibration = showPhoneCalibration
210
283
  )
211
284
  } catch (e: Exception) {
212
285
  Log.e(TAG, "Exception in startAssessment", e)
@@ -227,7 +300,13 @@ class SmkitUiLibraryModule(reactContext: ReactApplicationContext) :
227
300
  promise.reject("Starting Custom Workout Failed", "Failed to parse workout JSON")
228
301
  return
229
302
  }
230
- smKitUI?.startCustomizedWorkout(workout = workout, listener = listener, modifications = modifications)
303
+ val (finalModifications, showPhoneCalibration) = processModifications(modifications)
304
+ smKitUI?.startCustomizedWorkout(
305
+ workout = workout,
306
+ listener = listener,
307
+ modifications = finalModifications,
308
+ showPhoneCalibration = showPhoneCalibration
309
+ )
231
310
  } catch (e: Exception) {
232
311
  Log.e(TAG, "Exception in startCustomWorkout", e)
233
312
  promise.reject("Starting Custom Workout Failed", e.message ?: e.toString(), e)
@@ -254,11 +333,15 @@ class SmkitUiLibraryModule(reactContext: ReactApplicationContext) :
254
333
  return
255
334
  }
256
335
  Log.d(TAG, "Starting customized assessment with workout: ${workout.name}")
336
+
337
+ val (finalModifications, showPhoneCalibration) = processModifications(modifications)
338
+
257
339
  smKitUI?.startCustomizedAssessment(
258
340
  workout = workout,
259
341
  showSummary = showSummary,
260
342
  listener = listener,
261
- modifications = modifications
343
+ modifications = finalModifications,
344
+ showPhoneCalibration = showPhoneCalibration
262
345
  ) ?: run {
263
346
  Log.e(TAG, "SMKitUI is null, cannot start assessment")
264
347
  promise.reject("Starting Custom Assessment Failed", "SMKitUI not configured")
@@ -290,10 +373,14 @@ class SmkitUiLibraryModule(reactContext: ReactApplicationContext) :
290
373
  }
291
374
 
292
375
  resultPromise = promise
376
+
377
+ val (finalModifications, showPhoneCalibration) = processModifications(modifications)
378
+
293
379
  smKitUI?.startWorkoutProgram(
294
380
  workoutConfig = smKitWorkoutConfig.toWorkoutConfig(),
295
381
  listener = listener,
296
- modifications = modifications
382
+ modifications = finalModifications,
383
+ showPhoneCalibration = showPhoneCalibration
297
384
  )
298
385
  } catch (e: Exception) {
299
386
  Log.e(TAG, "Exception in startWorkoutProgram", e)