@sency/react-native-smkit-ui 0.1.8 → 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/android/build.gradle +1 -1
- package/android/src/main/java/com/smkituilibrary/SmkitUiLibraryModule.kt +12 -15
- package/android/src/main/java/com/smkituilibrary/mapper/SMMapper.kt +5 -9
- package/android/src/main/java/com/smkituilibrary/model/SMKitExercise.kt +1 -2
- package/ios/SMKitUIManager.swift +1 -1
- package/package.json +1 -1
package/android/build.gradle
CHANGED
|
@@ -93,7 +93,7 @@ dependencies {
|
|
|
93
93
|
implementation "com.facebook.react:react-native:+"
|
|
94
94
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
95
95
|
|
|
96
|
-
implementation("com.sency.smkitui:smkitui:0.1.
|
|
96
|
+
implementation("com.sency.smkitui:smkitui:0.1.9") {
|
|
97
97
|
exclude group: 'com.facebook.fbjni', module: 'fbjni-java-only'
|
|
98
98
|
}
|
|
99
99
|
|
|
@@ -9,6 +9,7 @@ import com.sency.smkitui.SMKitUI
|
|
|
9
9
|
import com.sency.smkitui.listener.SMKitUIConfigurationListener
|
|
10
10
|
import com.sency.smkitui.listener.SMKitUIWorkoutListener
|
|
11
11
|
import com.sency.smkitui.model.ExerciseData
|
|
12
|
+
import com.sency.smkitui.model.SMWorkout
|
|
12
13
|
import com.sency.smkitui.model.WorkoutSummaryData
|
|
13
14
|
import com.sency.smkitui.model.smkitui.Body360
|
|
14
15
|
import com.sency.smkitui.model.smkitui.Custom
|
|
@@ -68,7 +69,7 @@ class SmkitUiLibraryModule(reactContext: ReactApplicationContext) :
|
|
|
68
69
|
fun startAssessment(type: String, showSummary: Boolean, customAssessmentId: String, promise: Promise) {
|
|
69
70
|
this.resultPromise = promise
|
|
70
71
|
try {
|
|
71
|
-
val assessmentType = when(type) {
|
|
72
|
+
val assessmentType = when (type) {
|
|
72
73
|
"fitness" -> Fitness
|
|
73
74
|
"body360" -> Body360
|
|
74
75
|
else -> Custom(customAssessmentId)
|
|
@@ -82,13 +83,9 @@ class SmkitUiLibraryModule(reactContext: ReactApplicationContext) :
|
|
|
82
83
|
@ReactMethod
|
|
83
84
|
fun startCustomWorkout(jsonArguments: String, promise: Promise) {
|
|
84
85
|
try {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
val workout = smKitWorkout.toSMWorkout()
|
|
90
|
-
Log.d(TAG, "startCustomWorkout : $workout")
|
|
91
|
-
smKitUI?.startWorkout(workout = workout, listener = listener)
|
|
86
|
+
serializeWorkout(jsonArguments)?.let {
|
|
87
|
+
smKitUI?.startCustomizedWorkout(workout = it, listener = listener)
|
|
88
|
+
}
|
|
92
89
|
} catch (e: Exception) {
|
|
93
90
|
promise.reject("Starting Custom Workout Failed", e)
|
|
94
91
|
}
|
|
@@ -97,18 +94,18 @@ class SmkitUiLibraryModule(reactContext: ReactApplicationContext) :
|
|
|
97
94
|
@ReactMethod
|
|
98
95
|
fun startCustomAssessment(jsonArguments: String, promise: Promise) {
|
|
99
96
|
try {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
val workout = smKitWorkout.toSMWorkout()
|
|
105
|
-
Log.d(TAG, "startCustomAssessment: $workout")
|
|
106
|
-
smKitUI?.startWorkout(workout = workout, listener = listener)
|
|
97
|
+
serializeWorkout(jsonArguments)?.let {
|
|
98
|
+
smKitUI?.startCustomizedAssessment(workout = it, listener = listener)
|
|
99
|
+
}
|
|
107
100
|
} catch (e: Exception) {
|
|
108
101
|
promise.reject("Starting Custom Assessment Failed", e)
|
|
109
102
|
}
|
|
110
103
|
}
|
|
111
104
|
|
|
105
|
+
private fun serializeWorkout(jsonArguments: String) =
|
|
106
|
+
moshi.adapter(SMKitWorkout::class.java).fromJson(jsonArguments)?.toSMWorkout()
|
|
107
|
+
|
|
108
|
+
|
|
112
109
|
@ReactMethod
|
|
113
110
|
fun startWorkoutProgram(jsonArguments: String, promise: Promise) {
|
|
114
111
|
try {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
package com.smkituilibrary.mapper
|
|
2
2
|
|
|
3
|
+
import com.sency.smkitui.data.entity.ScoringParams
|
|
3
4
|
import com.sency.smkitui.model.SMExercise
|
|
4
5
|
import com.sency.smkitui.model.SMWorkout
|
|
5
|
-
import com.sency.smkitui.model.ScoringParams
|
|
6
6
|
import com.sency.smkitui.model.workoutConfig.BodyZone
|
|
7
7
|
import com.sency.smkitui.model.workoutConfig.DifficultyLevel
|
|
8
8
|
import com.sency.smkitui.model.workoutConfig.SMLanguage
|
|
@@ -43,14 +43,10 @@ private fun SMKitExercise.toSMExercise(): SMExercise = SMExercise(
|
|
|
43
43
|
detector = detector ?: "",
|
|
44
44
|
repBased = repBased ?: false,
|
|
45
45
|
exerciseClosure = exerciseClosure ?: "",
|
|
46
|
-
scoringParams = scoringParams?.toParams()
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
targetReps = 0,
|
|
51
|
-
targetRom = "",
|
|
52
|
-
passCriteria = null
|
|
53
|
-
)
|
|
46
|
+
scoringParams = scoringParams?.toParams(),
|
|
47
|
+
summaryTitle = "",
|
|
48
|
+
summarySubTitle = "",
|
|
49
|
+
summaryTitleMainMetric = ""
|
|
54
50
|
)
|
|
55
51
|
|
|
56
52
|
private fun SMKitScoringParams.toParams(): ScoringParams {
|
package/ios/SMKitUIManager.swift
CHANGED
|
@@ -50,7 +50,7 @@ class SMKitUIManager: RCTViewManager {
|
|
|
50
50
|
self.onWorkoutFailed = onWorkoutFailed
|
|
51
51
|
do{
|
|
52
52
|
if let type = AssessmentTypes(rawValue: "\(type)"){
|
|
53
|
-
try SMKitUIModel.startAssessmet(viewController: smkitUIViewController, type: type, customAssessmentID:customAssessmentID, showSummary: showSummary, delegate: self){error in
|
|
53
|
+
try SMKitUIModel.startAssessmet(viewController: smkitUIViewController, type: type, customAssessmentID:customAssessmentID == "" ? nil : customAssessmentID, showSummary: showSummary, delegate: self){error in
|
|
54
54
|
onWorkoutFailed("StartAssessment Failed", error.localizedDescription, error)
|
|
55
55
|
}
|
|
56
56
|
}else{
|