@sency/react-native-smkit-ui 0.1.7 → 0.1.8
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 +45 -25
- package/android/src/main/java/com/smkituilibrary/mapper/SMMapper.kt +2 -2
- package/android/src/main/java/com/smkituilibrary/model/SMKitWorkout.kt +8 -6
- package/ios/SMKitUIManager.mm +3 -2
- package/ios/SMKitUIManager.swift +86 -49
- package/lib/commonjs/SMWorkout.js +18 -4
- package/lib/commonjs/SMWorkout.js.map +1 -1
- package/lib/commonjs/index.js +6 -11
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/SMWorkout.js +17 -3
- package/lib/module/SMWorkout.js.map +1 -1
- package/lib/module/index.js +5 -10
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/SMWorkout.d.ts +11 -6
- package/lib/typescript/src/SMWorkout.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +4 -4
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/react-native-smkit-ui.podspec +1 -1
- package/src/SMWorkout.tsx +117 -75
- package/src/index.tsx +6 -10
- package/lib/typescript/example/src/App.d.ts +0 -4
- package/lib/typescript/example/src/App.d.ts.map +0 -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
|
-
|
|
96
|
+
implementation("com.sency.smkitui:smkitui:0.1.8") {
|
|
97
97
|
exclude group: 'com.facebook.fbjni', module: 'fbjni-java-only'
|
|
98
98
|
}
|
|
99
99
|
|
|
@@ -5,11 +5,12 @@ import com.facebook.react.bridge.Promise
|
|
|
5
5
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
6
|
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
7
7
|
import com.facebook.react.bridge.ReactMethod
|
|
8
|
-
import com.sency.smbase.core.listener.ConfigurationResult
|
|
9
8
|
import com.sency.smkitui.SMKitUI
|
|
9
|
+
import com.sency.smkitui.listener.SMKitUIConfigurationListener
|
|
10
10
|
import com.sency.smkitui.listener.SMKitUIWorkoutListener
|
|
11
11
|
import com.sency.smkitui.model.ExerciseData
|
|
12
12
|
import com.sency.smkitui.model.WorkoutSummaryData
|
|
13
|
+
import com.sency.smkitui.model.smkitui.Body360
|
|
13
14
|
import com.sency.smkitui.model.smkitui.Custom
|
|
14
15
|
import com.sency.smkitui.model.smkitui.Fitness
|
|
15
16
|
import com.smkituilibrary.mapper.toSMWorkout
|
|
@@ -20,7 +21,7 @@ import com.squareup.moshi.Moshi
|
|
|
20
21
|
import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
|
|
21
22
|
|
|
22
23
|
class SmkitUiLibraryModule(reactContext: ReactApplicationContext) :
|
|
23
|
-
ReactContextBaseJavaModule(reactContext)
|
|
24
|
+
ReactContextBaseJavaModule(reactContext) {
|
|
24
25
|
|
|
25
26
|
@Suppress("PrivatePropertyName")
|
|
26
27
|
private val TAG = "SmkitUiLibraryModule"
|
|
@@ -30,27 +31,29 @@ class SmkitUiLibraryModule(reactContext: ReactApplicationContext) :
|
|
|
30
31
|
|
|
31
32
|
override fun getName(): String = "SMKitUIManager"
|
|
32
33
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
private val listener = object : SMKitUIWorkoutListener {
|
|
35
|
+
override fun handleWorkoutErrors(error: Error) {
|
|
36
|
+
resultPromise?.reject("Workout Exercise Error", error)
|
|
37
|
+
}
|
|
36
38
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
override fun workoutDidFinish(summary: WorkoutSummaryData) {
|
|
40
|
+
sendResult(summary, didFinish = true)
|
|
41
|
+
}
|
|
40
42
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
override fun didExitWorkout(summary: WorkoutSummaryData) {
|
|
44
|
+
sendResult(summary, didFinish = false)
|
|
45
|
+
}
|
|
44
46
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
+
override fun exerciseDidFinish(data: ExerciseData) {
|
|
48
|
+
println(data)
|
|
49
|
+
}
|
|
47
50
|
}
|
|
48
51
|
|
|
49
52
|
@ReactMethod
|
|
50
53
|
fun configure(key: String, promise: Promise) {
|
|
51
54
|
smKitUI = SMKitUI.Configuration(reactApplicationContext)
|
|
52
55
|
.setUIKey(key)
|
|
53
|
-
.configure(object :
|
|
56
|
+
.configure(object : SMKitUIConfigurationListener {
|
|
54
57
|
override fun onSuccess() {
|
|
55
58
|
promise.resolve("")
|
|
56
59
|
}
|
|
@@ -65,27 +68,44 @@ class SmkitUiLibraryModule(reactContext: ReactApplicationContext) :
|
|
|
65
68
|
fun startAssessment(type: String, showSummary: Boolean, customAssessmentId: String, promise: Promise) {
|
|
66
69
|
this.resultPromise = promise
|
|
67
70
|
try {
|
|
68
|
-
val assessmentType =
|
|
69
|
-
Fitness
|
|
70
|
-
|
|
71
|
-
Custom(customAssessmentId)
|
|
71
|
+
val assessmentType = when(type) {
|
|
72
|
+
"fitness" -> Fitness
|
|
73
|
+
"body360" -> Body360
|
|
74
|
+
else -> Custom(customAssessmentId)
|
|
72
75
|
}
|
|
73
|
-
smKitUI?.startAssessment(listener =
|
|
76
|
+
smKitUI?.startAssessment(listener = listener, assessmentType = assessmentType, userData = null)
|
|
74
77
|
} catch (e: Exception) {
|
|
75
|
-
promise.reject("
|
|
78
|
+
promise.reject("Starting Assessment Failed", e)
|
|
76
79
|
}
|
|
77
80
|
}
|
|
78
81
|
|
|
79
82
|
@ReactMethod
|
|
80
83
|
fun startCustomWorkout(jsonArguments: String, promise: Promise) {
|
|
81
84
|
try {
|
|
82
|
-
Log.d(TAG, "startCustomWorkout: $jsonArguments")
|
|
85
|
+
Log.d(TAG, "startCustomWorkout rawJson: $jsonArguments")
|
|
86
|
+
val adapter = moshi.adapter(SMKitWorkout::class.java)
|
|
87
|
+
val smKitWorkout = adapter.fromJson(jsonArguments) ?: return
|
|
88
|
+
|
|
89
|
+
val workout = smKitWorkout.toSMWorkout()
|
|
90
|
+
Log.d(TAG, "startCustomWorkout : $workout")
|
|
91
|
+
smKitUI?.startWorkout(workout = workout, listener = listener)
|
|
92
|
+
} catch (e: Exception) {
|
|
93
|
+
promise.reject("Starting Custom Workout Failed", e)
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
@ReactMethod
|
|
98
|
+
fun startCustomAssessment(jsonArguments: String, promise: Promise) {
|
|
99
|
+
try {
|
|
100
|
+
Log.d(TAG, "startCustomAssessment: $jsonArguments")
|
|
83
101
|
val adapter = moshi.adapter(SMKitWorkout::class.java)
|
|
84
102
|
val smKitWorkout = adapter.fromJson(jsonArguments) ?: return
|
|
85
103
|
|
|
86
|
-
|
|
104
|
+
val workout = smKitWorkout.toSMWorkout()
|
|
105
|
+
Log.d(TAG, "startCustomAssessment: $workout")
|
|
106
|
+
smKitUI?.startWorkout(workout = workout, listener = listener)
|
|
87
107
|
} catch (e: Exception) {
|
|
88
|
-
promise.reject("
|
|
108
|
+
promise.reject("Starting Custom Assessment Failed", e)
|
|
89
109
|
}
|
|
90
110
|
}
|
|
91
111
|
|
|
@@ -98,10 +118,10 @@ class SmkitUiLibraryModule(reactContext: ReactApplicationContext) :
|
|
|
98
118
|
|
|
99
119
|
smKitUI?.startWorkoutProgram(
|
|
100
120
|
workoutConfig = smKitWorkoutConfig.toWorkoutConfig(),
|
|
101
|
-
listener =
|
|
121
|
+
listener = listener,
|
|
102
122
|
)
|
|
103
123
|
} catch (e: Exception) {
|
|
104
|
-
promise.reject("
|
|
124
|
+
promise.reject("Starting workout from program Failed", e)
|
|
105
125
|
}
|
|
106
126
|
}
|
|
107
127
|
|
|
@@ -29,8 +29,8 @@ internal fun SMKitWorkout.toSMWorkout(): SMWorkout = SMWorkout(
|
|
|
29
29
|
soundtrack = soundtrack ?: "",
|
|
30
30
|
exercises = exercises.map(SMKitExercise::toSMExercise),
|
|
31
31
|
workoutClosure = workoutClosure ?: "",
|
|
32
|
-
getInFrame = "",
|
|
33
|
-
bodycalFinished = ""
|
|
32
|
+
getInFrame = getInFrame ?: "",
|
|
33
|
+
bodycalFinished = bodycalFinished ?: ""
|
|
34
34
|
)
|
|
35
35
|
|
|
36
36
|
private fun SMKitExercise.toSMExercise(): SMExercise = SMExercise(
|
|
@@ -4,10 +4,12 @@ import androidx.annotation.Keep
|
|
|
4
4
|
|
|
5
5
|
@Keep
|
|
6
6
|
internal data class SMKitWorkout(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
val id: String? = null,
|
|
8
|
+
val name: String? = null,
|
|
9
|
+
val workoutIntro: String? = null,
|
|
10
|
+
val soundtrack: String? = null,
|
|
11
|
+
val exercises: List<SMKitExercise>,
|
|
12
|
+
val workoutClosure: String? = null,
|
|
13
|
+
val getInFrame: String? = null,
|
|
14
|
+
val bodycalFinished: String? = null,
|
|
13
15
|
)
|
package/ios/SMKitUIManager.mm
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
@interface RCT_EXTERN_MODULE(SMKitUIManager, RCTViewManager)
|
|
5
5
|
RCT_EXTERN_METHOD(configure:(NSString*)key onSuccess:(RCTPromiseResolveBlock)onSuccess onFailure:(RCTPromiseRejectBlock)onFailure)
|
|
6
6
|
RCT_EXTERN_METHOD(startAssessment:(NSString*)type showSummary:(BOOL)showSummary customAssessmentID:(NSString*)customAssessmentID onWorkoutDidFinish:(RCTPromiseResolveBlock)onWorkoutDidFinish onWorkoutFailed:(RCTPromiseRejectBlock)onWorkoutFailed)
|
|
7
|
-
RCT_EXTERN_METHOD(startCustomWorkout:(
|
|
8
|
-
RCT_EXTERN_METHOD(
|
|
7
|
+
RCT_EXTERN_METHOD(startCustomWorkout:(NSString*)rawJson onWorkoutDidFinish:(RCTPromiseResolveBlock)onWorkoutDidFinish onWorkoutFailed:(RCTPromiseRejectBlock)onWorkoutFailed)
|
|
8
|
+
RCT_EXTERN_METHOD(startCustomAssessment:(NSString*)rawJson onWorkoutDidFinish:(RCTPromiseResolveBlock)onWorkoutDidFinish onWorkoutFailed:(RCTPromiseRejectBlock)onWorkoutFailed)
|
|
9
|
+
RCT_EXTERN_METHOD(startWorkoutProgram:(NSString*)dic onWorkoutDidFinish:(RCTPromiseResolveBlock)onWorkoutDidFinish onWorkoutFailed:(RCTPromiseRejectBlock)onWorkoutFailed)
|
|
9
10
|
@end
|
package/ios/SMKitUIManager.swift
CHANGED
|
@@ -4,7 +4,7 @@ import SMBase
|
|
|
4
4
|
|
|
5
5
|
@objc(SMKitUIManager)
|
|
6
6
|
class SMKitUIManager: RCTViewManager {
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
var onWorkoutDidFinish:RCTPromiseResolveBlock?
|
|
9
9
|
var onWorkoutFailed:RCTPromiseRejectBlock?
|
|
10
10
|
|
|
@@ -38,14 +38,16 @@ class SMKitUIManager: RCTViewManager {
|
|
|
38
38
|
|
|
39
39
|
@objc(startAssessment:showSummary:customAssessmentID:onWorkoutDidFinish:onWorkoutFailed:)
|
|
40
40
|
func startAssessment(type:NSString, showSummary:Bool, customAssessmentID:String?, onWorkoutDidFinish: @escaping RCTPromiseResolveBlock, onWorkoutFailed:@escaping RCTPromiseRejectBlock){
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
41
|
+
DispatchQueue.main.async {[weak self] in
|
|
42
|
+
|
|
43
|
+
guard let self = self,
|
|
44
|
+
let smkitUIViewController = smkitUIViewController else {
|
|
45
|
+
onWorkoutFailed("StartAssessment Failed", "Failed to present view", nil)
|
|
46
|
+
return
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
self.onWorkoutDidFinish = onWorkoutDidFinish
|
|
50
|
+
self.onWorkoutFailed = onWorkoutFailed
|
|
49
51
|
do{
|
|
50
52
|
if let type = AssessmentTypes(rawValue: "\(type)"){
|
|
51
53
|
try SMKitUIModel.startAssessmet(viewController: smkitUIViewController, type: type, customAssessmentID:customAssessmentID, showSummary: showSummary, delegate: self){error in
|
|
@@ -61,15 +63,18 @@ class SMKitUIManager: RCTViewManager {
|
|
|
61
63
|
}
|
|
62
64
|
|
|
63
65
|
@objc(startCustomWorkout:onWorkoutDidFinish:onWorkoutFailed:)
|
|
64
|
-
func startCustomWorkout(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
66
|
+
func startCustomWorkout(rawJson:String, onWorkoutDidFinish: @escaping RCTPromiseResolveBlock, onWorkoutFailed:@escaping RCTPromiseRejectBlock){
|
|
67
|
+
DispatchQueue.main.async {[weak self] in
|
|
68
|
+
|
|
69
|
+
guard let self = self,
|
|
70
|
+
let smkitUIViewController = smkitUIViewController else {
|
|
71
|
+
onWorkoutFailed("StartCustomWorkout Failed", "Failed to present view", nil)
|
|
72
|
+
return
|
|
73
|
+
}
|
|
74
|
+
self.onWorkoutDidFinish = onWorkoutDidFinish
|
|
75
|
+
self.onWorkoutFailed = onWorkoutFailed
|
|
72
76
|
do{
|
|
77
|
+
let json = try stringJsonToDic(stringJSON: rawJson)
|
|
73
78
|
let workout = try SMWorkout(FromJson: json)
|
|
74
79
|
try SMKitUIModel.startWorkout(viewController: smkitUIViewController, workout: workout, delegate: self)
|
|
75
80
|
}catch{
|
|
@@ -78,41 +83,73 @@ class SMKitUIManager: RCTViewManager {
|
|
|
78
83
|
}
|
|
79
84
|
}
|
|
80
85
|
|
|
86
|
+
@objc(startCustomAssessment:onWorkoutDidFinish:onWorkoutFailed:)
|
|
87
|
+
func startCustomAssessment(rawJson:String, onWorkoutDidFinish: @escaping RCTPromiseResolveBlock, onWorkoutFailed:@escaping RCTPromiseRejectBlock){
|
|
88
|
+
DispatchQueue.main.async { [weak self] in
|
|
89
|
+
guard let self = self,
|
|
90
|
+
let smkitUIViewController = smkitUIViewController else {
|
|
91
|
+
onWorkoutFailed("startCustomAssessment Failed", "Failed to present view", nil)
|
|
92
|
+
return
|
|
93
|
+
}
|
|
94
|
+
self.onWorkoutDidFinish = onWorkoutDidFinish
|
|
95
|
+
self.onWorkoutFailed = onWorkoutFailed
|
|
96
|
+
do{
|
|
97
|
+
let json = try stringJsonToDic(stringJSON: rawJson)
|
|
98
|
+
let assessment = try SMWorkout(FromJson: json)
|
|
99
|
+
try SMKitUIModel.startCustomAssessment(viewController: smkitUIViewController, assessment: assessment, delegate: self) { error in
|
|
100
|
+
onWorkoutFailed("startCustomAssessment Failed", error.localizedDescription, error)
|
|
101
|
+
}
|
|
102
|
+
}catch{
|
|
103
|
+
onWorkoutFailed("startCustomAssessment Failed", error.localizedDescription, error)
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
81
108
|
@objc(startWorkoutProgram:onWorkoutDidFinish:onWorkoutFailed:)
|
|
82
|
-
func startWorkoutProgram(
|
|
109
|
+
func startWorkoutProgram(rawJson:String, onWorkoutDidFinish: @escaping RCTPromiseResolveBlock, onWorkoutFailed:@escaping RCTPromiseRejectBlock){
|
|
83
110
|
self.onWorkoutDidFinish = onWorkoutDidFinish
|
|
84
111
|
self.onWorkoutFailed = onWorkoutFailed
|
|
85
112
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
113
|
+
DispatchQueue.main.async { [weak self] in
|
|
114
|
+
guard let self = self,
|
|
115
|
+
let smkitUIViewController = smkitUIViewController else {
|
|
116
|
+
onWorkoutFailed("StartWorkoutProgram Failed", "Failed to present view", nil)
|
|
117
|
+
return
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
guard let json = try? stringJsonToDic(stringJSON: rawJson),
|
|
121
|
+
let week = json["week"] as? Int,
|
|
122
|
+
let zone = json["bodyZone"] as? String,
|
|
123
|
+
let difficultyLevelRaw = json["difficultyLevel"] as? String,
|
|
124
|
+
let workoutDurationRaw = json["workoutDuration"] as? String,
|
|
125
|
+
let programID = json["programID"] as? String,
|
|
126
|
+
let bodyZone = BodyZone(rawValue: zone),
|
|
127
|
+
let difficultyLevel = WorkoutDifficulty(rawValue: difficultyLevelRaw),
|
|
128
|
+
let workoutDuration = WorkoutDuration(rawValue: workoutDurationRaw)
|
|
129
|
+
else {
|
|
130
|
+
onWorkoutFailed("StartWorkoutProgram Failed", "Invalid Workout Config", nil)
|
|
131
|
+
return
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
let config = WorkoutConfig(
|
|
135
|
+
week: week,
|
|
136
|
+
bodyZone: bodyZone,
|
|
137
|
+
difficultyLevel: difficultyLevel,
|
|
138
|
+
workoutDuration: workoutDuration,
|
|
139
|
+
programID: programID
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
SMKitUIModel.startWorkoutFromProgram(viewController: smkitUIViewController, workoutConfig: config, delegate: self) { error in
|
|
143
|
+
onWorkoutFailed("StartWorkoutProgram Failed", error.localizedDescription, error)
|
|
144
|
+
}
|
|
114
145
|
}
|
|
115
146
|
}
|
|
147
|
+
private func stringJsonToDic(stringJSON:String) throws -> [String:Any]{
|
|
148
|
+
guard let data = stringJSON.data(using: .utf8),
|
|
149
|
+
let json = try JSONSerialization.jsonObject(with: data) as? [String:Any]
|
|
150
|
+
else { return [:] }
|
|
151
|
+
return json
|
|
152
|
+
}
|
|
116
153
|
|
|
117
154
|
override class func requiresMainQueueSetup() -> Bool {
|
|
118
155
|
true
|
|
@@ -129,19 +166,19 @@ extension SMKitUIManager:SMKitUIWorkoutDelegate{
|
|
|
129
166
|
SMKitUIModel.exitSDK()
|
|
130
167
|
}
|
|
131
168
|
|
|
132
|
-
func didExitWorkout(data: WorkoutSummaryData) {
|
|
169
|
+
func didExitWorkout(data: WorkoutSummaryData?) {
|
|
133
170
|
sendResult(data: data, didFinish: false)
|
|
134
171
|
SMKitUIModel.exitSDK()
|
|
135
172
|
}
|
|
136
173
|
|
|
137
|
-
func sendResult(data: WorkoutSummaryData
|
|
174
|
+
func sendResult(data: WorkoutSummaryData?, didFinish:Bool){
|
|
138
175
|
guard let onWorkoutDidFinish = self.onWorkoutDidFinish else {
|
|
139
176
|
onWorkoutFailed?("Unable to create summary", "Missing callback" , nil)
|
|
140
177
|
return
|
|
141
178
|
}
|
|
142
179
|
do{
|
|
143
180
|
let result:[String:Any] = [
|
|
144
|
-
"summary": try data
|
|
181
|
+
"summary": try data?.toStringJson() ?? "",
|
|
145
182
|
"didFinish": didFinish
|
|
146
183
|
]
|
|
147
184
|
onWorkoutDidFinish(result)
|
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.WorkoutDuration = exports.WorkoutDifficulty = exports.WorkoutConfig = exports.UIElement = exports.SMWorkout = exports.SMScoringParams = exports.SMExercise = exports.BodyZone = exports.AssessmentTypes = void 0;
|
|
6
|
+
exports.WorkoutDuration = exports.WorkoutDifficulty = exports.WorkoutConfig = exports.UIElement = exports.ScoringType = exports.SMWorkout = exports.SMScoringParams = exports.SMExercise = exports.BodyZone = exports.AssessmentTypes = void 0;
|
|
7
7
|
let AssessmentTypes = exports.AssessmentTypes = /*#__PURE__*/function (AssessmentTypes) {
|
|
8
8
|
AssessmentTypes["Fitness"] = "fitness";
|
|
9
9
|
AssessmentTypes["Custom"] = "custom";
|
|
10
|
+
AssessmentTypes["Body360"] = "body360";
|
|
10
11
|
return AssessmentTypes;
|
|
11
12
|
}({});
|
|
12
13
|
let UIElement = exports.UIElement = /*#__PURE__*/function (UIElement) {
|
|
@@ -32,6 +33,12 @@ let WorkoutDuration = exports.WorkoutDuration = /*#__PURE__*/function (WorkoutDu
|
|
|
32
33
|
WorkoutDuration["Long"] = "Long";
|
|
33
34
|
return WorkoutDuration;
|
|
34
35
|
}({});
|
|
36
|
+
let ScoringType = exports.ScoringType = /*#__PURE__*/function (ScoringType) {
|
|
37
|
+
ScoringType["Rom"] = "rom";
|
|
38
|
+
ScoringType["Time"] = "time";
|
|
39
|
+
ScoringType["Reps"] = "reps";
|
|
40
|
+
return ScoringType;
|
|
41
|
+
}({});
|
|
35
42
|
class SMWorkout {
|
|
36
43
|
constructor(id, name, workoutIntro, soundtrack, exercises, getInFrame, bodycalFinished, workoutClosure) {
|
|
37
44
|
this.id = id || null;
|
|
@@ -58,15 +65,13 @@ class SMWorkout {
|
|
|
58
65
|
}
|
|
59
66
|
exports.SMWorkout = SMWorkout;
|
|
60
67
|
class SMExercise {
|
|
61
|
-
constructor(prettyName, totalSeconds,
|
|
68
|
+
constructor(prettyName, totalSeconds, videoInstruction, exerciseIntro, uiElements, detector, exerciseClosure, scoringParams) {
|
|
62
69
|
this.prettyName = prettyName || null;
|
|
63
70
|
this.totalSeconds = totalSeconds || null;
|
|
64
|
-
this.introSeconds = introSeconds || null;
|
|
65
71
|
this.videoInstruction = videoInstruction || null;
|
|
66
72
|
this.exerciseIntro = exerciseIntro || null;
|
|
67
73
|
this.uiElements = uiElements || null;
|
|
68
74
|
this.detector = detector;
|
|
69
|
-
this.repBased = repBased || null;
|
|
70
75
|
this.exerciseClosure = exerciseClosure || null;
|
|
71
76
|
this.scoringParams = scoringParams || null;
|
|
72
77
|
}
|
|
@@ -91,6 +96,15 @@ class WorkoutConfig {
|
|
|
91
96
|
this.workoutDuration = workoutDuration;
|
|
92
97
|
this.programID = programID;
|
|
93
98
|
}
|
|
99
|
+
toJson() {
|
|
100
|
+
return JSON.stringify({
|
|
101
|
+
week: this.week,
|
|
102
|
+
bodyZone: this.bodyZone,
|
|
103
|
+
difficultyLevel: this.difficultyLevel,
|
|
104
|
+
workoutDuration: this.workoutDuration,
|
|
105
|
+
programID: this.programID
|
|
106
|
+
});
|
|
107
|
+
}
|
|
94
108
|
}
|
|
95
109
|
exports.WorkoutConfig = WorkoutConfig;
|
|
96
110
|
//# sourceMappingURL=SMWorkout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["AssessmentTypes","exports","UIElement","BodyZone","WorkoutDifficulty","WorkoutDuration","SMWorkout","constructor","id","name","workoutIntro","soundtrack","exercises","getInFrame","bodycalFinished","workoutClosure","toJson","JSON","stringify","SMExercise","prettyName","totalSeconds","
|
|
1
|
+
{"version":3,"names":["AssessmentTypes","exports","UIElement","BodyZone","WorkoutDifficulty","WorkoutDuration","ScoringType","SMWorkout","constructor","id","name","workoutIntro","soundtrack","exercises","getInFrame","bodycalFinished","workoutClosure","toJson","JSON","stringify","SMExercise","prettyName","totalSeconds","videoInstruction","exerciseIntro","uiElements","detector","exerciseClosure","scoringParams","SMScoringParams","type","scoreFactor","targetTime","targetReps","targetRom","passCriteria","WorkoutConfig","week","bodyZone","difficultyLevel","workoutDuration","programID"],"sourceRoot":"../../src","sources":["SMWorkout.tsx"],"mappings":";;;;;;IAAYA,eAAe,GAAAC,OAAA,CAAAD,eAAA,0BAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAA,OAAfA,eAAe;AAAA;AAAA,IAMfE,SAAS,GAAAD,OAAA,CAAAC,SAAA,0BAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAAA,OAATA,SAAS;AAAA;AAAA,IAMTC,QAAQ,GAAAF,OAAA,CAAAE,QAAA,0BAARA,QAAQ;E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Y,IAAI,IAAI;EAC1C;AACF;AAAClC,OAAA,CAAA4B,eAAA,GAAAA,eAAA;AAEM,MAAMO,aAAa,CAAC;EAOzB5B,WAAWA,CACT6B,IAAY,EACZC,QAAkB,EAClBC,eAAkC,EAClCC,eAAgC,EAChCC,SAAiB,EACjB;IACA,IAAI,CAACJ,IAAI,GAAGA,IAAI;IAChB,IAAI,CAACC,QAAQ,GAAGA,QAAQ;IACxB,IAAI,CAACC,eAAe,GAAGA,eAAe;IACtC,IAAI,CAACC,eAAe,GAAGA,eAAe;IACtC,IAAI,CAACC,SAAS,GAAGA,SAAS;EAC5B;EAEAxB,MAAMA,CAAA,EAAW;IACf,OAAOC,IAAI,CAACC,SAAS,CAAC;MACpBkB,IAAI,EAAE,IAAI,CAACA,IAAI;MACfC,QAAQ,EAAE,IAAI,CAACA,QAAQ;MACvBC,eAAe,EAAE,IAAI,CAACA,eAAe;MACrCC,eAAe,EAAE,IAAI,CAACA,eAAe;MACrCC,SAAS,EAAE,IAAI,CAACA;IAClB,CAAC,CAAC;EACJ;AACF;AAACxC,OAAA,CAAAmC,aAAA,GAAAA,aAAA","ignoreList":[]}
|
package/lib/commonjs/index.js
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.AssessmentTypes = void 0;
|
|
7
6
|
exports.configure = configure;
|
|
8
7
|
exports.startAssessment = startAssessment;
|
|
8
|
+
exports.startCustomAssessment = startCustomAssessment;
|
|
9
9
|
exports.startCustomWorkout = startCustomWorkout;
|
|
10
10
|
exports.startWorkoutProgram = startWorkoutProgram;
|
|
11
11
|
var _reactNative = require("react-native");
|
|
@@ -25,17 +25,12 @@ function startAssessment(type, showSummary, customAssessmentID) {
|
|
|
25
25
|
return SMKitUIManager.startAssessment(type, showSummary, customAssessmentID);
|
|
26
26
|
}
|
|
27
27
|
function startCustomWorkout(workout) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return SMKitUIManager.
|
|
28
|
+
return SMKitUIManager.startCustomWorkout(workout.toJson());
|
|
29
|
+
}
|
|
30
|
+
function startCustomAssessment(assessment) {
|
|
31
|
+
return SMKitUIManager.startCustomAssessment(assessment.toJson());
|
|
32
32
|
}
|
|
33
33
|
function startWorkoutProgram(workoutConfig) {
|
|
34
|
-
return SMKitUIManager.startWorkoutProgram(workoutConfig);
|
|
34
|
+
return SMKitUIManager.startWorkoutProgram(workoutConfig.toJson());
|
|
35
35
|
}
|
|
36
|
-
let AssessmentTypes = exports.AssessmentTypes = /*#__PURE__*/function (AssessmentTypes) {
|
|
37
|
-
AssessmentTypes["Fitness"] = "fitness";
|
|
38
|
-
AssessmentTypes["Custom"] = "custom";
|
|
39
|
-
return AssessmentTypes;
|
|
40
|
-
}({});
|
|
41
36
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","LINKING_ERROR","Platform","select","ios","default","SMKitUIManager","NativeModules","Proxy","get","Error","configure","key","startAssessment","type","showSummary","customAssessmentID","startCustomWorkout","workout","
|
|
1
|
+
{"version":3,"names":["_reactNative","require","LINKING_ERROR","Platform","select","ios","default","SMKitUIManager","NativeModules","Proxy","get","Error","configure","key","startAssessment","type","showSummary","customAssessmentID","startCustomWorkout","workout","toJson","startCustomAssessment","assessment","startWorkoutProgram","workoutConfig"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAGA,MAAMC,aAAa,GAChB,gFAA+E,GAChFC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,cAAc,GAAGC,0BAAa,CAACD,cAAc,GAC/CC,0BAAa,CAACD,cAAc,GAC5B,IAAIE,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACT,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAEE,SAASU,SAASA,CAACC,GAAW,EAAmB;EACtD,OAAON,cAAc,CAACK,SAAS,CAACC,GAAG,CAAC;AACtC;AAEO,SAASC,eAAeA,CAC7BC,IAAsC,EACtCC,WAAoB,EACpBC,kBAA0B,EACwB;EAClD,OAAOV,cAAc,CAACO,eAAe,CAACC,IAAI,EAAEC,WAAW,EAAEC,kBAAkB,CAAC;AAC9E;AAEO,SAASC,kBAAkBA,CAACC,OAAkC,EAAgD;EACnH,OAAOZ,cAAc,CAACW,kBAAkB,CAACC,OAAO,CAACC,MAAM,CAAC,CAAC,CAAC;AAC5D;AAEO,SAASC,qBAAqBA,CAACC,UAAqC,EAAgD;EACzH,OAAOf,cAAc,CAACc,qBAAqB,CAACC,UAAU,CAACF,MAAM,CAAC,CAAC,CAAC;AAClE;AAEO,SAASG,mBAAmBA,CAACC,aAA4C,EAAgD;EAC9H,OAAOjB,cAAc,CAACgB,mBAAmB,CAACC,aAAa,CAACJ,MAAM,CAAC,CAAC,CAAC;AACnE","ignoreList":[]}
|
package/lib/module/SMWorkout.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export let AssessmentTypes = /*#__PURE__*/function (AssessmentTypes) {
|
|
2
2
|
AssessmentTypes["Fitness"] = "fitness";
|
|
3
3
|
AssessmentTypes["Custom"] = "custom";
|
|
4
|
+
AssessmentTypes["Body360"] = "body360";
|
|
4
5
|
return AssessmentTypes;
|
|
5
6
|
}({});
|
|
6
7
|
export let UIElement = /*#__PURE__*/function (UIElement) {
|
|
@@ -26,6 +27,12 @@ export let WorkoutDuration = /*#__PURE__*/function (WorkoutDuration) {
|
|
|
26
27
|
WorkoutDuration["Long"] = "Long";
|
|
27
28
|
return WorkoutDuration;
|
|
28
29
|
}({});
|
|
30
|
+
export let ScoringType = /*#__PURE__*/function (ScoringType) {
|
|
31
|
+
ScoringType["Rom"] = "rom";
|
|
32
|
+
ScoringType["Time"] = "time";
|
|
33
|
+
ScoringType["Reps"] = "reps";
|
|
34
|
+
return ScoringType;
|
|
35
|
+
}({});
|
|
29
36
|
export class SMWorkout {
|
|
30
37
|
constructor(id, name, workoutIntro, soundtrack, exercises, getInFrame, bodycalFinished, workoutClosure) {
|
|
31
38
|
this.id = id || null;
|
|
@@ -51,15 +58,13 @@ export class SMWorkout {
|
|
|
51
58
|
}
|
|
52
59
|
}
|
|
53
60
|
export class SMExercise {
|
|
54
|
-
constructor(prettyName, totalSeconds,
|
|
61
|
+
constructor(prettyName, totalSeconds, videoInstruction, exerciseIntro, uiElements, detector, exerciseClosure, scoringParams) {
|
|
55
62
|
this.prettyName = prettyName || null;
|
|
56
63
|
this.totalSeconds = totalSeconds || null;
|
|
57
|
-
this.introSeconds = introSeconds || null;
|
|
58
64
|
this.videoInstruction = videoInstruction || null;
|
|
59
65
|
this.exerciseIntro = exerciseIntro || null;
|
|
60
66
|
this.uiElements = uiElements || null;
|
|
61
67
|
this.detector = detector;
|
|
62
|
-
this.repBased = repBased || null;
|
|
63
68
|
this.exerciseClosure = exerciseClosure || null;
|
|
64
69
|
this.scoringParams = scoringParams || null;
|
|
65
70
|
}
|
|
@@ -82,5 +87,14 @@ export class WorkoutConfig {
|
|
|
82
87
|
this.workoutDuration = workoutDuration;
|
|
83
88
|
this.programID = programID;
|
|
84
89
|
}
|
|
90
|
+
toJson() {
|
|
91
|
+
return JSON.stringify({
|
|
92
|
+
week: this.week,
|
|
93
|
+
bodyZone: this.bodyZone,
|
|
94
|
+
difficultyLevel: this.difficultyLevel,
|
|
95
|
+
workoutDuration: this.workoutDuration,
|
|
96
|
+
programID: this.programID
|
|
97
|
+
});
|
|
98
|
+
}
|
|
85
99
|
}
|
|
86
100
|
//# sourceMappingURL=SMWorkout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["AssessmentTypes","UIElement","BodyZone","WorkoutDifficulty","WorkoutDuration","SMWorkout","constructor","id","name","workoutIntro","soundtrack","exercises","getInFrame","bodycalFinished","workoutClosure","toJson","JSON","stringify","SMExercise","prettyName","totalSeconds","
|
|
1
|
+
{"version":3,"names":["AssessmentTypes","UIElement","BodyZone","WorkoutDifficulty","WorkoutDuration","ScoringType","SMWorkout","constructor","id","name","workoutIntro","soundtrack","exercises","getInFrame","bodycalFinished","workoutClosure","toJson","JSON","stringify","SMExercise","prettyName","totalSeconds","videoInstruction","exerciseIntro","uiElements","detector","exerciseClosure","scoringParams","SMScoringParams","type","scoreFactor","targetTime","targetReps","targetRom","passCriteria","WorkoutConfig","week","bodyZone","difficultyLevel","workoutDuration","programID"],"sourceRoot":"../../src","sources":["SMWorkout.tsx"],"mappings":"AAAA,WAAYA,eAAe,0BAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAA,OAAfA,eAAe;AAAA;AAM3B,WAAYC,SAAS,0BAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAAA,OAATA,SAAS;AAAA;AAMrB,WAAYC,QAAQ,0BAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAAA,OAARA,QAAQ;AAAA;AAMpB,WAAYC,iBAAiB,0BAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAA,OAAjBA,iBAAiB;AAAA;AAM7B,WAAYC,eAAe,0BAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAA,OAAfA,eAAe;AAAA;AAK3B,WAAYC,WAAW,0BAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAA,OAAXA,WAAW;AAAA;AAMvB,OAAO,MAAMC,SAAS,CAAC;EAUrBC,WAAWA,CACTC,EAAiB,EACjBC,IAAmB,EACnBC,YAA2B,EAC3BC,UAAyB,EACzBC,SAAuB,EACvBC,UAAyB,EACzBC,eAA8B,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 -15,17 +15,12 @@ export function startAssessment(type, showSummary, customAssessmentID) {
|
|
|
15
15
|
return SMKitUIManager.startAssessment(type, showSummary, customAssessmentID);
|
|
16
16
|
}
|
|
17
17
|
export function startCustomWorkout(workout) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return SMKitUIManager.
|
|
18
|
+
return SMKitUIManager.startCustomWorkout(workout.toJson());
|
|
19
|
+
}
|
|
20
|
+
export function startCustomAssessment(assessment) {
|
|
21
|
+
return SMKitUIManager.startCustomAssessment(assessment.toJson());
|
|
22
22
|
}
|
|
23
23
|
export function startWorkoutProgram(workoutConfig) {
|
|
24
|
-
return SMKitUIManager.startWorkoutProgram(workoutConfig);
|
|
24
|
+
return SMKitUIManager.startWorkoutProgram(workoutConfig.toJson());
|
|
25
25
|
}
|
|
26
|
-
export let AssessmentTypes = /*#__PURE__*/function (AssessmentTypes) {
|
|
27
|
-
AssessmentTypes["Fitness"] = "fitness";
|
|
28
|
-
AssessmentTypes["Custom"] = "custom";
|
|
29
|
-
return AssessmentTypes;
|
|
30
|
-
}({});
|
|
31
26
|
//# sourceMappingURL=index.js.map
|
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","customAssessmentID","startCustomWorkout","workout","
|
|
1
|
+
{"version":3,"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default","SMKitUIManager","Proxy","get","Error","configure","key","startAssessment","type","showSummary","customAssessmentID","startCustomWorkout","workout","toJson","startCustomAssessment","assessment","startWorkoutProgram","workoutConfig"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAGtD,MAAMC,aAAa,GAChB,gFAA+E,GAChFD,QAAQ,CAACE,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,cAAc,GAAGN,aAAa,CAACM,cAAc,GAC/CN,aAAa,CAACM,cAAc,GAC5B,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACP,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAEL,OAAO,SAASQ,SAASA,CAACC,GAAW,EAAmB;EACtD,OAAOL,cAAc,CAACI,SAAS,CAACC,GAAG,CAAC;AACtC;AAEA,OAAO,SAASC,eAAeA,CAC7BC,IAAsC,EACtCC,WAAoB,EACpBC,kBAA0B,EACwB;EAClD,OAAOT,cAAc,CAACM,eAAe,CAACC,IAAI,EAAEC,WAAW,EAAEC,kBAAkB,CAAC;AAC9E;AAEA,OAAO,SAASC,kBAAkBA,CAACC,OAAkC,EAAgD;EACnH,OAAOX,cAAc,CAACU,kBAAkB,CAACC,OAAO,CAACC,MAAM,CAAC,CAAC,CAAC;AAC5D;AAEA,OAAO,SAASC,qBAAqBA,CAACC,UAAqC,EAAgD;EACzH,OAAOd,cAAc,CAACa,qBAAqB,CAACC,UAAU,CAACF,MAAM,CAAC,CAAC,CAAC;AAClE;AAEA,OAAO,SAASG,mBAAmBA,CAACC,aAA4C,EAAgD;EAC9H,OAAOhB,cAAc,CAACe,mBAAmB,CAACC,aAAa,CAACJ,MAAM,CAAC,CAAC,CAAC;AACnE","ignoreList":[]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export declare enum AssessmentTypes {
|
|
2
2
|
Fitness = "fitness",
|
|
3
|
-
Custom = "custom"
|
|
3
|
+
Custom = "custom",
|
|
4
|
+
Body360 = "body360"
|
|
4
5
|
}
|
|
5
6
|
export declare enum UIElement {
|
|
6
7
|
RepsCounter = "repsCounter",
|
|
@@ -21,6 +22,11 @@ export declare enum WorkoutDuration {
|
|
|
21
22
|
Short = "Short",
|
|
22
23
|
Long = "Long"
|
|
23
24
|
}
|
|
25
|
+
export declare enum ScoringType {
|
|
26
|
+
Rom = "rom",
|
|
27
|
+
Time = "time",
|
|
28
|
+
Reps = "reps"
|
|
29
|
+
}
|
|
24
30
|
export declare class SMWorkout {
|
|
25
31
|
id: string | null;
|
|
26
32
|
name: string | null;
|
|
@@ -36,24 +42,22 @@ export declare class SMWorkout {
|
|
|
36
42
|
export declare class SMExercise {
|
|
37
43
|
detector: string;
|
|
38
44
|
uiElements: UIElement[] | null;
|
|
39
|
-
repBased: boolean | null;
|
|
40
45
|
videoInstruction: string | null;
|
|
41
|
-
introSeconds: number | null;
|
|
42
46
|
totalSeconds: number | null;
|
|
43
47
|
prettyName: string | null;
|
|
44
48
|
exerciseIntro: string | null;
|
|
45
49
|
exerciseClosure: string | null;
|
|
46
50
|
scoringParams: SMScoringParams | null;
|
|
47
|
-
constructor(prettyName: string | null, totalSeconds: number | null,
|
|
51
|
+
constructor(prettyName: string | null, totalSeconds: number | null, videoInstruction: string | null, exerciseIntro: string | null, uiElements: UIElement[] | null, detector: string, exerciseClosure: string | null, scoringParams: SMScoringParams | null);
|
|
48
52
|
}
|
|
49
53
|
export declare class SMScoringParams {
|
|
50
|
-
type:
|
|
54
|
+
type: ScoringType | null;
|
|
51
55
|
scoreFactor: number | null;
|
|
52
56
|
targetTime: number | null;
|
|
53
57
|
targetReps: number | null;
|
|
54
58
|
targetRom: string | null;
|
|
55
59
|
passCriteria: string[] | null;
|
|
56
|
-
constructor(type:
|
|
60
|
+
constructor(type: ScoringType | null, scoreFactor: number | null, targetTime: number | null, targetReps: number | null, targetRom: string | null, passCriteria: string[] | null);
|
|
57
61
|
}
|
|
58
62
|
export declare class WorkoutConfig {
|
|
59
63
|
week: number;
|
|
@@ -62,5 +66,6 @@ export declare class WorkoutConfig {
|
|
|
62
66
|
workoutDuration: WorkoutDuration;
|
|
63
67
|
programID: string;
|
|
64
68
|
constructor(week: number, bodyZone: BodyZone, difficultyLevel: WorkoutDifficulty, workoutDuration: WorkoutDuration, programID: string);
|
|
69
|
+
toJson(): string;
|
|
65
70
|
}
|
|
66
71
|
//# sourceMappingURL=SMWorkout.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SMWorkout.d.ts","sourceRoot":"","sources":["../../../src/SMWorkout.tsx"],"names":[],"mappings":"AAAA,oBAAY,eAAe;IACzB,OAAO,YAAY;IACnB,MAAM,WAAW;
|
|
1
|
+
{"version":3,"file":"SMWorkout.d.ts","sourceRoot":"","sources":["../../../src/SMWorkout.tsx"],"names":[],"mappings":"AAAA,oBAAY,eAAe;IACzB,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,OAAO,YAAY;CACpB;AAED,oBAAY,SAAS;IACnB,WAAW,gBAAgB;IAC3B,KAAK,UAAU;IACf,aAAa,kBAAkB;CAChC;AAED,oBAAY,QAAQ;IAClB,SAAS,cAAc;IACvB,SAAS,cAAc;IACvB,QAAQ,aAAa;CACtB;AAED,oBAAY,iBAAiB;IAC3B,aAAa,kBAAkB;IAC/B,aAAa,kBAAkB;IAC/B,cAAc,mBAAmB;CAClC;AAED,oBAAY,eAAe;IACzB,KAAK,UAAU;IACf,IAAI,SAAS;CACd;AAED,oBAAY,WAAW;IACrB,GAAG,QAAQ;IACX,IAAI,SAAS;IACb,IAAI,SAAS;CACd;AAED,qBAAa,SAAS;IACpB,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAClB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,SAAS,EAAE,UAAU,EAAE,CAAC;IACxB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;gBAG5B,EAAE,EAAE,MAAM,GAAG,IAAI,EACjB,IAAI,E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AAW,GAAG,IAAI,EACxB,WAAW,EAAE,MAAM,GAAG,IAAI,EAC1B,UAAU,EAAE,MAAM,GAAG,IAAI,EACzB,UAAU,EAAE,MAAM,GAAG,IAAI,EACzB,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,YAAY,EAAE,MAAM,EAAE,GAAG,IAAI;CAShC;AAED,qBAAa,aAAa;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,QAAQ,CAAC;IACnB,eAAe,EAAE,iBAAiB,CAAC;IACnC,eAAe,EAAE,eAAe,CAAC;IACjC,SAAS,EAAE,MAAM,CAAC;gBAGhB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,QAAQ,EAClB,eAAe,EAAE,iBAAiB,EAClC,eAAe,EAAE,eAAe,EAChC,SAAS,EAAE,MAAM;IASnB,MAAM,IAAI,MAAM;CASjB"}
|
|
@@ -8,12 +8,12 @@ export declare function startCustomWorkout(workout: SMWorkoutLibrary.SMWorkout):
|
|
|
8
8
|
summary: string;
|
|
9
9
|
didFinish: boolean;
|
|
10
10
|
}>;
|
|
11
|
+
export declare function startCustomAssessment(assessment: SMWorkoutLibrary.SMWorkout): Promise<{
|
|
12
|
+
summary: string;
|
|
13
|
+
didFinish: boolean;
|
|
14
|
+
}>;
|
|
11
15
|
export declare function startWorkoutProgram(workoutConfig: SMWorkoutLibrary.WorkoutConfig): Promise<{
|
|
12
16
|
summary: string;
|
|
13
17
|
didFinish: boolean;
|
|
14
18
|
}>;
|
|
15
|
-
export declare enum AssessmentTypes {
|
|
16
|
-
Fitness = "fitness",
|
|
17
|
-
Custom = "custom"
|
|
18
|
-
}
|
|
19
19
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,gBAAgB,MAAM,kBAAkB,CAAC;AAmBrD,wBAAgB,SAAS,CAAC,GAAG,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AM,CAAC;IAAC,SAAS,EAAC,OAAO,CAAA;CAAC,CAAC,CAE/H"}
|
package/package.json
CHANGED
|
@@ -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" ,'0.2.
|
|
18
|
+
s.dependency "SMKitUI" ,'0.2.4'
|
|
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/SMWorkout.tsx
CHANGED
|
@@ -1,124 +1,166 @@
|
|
|
1
|
-
export enum AssessmentTypes{
|
|
2
|
-
Fitness =
|
|
3
|
-
Custom =
|
|
1
|
+
export enum AssessmentTypes {
|
|
2
|
+
Fitness = 'fitness',
|
|
3
|
+
Custom = 'custom',
|
|
4
|
+
Body360 = 'body360',
|
|
4
5
|
}
|
|
5
6
|
|
|
6
|
-
export enum UIElement{
|
|
7
|
-
RepsCounter =
|
|
8
|
-
Timer =
|
|
9
|
-
GaugeOfMotion =
|
|
7
|
+
export enum UIElement {
|
|
8
|
+
RepsCounter = 'repsCounter',
|
|
9
|
+
Timer = 'timer',
|
|
10
|
+
GaugeOfMotion = 'gaugeOfMotion',
|
|
10
11
|
}
|
|
11
12
|
|
|
12
|
-
export enum BodyZone{
|
|
13
|
-
UpperBody =
|
|
14
|
-
LowerBody =
|
|
15
|
-
FullBody =
|
|
13
|
+
export enum BodyZone {
|
|
14
|
+
UpperBody = 'UpperBody',
|
|
15
|
+
LowerBody = 'LowerBody',
|
|
16
|
+
FullBody = 'FullBody',
|
|
16
17
|
}
|
|
17
18
|
|
|
18
|
-
export enum WorkoutDifficulty{
|
|
19
|
-
LowDifficulty =
|
|
20
|
-
MidDifficulty =
|
|
21
|
-
HighDifficulty =
|
|
19
|
+
export enum WorkoutDifficulty {
|
|
20
|
+
LowDifficulty = 'LowDifficulty',
|
|
21
|
+
MidDifficulty = 'MidDifficulty',
|
|
22
|
+
HighDifficulty = 'HighDifficulty',
|
|
22
23
|
}
|
|
23
24
|
|
|
24
|
-
export enum WorkoutDuration{
|
|
25
|
-
Short =
|
|
26
|
-
Long =
|
|
25
|
+
export enum WorkoutDuration {
|
|
26
|
+
Short = 'Short',
|
|
27
|
+
Long = 'Long',
|
|
27
28
|
}
|
|
28
29
|
|
|
29
|
-
export
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
30
|
+
export enum ScoringType {
|
|
31
|
+
Rom = 'rom',
|
|
32
|
+
Time = 'time',
|
|
33
|
+
Reps = 'reps',
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export class SMWorkout {
|
|
37
|
+
id: string | null;
|
|
38
|
+
name: string | null;
|
|
39
|
+
workoutIntro: string | null;
|
|
40
|
+
soundtrack: string | null;
|
|
41
|
+
exercises: SMExercise[];
|
|
42
|
+
getInFrame: string | null;
|
|
43
|
+
bodycalFinished: string | null;
|
|
44
|
+
workoutClosure: string | null;
|
|
38
45
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
constructor(
|
|
47
|
+
id: string | null,
|
|
48
|
+
name: string | null,
|
|
49
|
+
workoutIntro: string | null,
|
|
50
|
+
soundtrack: string | null,
|
|
51
|
+
exercises: SMExercise[],
|
|
52
|
+
getInFrame: string | null,
|
|
53
|
+
bodycalFinished: string | null,
|
|
54
|
+
workoutClosure: string | null
|
|
55
|
+
) {
|
|
56
|
+
this.id = id || null;
|
|
57
|
+
this.name = name || null;
|
|
58
|
+
this.workoutIntro = workoutIntro || null;
|
|
59
|
+
this.soundtrack = soundtrack || null;
|
|
60
|
+
this.exercises = exercises;
|
|
61
|
+
this.getInFrame = getInFrame || null;
|
|
62
|
+
this.bodycalFinished = bodycalFinished || null;
|
|
63
|
+
this.workoutClosure = workoutClosure || null;
|
|
64
|
+
}
|
|
49
65
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
66
|
+
toJson(): string {
|
|
67
|
+
return JSON.stringify({
|
|
68
|
+
id: this.id,
|
|
69
|
+
name: this.name,
|
|
70
|
+
workoutIntro: this.workoutIntro,
|
|
71
|
+
soundtrack: this.soundtrack,
|
|
72
|
+
exercises: this.exercises,
|
|
73
|
+
getInFrame: this.getInFrame,
|
|
74
|
+
bodycalFinished: this.bodycalFinished,
|
|
75
|
+
workoutClosure: this.workoutClosure,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
62
78
|
}
|
|
63
79
|
|
|
64
|
-
export class SMExercise{
|
|
80
|
+
export class SMExercise {
|
|
65
81
|
detector: string;
|
|
66
82
|
uiElements: UIElement[] | null;
|
|
67
|
-
repBased: boolean | null;
|
|
68
83
|
videoInstruction: string | null;
|
|
69
|
-
introSeconds: number | null;
|
|
70
84
|
totalSeconds: number | null;
|
|
71
|
-
prettyName:string | null;
|
|
85
|
+
prettyName: string | null;
|
|
72
86
|
exerciseIntro: string | null;
|
|
73
87
|
exerciseClosure: string | null;
|
|
74
88
|
scoringParams: SMScoringParams | null;
|
|
75
|
-
|
|
76
89
|
|
|
77
|
-
constructor(
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
90
|
+
constructor(
|
|
91
|
+
prettyName: string | null,
|
|
92
|
+
totalSeconds: number | null,
|
|
93
|
+
videoInstruction: string | null,
|
|
94
|
+
exerciseIntro: string | null,
|
|
95
|
+
uiElements: UIElement[] | null,
|
|
96
|
+
detector: string,
|
|
97
|
+
exerciseClosure: string | null,
|
|
98
|
+
scoringParams: SMScoringParams | null
|
|
99
|
+
) {
|
|
100
|
+
this.prettyName = prettyName || null;
|
|
101
|
+
this.totalSeconds = totalSeconds || null;
|
|
102
|
+
this.videoInstruction = videoInstruction || null;
|
|
103
|
+
this.exerciseIntro = exerciseIntro || null;
|
|
104
|
+
this.uiElements = uiElements || null;
|
|
105
|
+
this.detector = detector;
|
|
86
106
|
this.exerciseClosure = exerciseClosure || null;
|
|
87
107
|
this.scoringParams = scoringParams || null;
|
|
88
108
|
}
|
|
89
109
|
}
|
|
90
110
|
|
|
91
111
|
export class SMScoringParams {
|
|
92
|
-
type:
|
|
112
|
+
type: ScoringType | null;
|
|
93
113
|
scoreFactor: number | null;
|
|
94
114
|
targetTime: number | null;
|
|
95
115
|
targetReps: number | null;
|
|
96
116
|
targetRom: string | null;
|
|
97
117
|
passCriteria: string[] | null;
|
|
98
118
|
|
|
99
|
-
constructor(
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
119
|
+
constructor(
|
|
120
|
+
type: ScoringType | null,
|
|
121
|
+
scoreFactor: number | null,
|
|
122
|
+
targetTime: number | null,
|
|
123
|
+
targetReps: number | null,
|
|
124
|
+
targetRom: string | null,
|
|
125
|
+
passCriteria: string[] | null
|
|
126
|
+
) {
|
|
127
|
+
this.type = type || null;
|
|
128
|
+
this.scoreFactor = scoreFactor || null;
|
|
129
|
+
this.targetTime = targetTime || null;
|
|
130
|
+
this.targetReps = targetReps || null;
|
|
131
|
+
this.targetRom = targetRom || null;
|
|
132
|
+
this.passCriteria = passCriteria || null;
|
|
106
133
|
}
|
|
107
|
-
|
|
108
134
|
}
|
|
109
135
|
|
|
110
|
-
export class WorkoutConfig{
|
|
136
|
+
export class WorkoutConfig {
|
|
111
137
|
week: number;
|
|
112
138
|
bodyZone: BodyZone;
|
|
113
139
|
difficultyLevel: WorkoutDifficulty;
|
|
114
140
|
workoutDuration: WorkoutDuration;
|
|
115
141
|
programID: string;
|
|
116
142
|
|
|
117
|
-
constructor(
|
|
143
|
+
constructor(
|
|
144
|
+
week: number,
|
|
145
|
+
bodyZone: BodyZone,
|
|
146
|
+
difficultyLevel: WorkoutDifficulty,
|
|
147
|
+
workoutDuration: WorkoutDuration,
|
|
148
|
+
programID: string
|
|
149
|
+
) {
|
|
118
150
|
this.week = week;
|
|
119
151
|
this.bodyZone = bodyZone;
|
|
120
152
|
this.difficultyLevel = difficultyLevel;
|
|
121
153
|
this.workoutDuration = workoutDuration;
|
|
122
154
|
this.programID = programID;
|
|
123
155
|
}
|
|
124
|
-
|
|
156
|
+
|
|
157
|
+
toJson(): string {
|
|
158
|
+
return JSON.stringify({
|
|
159
|
+
week: this.week,
|
|
160
|
+
bodyZone: this.bodyZone,
|
|
161
|
+
difficultyLevel: this.difficultyLevel,
|
|
162
|
+
workoutDuration: this.workoutDuration,
|
|
163
|
+
programID: this.programID
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
}
|
package/src/index.tsx
CHANGED
|
@@ -31,17 +31,13 @@ export function startAssessment(
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
export function startCustomWorkout(workout:SMWorkoutLibrary.SMWorkout): Promise<{summary: string, didFinish:boolean}>{
|
|
34
|
-
|
|
35
|
-
return SMKitUIManager.startCustomWorkout(workout.toJson());
|
|
36
|
-
}
|
|
37
|
-
return SMKitUIManager.startCustomWorkout(workout);
|
|
34
|
+
return SMKitUIManager.startCustomWorkout(workout.toJson());
|
|
38
35
|
}
|
|
39
36
|
|
|
40
|
-
export function
|
|
41
|
-
return SMKitUIManager.
|
|
37
|
+
export function startCustomAssessment(assessment:SMWorkoutLibrary.SMWorkout): Promise<{summary: string, didFinish:boolean}>{
|
|
38
|
+
return SMKitUIManager.startCustomAssessment(assessment.toJson());
|
|
42
39
|
}
|
|
43
40
|
|
|
44
|
-
export
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
41
|
+
export function startWorkoutProgram(workoutConfig:SMWorkoutLibrary.WorkoutConfig): Promise<{summary: string, didFinish:boolean}>{
|
|
42
|
+
return SMKitUIManager.startWorkoutProgram(workoutConfig.toJson());
|
|
43
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../../../example/src/App.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAMxC,QAAA,MAAM,GAAG,yBAsJR,CAAA;AA4BD,eAAe,GAAG,CAAC"}
|