@sency/react-native-smkit-ui 2.0.3 → 2.0.5
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 +10 -0
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/AndroidManifest.xml +7 -0
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/output-metadata.json +18 -0
- package/android/build/intermediates/annotation_processor_list/debug/javaPreCompileDebug/annotationProcessors.json +1 -0
- package/android/build/intermediates/compile_r_class_jar/debug/generateDebugRFile/R.jar +0 -0
- package/android/build/intermediates/compile_symbol_list/debug/generateDebugRFile/R.txt +0 -0
- package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +1 -0
- package/android/build/intermediates/incremental/debug/packageDebugResources/merger.xml +2 -0
- package/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +2 -0
- package/android/build/intermediates/incremental/mergeDebugShaders/merger.xml +2 -0
- package/android/build/intermediates/incremental/packageDebugAssets/merger.xml +2 -0
- package/android/build/intermediates/local_only_symbol_list/debug/parseDebugLocalResources/R-def.txt +2 -0
- package/android/build/intermediates/manifest_merge_blame_file/debug/processDebugManifest/manifest-merger-blame-debug-report.txt +7 -0
- package/android/build/intermediates/merged_manifest/debug/processDebugManifest/AndroidManifest.xml +7 -0
- package/android/build/intermediates/nested_resources_validation_report/debug/generateDebugResources/nestedResourcesValidationReport.txt +1 -0
- package/android/build/intermediates/symbol_list_with_package_name/debug/generateDebugRFile/package-aware-r.txt +1 -0
- package/android/build/outputs/logs/manifest-merger-debug-report.txt +16 -0
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/smkituilibrary/SmkitUiLibraryModule.kt +91 -4
- package/ios/SMKitUIManager.swift +161 -135
- package/lib/commonjs/index.js +4 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/index.js +2 -0
- package/lib/module/index.js.map +1 -1
- package/package.json +2 -2
- package/react-native-smkit-ui.podspec +1 -1
- package/src/index.tsx +11 -9
- package/android/build/intermediates/aar_metadata/debug/writeDebugAarMetadata/aar-metadata.properties +0 -6
package/README.md
CHANGED
|
@@ -25,6 +25,7 @@ AI-powered fitness assessments, custom workouts, and workout programs with real-
|
|
|
25
25
|
- **Multiple Assessment Types** - Fitness, Body360, Strength, Cardio, and custom assessments
|
|
26
26
|
- **Cross-Platform** - Native support for iOS and Android
|
|
27
27
|
- **Configurable Workouts** - Customize by body zone, difficulty, and duration
|
|
28
|
+
- **Intelligent Model Selection** (Android) - Automatically selects the best pose estimation model based on device capabilities for optimal performance
|
|
28
29
|
|
|
29
30
|
---
|
|
30
31
|
|
|
@@ -152,6 +153,15 @@ android {
|
|
|
152
153
|
}
|
|
153
154
|
```
|
|
154
155
|
|
|
156
|
+
3. **Pose Estimation Model Selection** (v2.0.5+)
|
|
157
|
+
|
|
158
|
+
The SMKit SDK automatically selects the best pose estimation model based on device capabilities:
|
|
159
|
+
- **Pro Model** - High-end devices for maximum accuracy and detailed pose detection
|
|
160
|
+
- **Lite Model** - Mid-range devices for balanced performance and accuracy
|
|
161
|
+
- **UltraLite Model** - Lower-end devices for smooth real-time performance
|
|
162
|
+
|
|
163
|
+
This automatic selection ensures optimal performance and accuracy across a wide range of Android devices without requiring manual configuration.
|
|
164
|
+
|
|
155
165
|
---
|
|
156
166
|
|
|
157
167
|
## Getting Started
|
|
@@ -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"}
|
|
Binary file
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#Thu Dec 11 11:05:39 IST 2025
|
|
@@ -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:.*:<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:.*:<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:.*:<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:.*:<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:.*:<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:.*:<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:.*:<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:.*:<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:.*:<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:.*:<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:.*:<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:.*:<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:.*:<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 @@
|
|
|
1
|
+
0 Warning/Error
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
com.smkituilibrary
|
|
@@ -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
|
package/android/build.gradle
CHANGED
|
@@ -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.
|
|
98
|
+
implementation("com.sency.smkitui:smkitui:1.4.5") {
|
|
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 =
|
|
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
|
-
|
|
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 =
|
|
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 =
|
|
382
|
+
modifications = finalModifications,
|
|
383
|
+
showPhoneCalibration = showPhoneCalibration
|
|
297
384
|
)
|
|
298
385
|
} catch (e: Exception) {
|
|
299
386
|
Log.e(TAG, "Exception in startWorkoutProgram", e)
|
package/ios/SMKitUIManager.swift
CHANGED
|
@@ -1,42 +1,40 @@
|
|
|
1
1
|
import Foundation
|
|
2
|
+
import UIKit
|
|
2
3
|
import SMKitUI
|
|
3
4
|
import SMBase
|
|
4
5
|
|
|
5
6
|
@objc(SMKitUIManager)
|
|
6
|
-
@objcMembers
|
|
7
7
|
class SMKitUIManager: NSObject, RCTBridgeModule {
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
@objc
|
|
11
|
-
static func requiresMainQueueSetup() -> Bool {
|
|
9
|
+
@objc static func requiresMainQueueSetup() -> Bool {
|
|
12
10
|
return true
|
|
13
11
|
}
|
|
14
12
|
|
|
15
13
|
static func moduleName() -> String! { "SMKitUIManager" }
|
|
16
14
|
|
|
17
|
-
var onWorkoutDidFinish:RCTPromiseResolveBlock?
|
|
18
|
-
var onWorkoutFailed:RCTPromiseRejectBlock?
|
|
15
|
+
var onWorkoutDidFinish: RCTPromiseResolveBlock?
|
|
16
|
+
var onWorkoutFailed: RCTPromiseRejectBlock?
|
|
19
17
|
|
|
20
|
-
var summaryData:WorkoutSummaryData?
|
|
18
|
+
var summaryData: WorkoutSummaryData?
|
|
21
19
|
var didCompleteWorkout = false
|
|
22
20
|
|
|
23
|
-
var didReciveSummary = false{
|
|
24
|
-
didSet{
|
|
25
|
-
if didReciveSummary && workoutDidEnd{
|
|
21
|
+
var didReciveSummary = false {
|
|
22
|
+
didSet {
|
|
23
|
+
if didReciveSummary && workoutDidEnd {
|
|
26
24
|
sendResult()
|
|
27
25
|
}
|
|
28
26
|
}
|
|
29
27
|
}
|
|
30
28
|
|
|
31
|
-
var workoutDidEnd = false{
|
|
32
|
-
didSet{
|
|
33
|
-
if didReciveSummary && workoutDidEnd{
|
|
29
|
+
var workoutDidEnd = false {
|
|
30
|
+
didSet {
|
|
31
|
+
if didReciveSummary && workoutDidEnd {
|
|
34
32
|
sendResult()
|
|
35
33
|
}
|
|
36
34
|
}
|
|
37
35
|
}
|
|
38
36
|
|
|
39
|
-
var smkitUIViewController:UIViewController?{
|
|
37
|
+
var smkitUIViewController: UIViewController? {
|
|
40
38
|
let keyWindow = UIApplication.shared.windows.filter {$0.isKeyWindow}.first
|
|
41
39
|
if var topController = keyWindow?.rootViewController {
|
|
42
40
|
while let presentedViewController = topController.presentedViewController {
|
|
@@ -47,45 +45,39 @@ class SMKitUIManager: NSObject, RCTBridgeModule {
|
|
|
47
45
|
return nil
|
|
48
46
|
}
|
|
49
47
|
|
|
48
|
+
/// Configures the SMKitUI SDK with the provided authentication key
|
|
49
|
+
/// - Parameters:
|
|
50
|
+
/// - key: The authentication key
|
|
51
|
+
/// - onSuccess: Resolver block for success
|
|
52
|
+
/// - onFailure: Rejecter block for failure
|
|
50
53
|
@objc(configure:onSuccess:onFailure:)
|
|
51
|
-
func configure(key:NSString, onSuccess: @escaping RCTPromiseResolveBlock,onFailure
|
|
52
|
-
|
|
53
|
-
|
|
54
|
+
func configure(key: NSString, onSuccess: @escaping RCTPromiseResolveBlock, onFailure: @escaping RCTPromiseRejectBlock) {
|
|
55
|
+
print("SMKitUIManager: Configuring with key: \(key)")
|
|
56
|
+
DispatchQueue.main.async {
|
|
54
57
|
var isConfigDone = false
|
|
55
58
|
var didFail = false
|
|
56
59
|
SMKitUIModel.configure(authKey: "\(key)") {
|
|
57
|
-
if !isConfigDone{
|
|
60
|
+
if !isConfigDone {
|
|
58
61
|
isConfigDone = true
|
|
59
62
|
onSuccess("")
|
|
60
63
|
}
|
|
61
64
|
} onFailure: { err in
|
|
62
|
-
if !didFail{
|
|
65
|
+
if !didFail {
|
|
63
66
|
didFail = true
|
|
64
67
|
onFailure("Configure Failed", err?.localizedDescription ?? "", err)
|
|
65
68
|
}
|
|
66
69
|
}
|
|
67
|
-
} else {
|
|
68
|
-
DispatchQueue.main.async {
|
|
69
|
-
var isConfigDone = false
|
|
70
|
-
var didFail = false
|
|
71
|
-
SMKitUIModel.configure(authKey: "\(key)") {
|
|
72
|
-
if !isConfigDone{
|
|
73
|
-
isConfigDone = true
|
|
74
|
-
onSuccess("")
|
|
75
|
-
}
|
|
76
|
-
} onFailure: { err in
|
|
77
|
-
if !didFail{
|
|
78
|
-
didFail = true
|
|
79
|
-
onFailure("Configure Failed", err?.localizedDescription ?? "", err)
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
70
|
}
|
|
84
71
|
}
|
|
85
72
|
|
|
86
73
|
@objc(startAssessment:showSummary:userData:forceShowUserDataScreen:customAssessmentID:modifications:onWorkoutDidFinish:onWorkoutFailed:)
|
|
87
|
-
func startAssessment(type:NSString, showSummary:Bool, userData:NSString?, forceShowUserDataScreen:Bool, customAssessmentID:NSString?, modifications:NSString?, onWorkoutDidFinish: @escaping RCTPromiseResolveBlock, onWorkoutFailed
|
|
88
|
-
|
|
74
|
+
func startAssessment(type: NSString, showSummary: Bool, userData: NSString?, forceShowUserDataScreen: Bool, customAssessmentID: NSString?, modifications: NSString?, onWorkoutDidFinish: @escaping RCTPromiseResolveBlock, onWorkoutFailed: @escaping RCTPromiseRejectBlock) {
|
|
75
|
+
print("SMKitUIManager: Starting assessment \(type)")
|
|
76
|
+
if let modifications = modifications {
|
|
77
|
+
print("SMKitUIManager: Received modifications string: \(modifications)")
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
DispatchQueue.main.async { [weak self] in
|
|
89
81
|
guard let self = self,
|
|
90
82
|
let smkitUIViewController = self.smkitUIViewController else {
|
|
91
83
|
onWorkoutFailed("StartAssessment Failed", "Failed to present view", nil)
|
|
@@ -95,98 +87,97 @@ class SMKitUIManager: NSObject, RCTBridgeModule {
|
|
|
95
87
|
self.onWorkoutDidFinish = onWorkoutDidFinish
|
|
96
88
|
self.onWorkoutFailed = onWorkoutFailed
|
|
97
89
|
|
|
98
|
-
do{
|
|
99
|
-
let
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
90
|
+
do {
|
|
91
|
+
let user = try self.getUserData(rawJson: userData)
|
|
92
|
+
let (finalModifications, showPhoneCalibration) = self.processModifications(modifications)
|
|
93
|
+
|
|
94
|
+
print("SMKitUIManager: Final showPhoneCalibration: \(showPhoneCalibration)")
|
|
95
|
+
|
|
96
|
+
if let assessmentType = AssessmentTypes(rawValue: "\(type)") {
|
|
104
97
|
try SMKitUIModel.startAssessmet(
|
|
105
98
|
viewController: smkitUIViewController,
|
|
106
|
-
type:
|
|
107
|
-
customAssessmentID:(customAssessmentID
|
|
108
|
-
userData:
|
|
99
|
+
type: assessmentType,
|
|
100
|
+
customAssessmentID: (customAssessmentID != nil && customAssessmentID!.length > 0) ? (customAssessmentID as String?) : nil,
|
|
101
|
+
userData: user,
|
|
109
102
|
forceShowUserDataScreen: forceShowUserDataScreen,
|
|
110
103
|
showSummary: showSummary,
|
|
111
104
|
delegate: self,
|
|
112
|
-
onFailure: {error in
|
|
105
|
+
onFailure: { error in
|
|
113
106
|
onWorkoutFailed("StartAssessment Failed", error.localizedDescription, error)
|
|
114
107
|
},
|
|
115
|
-
modifications: finalModifications
|
|
108
|
+
modifications: finalModifications,
|
|
109
|
+
showPhoneCalibration: showPhoneCalibration
|
|
116
110
|
)
|
|
117
|
-
}else{
|
|
118
|
-
onWorkoutFailed("StartAssessment Failed", "Invalid type", nil)
|
|
111
|
+
} else {
|
|
112
|
+
onWorkoutFailed("StartAssessment Failed", "Invalid assessment type: \(type)", nil)
|
|
119
113
|
}
|
|
120
|
-
}catch{
|
|
114
|
+
} catch {
|
|
121
115
|
onWorkoutFailed("StartAssessment Failed", error.localizedDescription, error)
|
|
122
116
|
}
|
|
123
117
|
}
|
|
124
118
|
}
|
|
125
119
|
|
|
126
120
|
@objc(startCustomWorkout:modifications:onWorkoutDidFinish:onWorkoutFailed:)
|
|
127
|
-
func startCustomWorkout(rawJson:String, modifications:NSString?, onWorkoutDidFinish: @escaping RCTPromiseResolveBlock, onWorkoutFailed
|
|
128
|
-
|
|
129
|
-
|
|
121
|
+
func startCustomWorkout(rawJson: String, modifications: NSString?, onWorkoutDidFinish: @escaping RCTPromiseResolveBlock, onWorkoutFailed: @escaping RCTPromiseRejectBlock) {
|
|
122
|
+
print("SMKitUIManager: Starting custom workout")
|
|
123
|
+
DispatchQueue.main.async { [weak self] in
|
|
130
124
|
guard let self = self,
|
|
131
|
-
let smkitUIViewController = smkitUIViewController else {
|
|
125
|
+
let smkitUIViewController = self.smkitUIViewController else {
|
|
132
126
|
onWorkoutFailed("StartCustomWorkout Failed", "Failed to present view", nil)
|
|
133
127
|
return
|
|
134
128
|
}
|
|
135
129
|
self.onWorkoutDidFinish = onWorkoutDidFinish
|
|
136
130
|
self.onWorkoutFailed = onWorkoutFailed
|
|
137
|
-
do{
|
|
138
|
-
let json = try stringJsonToDic(stringJSON: rawJson)
|
|
131
|
+
do {
|
|
132
|
+
let json = try self.stringJsonToDic(stringJSON: rawJson)
|
|
139
133
|
let workout = try SMWorkout(FromJson: json)
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
try SMKitUIModel.startWorkout(viewController: smkitUIViewController, workout: workout, delegate: self, modifications: finalModifications)
|
|
144
|
-
}catch{
|
|
134
|
+
let (finalModifications, showPhoneCalibration) = self.processModifications(modifications)
|
|
135
|
+
try SMKitUIModel.startWorkout(viewController: smkitUIViewController, workout: workout, delegate: self, modifications: finalModifications, showPhoneCalibration: showPhoneCalibration)
|
|
136
|
+
} catch {
|
|
145
137
|
onWorkoutFailed("StartCustomWorkout Failed", error.localizedDescription, error)
|
|
146
138
|
}
|
|
147
139
|
}
|
|
148
140
|
}
|
|
149
141
|
|
|
150
142
|
@objc(startCustomAssessment:userData:forceShowUserDataScreen:showSummary:modifications:onWorkoutDidFinish:onWorkoutFailed:)
|
|
151
|
-
func startCustomAssessment(rawJson:String, userData:NSString?, forceShowUserDataScreen:Bool, showSummary:Bool, modifications:NSString?, onWorkoutDidFinish: @escaping RCTPromiseResolveBlock, onWorkoutFailed
|
|
143
|
+
func startCustomAssessment(rawJson: String, userData: NSString?, forceShowUserDataScreen: Bool, showSummary: Bool, modifications: NSString?, onWorkoutDidFinish: @escaping RCTPromiseResolveBlock, onWorkoutFailed: @escaping RCTPromiseRejectBlock) {
|
|
144
|
+
print("SMKitUIManager: Starting custom assessment")
|
|
152
145
|
DispatchQueue.main.async { [weak self] in
|
|
153
146
|
guard let self = self,
|
|
154
|
-
let smkitUIViewController = smkitUIViewController else {
|
|
147
|
+
let smkitUIViewController = self.smkitUIViewController else {
|
|
155
148
|
onWorkoutFailed("startCustomAssessment Failed", "Failed to present view", nil)
|
|
156
149
|
return
|
|
157
150
|
}
|
|
158
151
|
self.onWorkoutDidFinish = onWorkoutDidFinish
|
|
159
152
|
self.onWorkoutFailed = onWorkoutFailed
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
let
|
|
163
|
-
let json = try stringJsonToDic(stringJSON: rawJson)
|
|
153
|
+
do {
|
|
154
|
+
let user = try self.getUserData(rawJson: userData)
|
|
155
|
+
let json = try self.stringJsonToDic(stringJSON: rawJson)
|
|
164
156
|
let assessment = try SMWorkoutAssessment.initFromJSON(json)
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
let finalModifications = (modificationsDict?.isEmpty == false) ? modificationsDict : nil
|
|
168
|
-
try SMKitUIModel.startCustomAssessment(viewController: smkitUIViewController, assessment: assessment, userData:userData, forceShowUserDataScreen: forceShowUserDataScreen, showSummary: showSummary, delegate: self, onFailure: { error in
|
|
157
|
+
let (finalModifications, showPhoneCalibration) = self.processModifications(modifications)
|
|
158
|
+
try SMKitUIModel.startCustomAssessment(viewController: smkitUIViewController, assessment: assessment, userData: user, forceShowUserDataScreen: forceShowUserDataScreen, showSummary: showSummary, delegate: self, onFailure: { error in
|
|
169
159
|
onWorkoutFailed("startCustomAssessment Failed", error.localizedDescription, error)
|
|
170
|
-
}, modifications: finalModifications)
|
|
171
|
-
}catch{
|
|
160
|
+
}, modifications: finalModifications, showPhoneCalibration: showPhoneCalibration)
|
|
161
|
+
} catch {
|
|
172
162
|
onWorkoutFailed("startCustomAssessment Failed", error.localizedDescription, error)
|
|
173
163
|
}
|
|
174
164
|
}
|
|
175
165
|
}
|
|
176
166
|
|
|
177
167
|
@objc(startWorkoutProgram:modifications:onWorkoutDidFinish:onWorkoutFailed:)
|
|
178
|
-
func startWorkoutProgram(rawJson:String, modifications:NSString?, onWorkoutDidFinish: @escaping RCTPromiseResolveBlock, onWorkoutFailed
|
|
168
|
+
func startWorkoutProgram(rawJson: String, modifications: NSString?, onWorkoutDidFinish: @escaping RCTPromiseResolveBlock, onWorkoutFailed: @escaping RCTPromiseRejectBlock) {
|
|
169
|
+
print("SMKitUIManager: Starting workout program")
|
|
179
170
|
self.onWorkoutDidFinish = onWorkoutDidFinish
|
|
180
171
|
self.onWorkoutFailed = onWorkoutFailed
|
|
181
172
|
|
|
182
173
|
DispatchQueue.main.async { [weak self] in
|
|
183
174
|
guard let self = self,
|
|
184
|
-
let smkitUIViewController = smkitUIViewController else {
|
|
175
|
+
let smkitUIViewController = self.smkitUIViewController else {
|
|
185
176
|
onWorkoutFailed("StartWorkoutProgram Failed", "Failed to present view", nil)
|
|
186
177
|
return
|
|
187
178
|
}
|
|
188
179
|
|
|
189
|
-
guard let json = try? stringJsonToDic(stringJSON: rawJson),
|
|
180
|
+
guard let json = try? self.stringJsonToDic(stringJSON: rawJson),
|
|
190
181
|
let week = json["week"] as? Int,
|
|
191
182
|
let zone = json["bodyZone"] as? String,
|
|
192
183
|
let difficultyLevelRaw = json["difficultyLevel"] as? String,
|
|
@@ -196,7 +187,7 @@ class SMKitUIManager: NSObject, RCTBridgeModule {
|
|
|
196
187
|
let bodyZone = BodyZone(rawValue: zone),
|
|
197
188
|
let difficultyLevel = WorkoutDifficulty(rawValue: difficultyLevelRaw),
|
|
198
189
|
let workoutDuration = WorkoutDuration(rawValue: workoutDurationRaw),
|
|
199
|
-
let language
|
|
190
|
+
let language = SencySupportedLanguage(rawValue: rawLanguage)
|
|
200
191
|
else {
|
|
201
192
|
onWorkoutFailed("StartWorkoutProgram Failed", "Invalid Workout Config", nil)
|
|
202
193
|
return
|
|
@@ -219,32 +210,35 @@ class SMKitUIManager: NSObject, RCTBridgeModule {
|
|
|
219
210
|
}
|
|
220
211
|
|
|
221
212
|
@objc(setSessionLanguage:)
|
|
222
|
-
func setSessionLanguage(language:String){
|
|
213
|
+
func setSessionLanguage(language: String) {
|
|
223
214
|
let lang = SencySupportedLanguage(rawValue: language) ?? .English
|
|
224
215
|
SMKitUIModel.setSessionLanguage(language: lang)
|
|
225
216
|
}
|
|
226
217
|
|
|
227
218
|
@objc(setEndExercisePreferences:)
|
|
228
|
-
func setEndExercisePreferences(preferencesString:String){
|
|
219
|
+
func setEndExercisePreferences(preferencesString: String) {
|
|
229
220
|
let target = EndExercisePreferences(rawValue: preferencesString) ?? .Default
|
|
230
221
|
SMKitUIModel.setEndExercisePreferences(endExercisePreferences: target)
|
|
231
222
|
}
|
|
232
223
|
|
|
233
224
|
@objc(setCounterPreferences:)
|
|
234
|
-
func setCounterPreferences(preferencesString:String){
|
|
225
|
+
func setCounterPreferences(preferencesString: String) {
|
|
235
226
|
let preferences = CounterPreferences(rawValue: preferencesString) ?? .Default
|
|
236
227
|
SMKitUIModel.setCounterPreferences(counterPreferences: preferences)
|
|
237
228
|
}
|
|
238
229
|
|
|
239
|
-
private func stringJsonToDic(stringJSON:String) throws -> [String:Any]{
|
|
230
|
+
private func stringJsonToDic(stringJSON: String) throws -> [String: Any] {
|
|
240
231
|
guard let data = stringJSON.data(using: .utf8),
|
|
241
|
-
let json = try JSONSerialization.jsonObject(with: data) as? [String:Any]
|
|
242
|
-
else {
|
|
232
|
+
let json = try JSONSerialization.jsonObject(with: data) as? [String: Any]
|
|
233
|
+
else {
|
|
234
|
+
print("SMKitUIManager: Error - stringJsonToDic failed to parse string")
|
|
235
|
+
return [:]
|
|
236
|
+
}
|
|
243
237
|
return json
|
|
244
238
|
}
|
|
245
239
|
|
|
246
|
-
func getUserData(rawJson:NSString?) throws -> UserData?{
|
|
247
|
-
guard let rawJson = rawJson as? String else { return nil }
|
|
240
|
+
private func getUserData(rawJson: NSString?) throws -> UserData? {
|
|
241
|
+
guard let rawJson = rawJson as? String, !rawJson.isEmpty else { return nil }
|
|
248
242
|
let json = try stringJsonToDic(stringJSON: rawJson)
|
|
249
243
|
return UserData(
|
|
250
244
|
gender: Gender(rawValue: json["gender"] as? String ?? "") ?? .Female,
|
|
@@ -252,33 +246,91 @@ class SMKitUIManager: NSObject, RCTBridgeModule {
|
|
|
252
246
|
)
|
|
253
247
|
}
|
|
254
248
|
|
|
255
|
-
func
|
|
256
|
-
|
|
257
|
-
|
|
249
|
+
private func mapColorToTheme(primaryColor: String) -> UIColorTheme {
|
|
250
|
+
let color = primaryColor.replacingOccurrences(of: "#", with: "").lowercased()
|
|
251
|
+
print("SMKitUIManager: Mapping color name: \(color)")
|
|
252
|
+
switch color {
|
|
253
|
+
case "blue", "2196f3", "1976d2": return .blue
|
|
254
|
+
case "green", "4caf50", "388e3c": return .green
|
|
255
|
+
case "purple", "9c27b0", "7b1fa2": return .purple
|
|
256
|
+
case "orange", "ff9800", "f57c00": return .orange
|
|
257
|
+
case "red", "f44336", "d32f2f": return .orange // Red maps to orange in SDK
|
|
258
|
+
case "silver": return .silver
|
|
259
|
+
case "gold": return .gold
|
|
260
|
+
case "pink": return .pink
|
|
261
|
+
default:
|
|
262
|
+
print("SMKitUIManager: Color not matched, defaulting to green")
|
|
263
|
+
return .green
|
|
264
|
+
}
|
|
258
265
|
}
|
|
259
266
|
|
|
260
|
-
func
|
|
261
|
-
|
|
267
|
+
private func processModifications(_ modificationsJson: NSString?) -> (modifications: [String: Any]?, showPhoneCalibration: Bool) {
|
|
268
|
+
guard let rawJson = modificationsJson as? String, !rawJson.isEmpty else {
|
|
269
|
+
print("SMKitUIManager: Modifications string is empty or nil")
|
|
270
|
+
return (nil, true)
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
guard let modifications = try? stringJsonToDic(stringJSON: rawJson) else {
|
|
274
|
+
print("SMKitUIManager: Failed to convert modifications string to Dictionary")
|
|
275
|
+
return (nil, true)
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
print("SMKitUIManager: Processing modifications: \(modifications)")
|
|
279
|
+
var mods = modifications
|
|
280
|
+
|
|
281
|
+
if let primaryColor = mods["primaryColor"] as? String {
|
|
282
|
+
let theme = mapColorToTheme(primaryColor: primaryColor)
|
|
283
|
+
print("SMKitUIManager: Setting color theme to: \(theme)")
|
|
284
|
+
SMKitUIModel.colorTheme = theme
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
var showPhoneCalibration = true
|
|
288
|
+
if let phoneCalibration = mods["phoneCalibration"] as? [String: Any],
|
|
289
|
+
let enabled = phoneCalibration["enabled"] as? Bool {
|
|
290
|
+
showPhoneCalibration = enabled
|
|
291
|
+
print("SMKitUIManager: Detected phoneCalibration enabled=\(enabled)")
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
mods.removeValue(forKey: "primaryColor")
|
|
295
|
+
mods.removeValue(forKey: "accentColor")
|
|
296
|
+
mods.removeValue(forKey: "backgroundColor")
|
|
297
|
+
mods.removeValue(forKey: "showProgressBar")
|
|
298
|
+
mods.removeValue(forKey: "showCounters")
|
|
299
|
+
mods.removeValue(forKey: "phoneCalibration")
|
|
300
|
+
|
|
301
|
+
return (mods.isEmpty ? nil : mods, showPhoneCalibration)
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
private func getBirthdayDate(from age: Int) -> Date? {
|
|
262
305
|
var dateComponents = DateComponents()
|
|
263
306
|
dateComponents.year = -age
|
|
264
|
-
|
|
265
|
-
// Use the current calendar and current date to calculate the birth date
|
|
266
307
|
let calendar = Calendar.current
|
|
267
|
-
|
|
268
|
-
return birthDate
|
|
269
|
-
}
|
|
270
|
-
return nil
|
|
308
|
+
return calendar.date(byAdding: dateComponents, to: Date())
|
|
271
309
|
}
|
|
272
310
|
|
|
273
|
-
func reset(){
|
|
311
|
+
private func reset() {
|
|
274
312
|
summaryData = nil
|
|
275
313
|
didReciveSummary = false
|
|
276
314
|
workoutDidEnd = false
|
|
277
315
|
didCompleteWorkout = false
|
|
278
316
|
}
|
|
317
|
+
|
|
318
|
+
private func sendResult() {
|
|
319
|
+
guard let onWorkoutDidFinish = self.onWorkoutDidFinish else { return }
|
|
320
|
+
do {
|
|
321
|
+
let result: [String: Any] = [
|
|
322
|
+
"summary": try summaryData?.toStringJson() ?? "",
|
|
323
|
+
"didFinish": didCompleteWorkout
|
|
324
|
+
]
|
|
325
|
+
onWorkoutDidFinish(result)
|
|
326
|
+
reset()
|
|
327
|
+
} catch {
|
|
328
|
+
onWorkoutFailed?("Unable to create summary", error.localizedDescription, error as NSError)
|
|
329
|
+
}
|
|
330
|
+
}
|
|
279
331
|
}
|
|
280
332
|
|
|
281
|
-
extension SMKitUIManager:SMKitUIWorkoutDelegate{
|
|
333
|
+
extension SMKitUIManager: SMKitUIWorkoutDelegate {
|
|
282
334
|
func handleWorkoutErrors(error: any Error) {
|
|
283
335
|
onWorkoutFailed?("Workout Exercise Error", error.localizedDescription, error)
|
|
284
336
|
}
|
|
@@ -286,63 +338,37 @@ extension SMKitUIManager:SMKitUIWorkoutDelegate{
|
|
|
286
338
|
func workoutDidFinish() {
|
|
287
339
|
didCompleteWorkout = true
|
|
288
340
|
workoutDidEnd = true
|
|
289
|
-
|
|
290
341
|
SMKitUIModel.exitSDK()
|
|
291
342
|
}
|
|
292
343
|
|
|
293
344
|
func didExitWorkout() {
|
|
294
345
|
didCompleteWorkout = false
|
|
295
346
|
workoutDidEnd = true
|
|
296
|
-
|
|
297
347
|
SMKitUIModel.exitSDK()
|
|
298
348
|
}
|
|
299
349
|
|
|
300
|
-
func
|
|
301
|
-
guard let onWorkoutDidFinish = self.onWorkoutDidFinish else {
|
|
302
|
-
onWorkoutFailed?("Unable to create summary", "Missing callback" , nil)
|
|
303
|
-
return
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
do{
|
|
307
|
-
let result:[String:Any] = [
|
|
308
|
-
"summary": try summaryData?.toStringJson() ?? "",
|
|
309
|
-
"didFinish": didCompleteWorkout
|
|
310
|
-
]
|
|
311
|
-
onWorkoutDidFinish(result)
|
|
312
|
-
reset()
|
|
313
|
-
}catch{
|
|
314
|
-
onWorkoutFailed?("Unable to create summary", error.localizedDescription, error as NSError)
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
func exerciseDidFinish(data: ExerciseData) {
|
|
319
|
-
|
|
320
|
-
}
|
|
350
|
+
func exerciseDidFinish(data: ExerciseData) {}
|
|
321
351
|
|
|
322
352
|
func didReceiveSummaryData(data: WorkoutSummaryData?) {
|
|
323
|
-
summaryData = data
|
|
353
|
+
summaryData = data
|
|
324
354
|
didReciveSummary = true
|
|
325
355
|
}
|
|
326
356
|
}
|
|
327
357
|
|
|
328
|
-
extension WorkoutSummaryData{
|
|
329
|
-
func json() throws -> String{
|
|
358
|
+
private extension WorkoutSummaryData {
|
|
359
|
+
func json() throws -> String {
|
|
330
360
|
let jsonEncoder = JSONEncoder()
|
|
331
361
|
let jsonData = try jsonEncoder.encode(self)
|
|
332
|
-
return String(data: jsonData, encoding:
|
|
362
|
+
return String(data: jsonData, encoding: .utf8) ?? ""
|
|
333
363
|
}
|
|
334
364
|
}
|
|
335
365
|
|
|
336
|
-
extension SMWorkoutAssessment{
|
|
337
|
-
static func initFromJSON(_ json: [String:Any]) throws -> SMWorkoutAssessment{
|
|
338
|
-
var assessmentsExercises:[SMAssessmentExercise] = []
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
try exercise.forEach({
|
|
342
|
-
try assessmentsExercises.append(SMAssessmentExercise(FromJson: $0))
|
|
343
|
-
})
|
|
366
|
+
private extension SMWorkoutAssessment {
|
|
367
|
+
static func initFromJSON(_ json: [String: Any]) throws -> SMWorkoutAssessment {
|
|
368
|
+
var assessmentsExercises: [SMAssessmentExercise] = []
|
|
369
|
+
if let exercises = json["exercises"] as? [[String: Any]] {
|
|
370
|
+
try exercises.forEach({ try assessmentsExercises.append(SMAssessmentExercise(FromJson: $0)) })
|
|
344
371
|
}
|
|
345
|
-
|
|
346
372
|
return SMWorkoutAssessment(
|
|
347
373
|
id: json["id"] as? String,
|
|
348
374
|
name: json["name"] as? String,
|
package/lib/commonjs/index.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.SMWorkoutLibrary = void 0;
|
|
6
7
|
exports.configure = configure;
|
|
7
8
|
exports.setCounterPreferences = setCounterPreferences;
|
|
8
9
|
exports.setEndExercisePreferences = setEndExercisePreferences;
|
|
@@ -12,6 +13,9 @@ exports.startCustomAssessment = startCustomAssessment;
|
|
|
12
13
|
exports.startCustomWorkout = startCustomWorkout;
|
|
13
14
|
exports.startWorkoutProgram = startWorkoutProgram;
|
|
14
15
|
var _reactNative = require("react-native");
|
|
16
|
+
var SMWorkoutLibrary = _interopRequireWildcard(require("./SMWorkout"));
|
|
17
|
+
exports.SMWorkoutLibrary = SMWorkoutLibrary;
|
|
18
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
15
19
|
const LINKING_ERROR = `The package 'react-native-smkit-ui' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({
|
|
16
20
|
ios: "- You have run 'pod install'\n",
|
|
17
21
|
default: ''
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","LINKING_ERROR","Platform","select","ios","
|
|
1
|
+
{"version":3,"names":["_reactNative","require","SMWorkoutLibrary","_interopRequireWildcard","exports","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","LINKING_ERROR","Platform","select","ios","SMKitUIManager","NativeModules","Proxy","Error","configure","key","startAssessment","type","showSummary","userData","forceShowUserDataScreen","customAssessmentID","modifications","userDataJson","undefined","toJson","modificationsJson","String","startCustomWorkout","workout","startCustomAssessment","assessment","startWorkoutProgram","workoutConfig","setSessionLanguage","language","setEndExercisePreferences","endExercisePreferences","setCounterPreferences","counterPreferences"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"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","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { NativeModules, Platform } from 'react-native';
|
|
2
|
+
import * as SMWorkoutLibrary from './SMWorkout';
|
|
3
|
+
export { SMWorkoutLibrary };
|
|
2
4
|
const LINKING_ERROR = `The package 'react-native-smkit-ui' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
|
|
3
5
|
ios: "- You have run 'pod install'\n",
|
|
4
6
|
default: ''
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default","SMKitUIManager","Proxy","get","Error","configure","key","startAssessment","type","showSummary","userData","forceShowUserDataScreen","customAssessmentID","modifications","userDataJson","undefined","toJson","modificationsJson","String","startCustomWorkout","workout","startCustomAssessment","assessment","startWorkoutProgram","workoutConfig","setSessionLanguage","language","setEndExercisePreferences","endExercisePreferences","setCounterPreferences","counterPreferences"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;
|
|
1
|
+
{"version":3,"names":["NativeModules","Platform","SMWorkoutLibrary","LINKING_ERROR","select","ios","default","SMKitUIManager","Proxy","get","Error","configure","key","startAssessment","type","showSummary","userData","forceShowUserDataScreen","customAssessmentID","modifications","userDataJson","undefined","toJson","modificationsJson","String","startCustomWorkout","workout","startCustomAssessment","assessment","startWorkoutProgram","workoutConfig","setSessionLanguage","language","setEndExercisePreferences","endExercisePreferences","setCounterPreferences","counterPreferences"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"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","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sency/react-native-smkit-ui",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.5",
|
|
4
4
|
"description": "React Native library for SMKit UI - Advanced fitness assessments and workout programs with AI-powered motion detection and real-time performance tracking",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -92,4 +92,4 @@
|
|
|
92
92
|
]
|
|
93
93
|
]
|
|
94
94
|
}
|
|
95
|
-
}
|
|
95
|
+
}
|
|
@@ -15,7 +15,7 @@ Pod::Spec.new do |s|
|
|
|
15
15
|
s.source = { :git => "https://github.com/sency-ai/smkit-ui-react-native-demo.git", :tag => "#{s.version}" }
|
|
16
16
|
|
|
17
17
|
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
18
|
-
s.dependency "SMKitUI" ,'1.4.
|
|
18
|
+
s.dependency "SMKitUI" ,'1.4.6'
|
|
19
19
|
|
|
20
20
|
# Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
|
|
21
21
|
# See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
|
package/src/index.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { NativeModules, Platform } from 'react-native';
|
|
2
|
-
import * as SMWorkoutLibrary from '
|
|
2
|
+
import * as SMWorkoutLibrary from './SMWorkout';
|
|
3
|
+
export { SMWorkoutLibrary };
|
|
3
4
|
|
|
4
5
|
const LINKING_ERROR =
|
|
5
6
|
`The package 'react-native-smkit-ui' doesn't seem to be linked. Make sure: \n\n` +
|
|
@@ -11,13 +12,13 @@ const LINKING_ERROR =
|
|
|
11
12
|
const SMKitUIManager = NativeModules['SMKitUIManager']
|
|
12
13
|
? NativeModules['SMKitUIManager']
|
|
13
14
|
: new Proxy(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
{},
|
|
16
|
+
{
|
|
17
|
+
get() {
|
|
18
|
+
throw new Error(LINKING_ERROR);
|
|
19
|
+
},
|
|
20
|
+
}
|
|
21
|
+
);
|
|
21
22
|
|
|
22
23
|
/**
|
|
23
24
|
* This function will configure the sdk
|
|
@@ -50,7 +51,8 @@ export function startAssessment(
|
|
|
50
51
|
// Ensure modifications is explicitly null (not undefined) for React Native bridge
|
|
51
52
|
// Convert empty string to null, but ensure we always pass a value (even if null)
|
|
52
53
|
const modificationsJson = modifications !== null && modifications !== undefined && modifications !== '' ? modifications : null;
|
|
53
|
-
|
|
54
|
+
|
|
55
|
+
|
|
54
56
|
// Call native method - React Native legacy bridge automatically handles promise conversion
|
|
55
57
|
// IMPORTANT: Always pass all 6 arguments, even if null
|
|
56
58
|
// React Native bridge counts arguments, so we must pass modifications even when null
|