@sency/react-native-smkit-ui 0.2.3 → 0.2.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 +105 -146
- package/android/build.gradle +4 -1
- package/android/src/main/java/com/smkituilibrary/SmkitUiLibraryModule.kt +93 -5
- package/android/src/main/java/com/smkituilibrary/mapper/SMMapper.kt +52 -5
- package/android/src/main/java/com/smkituilibrary/model/WFPSummary.kt +49 -0
- package/android/src/main/java/com/smkituilibrary/serializers/Serializers.kt +182 -0
- package/ios/SMKitUIManager.swift +265 -228
- package/lib/typescript/example/src/App.d.ts.map +1 -1
- package/lib/typescript/example/src/components/EditText.d.ts +9 -0
- package/lib/typescript/example/src/components/EditText.d.ts.map +1 -0
- package/lib/typescript/example/src/components/ThreeCheckboxes.d.ts +7 -0
- package/lib/typescript/example/src/components/ThreeCheckboxes.d.ts.map +1 -0
- package/package.json +4 -1
- package/react-native-smkit-ui.podspec +1 -1
package/ios/SMKitUIManager.swift
CHANGED
|
@@ -4,254 +4,291 @@ import SMBase
|
|
|
4
4
|
|
|
5
5
|
@objc(SMKitUIManager)
|
|
6
6
|
class SMKitUIManager: RCTViewManager {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return nil
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
@objc(configure:onSuccess:onFailure:)
|
|
23
|
-
func configure(key:NSString, onSuccess: @escaping RCTPromiseResolveBlock,onFailure:@escaping RCTPromiseRejectBlock) -> Void {
|
|
24
|
-
var isConfigDone = false
|
|
25
|
-
var didFail = false
|
|
26
|
-
SMKitUIModel.configure(authKey: "\(key)") {
|
|
27
|
-
if !isConfigDone{
|
|
28
|
-
isConfigDone = true
|
|
29
|
-
onSuccess("")
|
|
30
|
-
}
|
|
31
|
-
} onFailure: { err in
|
|
32
|
-
if !didFail{
|
|
33
|
-
didFail = true
|
|
34
|
-
onFailure("Configure Failed", err?.localizedDescription ?? "", err)
|
|
35
|
-
}
|
|
36
|
-
}
|
|
7
|
+
|
|
8
|
+
var onWorkoutDidFinish:RCTPromiseResolveBlock?
|
|
9
|
+
var onWorkoutFailed:RCTPromiseRejectBlock?
|
|
10
|
+
|
|
11
|
+
var summaryData:WorkoutSummaryData?
|
|
12
|
+
var didCompleteWorkout = false
|
|
13
|
+
|
|
14
|
+
var didReciveSummary = false{
|
|
15
|
+
didSet{
|
|
16
|
+
if didReciveSummary && workoutDidEnd{
|
|
17
|
+
sendResult()
|
|
18
|
+
}
|
|
37
19
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
onWorkoutFailed("StartAssessment Failed", "Failed to present view", nil)
|
|
46
|
-
return
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
self.onWorkoutDidFinish = onWorkoutDidFinish
|
|
50
|
-
self.onWorkoutFailed = onWorkoutFailed
|
|
51
|
-
|
|
52
|
-
do{
|
|
53
|
-
let userData = try self.getUserData(rawJson: userData)
|
|
54
|
-
if let type = AssessmentTypes(rawValue: "\(type)"){
|
|
55
|
-
try SMKitUIModel.startAssessmet(
|
|
56
|
-
viewController: smkitUIViewController,
|
|
57
|
-
type: type,
|
|
58
|
-
customAssessmentID:customAssessmentID == "" ? nil : customAssessmentID,
|
|
59
|
-
userData: userData,
|
|
60
|
-
forceShowUserDataScreen: forceShowUserDataScreen,
|
|
61
|
-
showSummary: showSummary,
|
|
62
|
-
delegate: self){error in
|
|
63
|
-
onWorkoutFailed("StartAssessment Failed", error.localizedDescription, error)
|
|
64
|
-
}
|
|
65
|
-
}else{
|
|
66
|
-
onWorkoutFailed("StartAssessment Failed", "Invalid type", nil)
|
|
67
|
-
}
|
|
68
|
-
}catch{
|
|
69
|
-
onWorkoutFailed("StartAssessment Failed", error.localizedDescription, error)
|
|
70
|
-
}
|
|
71
|
-
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
var workoutDidEnd = false{
|
|
23
|
+
didSet{
|
|
24
|
+
if didReciveSummary && workoutDidEnd{
|
|
25
|
+
sendResult()
|
|
26
|
+
}
|
|
72
27
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
self.onWorkoutDidFinish = onWorkoutDidFinish
|
|
84
|
-
self.onWorkoutFailed = onWorkoutFailed
|
|
85
|
-
do{
|
|
86
|
-
let json = try stringJsonToDic(stringJSON: rawJson)
|
|
87
|
-
let workout = try SMWorkout(FromJson: json)
|
|
88
|
-
try SMKitUIModel.startWorkout(viewController: smkitUIViewController, workout: workout, delegate: self)
|
|
89
|
-
}catch{
|
|
90
|
-
onWorkoutFailed("StartCustomWorkout Failed", error.localizedDescription, error)
|
|
91
|
-
}
|
|
92
|
-
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
var smkitUIViewController:UIViewController?{
|
|
31
|
+
let keyWindow = UIApplication.shared.windows.filter {$0.isKeyWindow}.first
|
|
32
|
+
if var topController = keyWindow?.rootViewController {
|
|
33
|
+
while let presentedViewController = topController.presentedViewController {
|
|
34
|
+
topController = presentedViewController
|
|
35
|
+
}
|
|
36
|
+
return topController
|
|
93
37
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
onWorkoutFailed("startCustomAssessment Failed", error.localizedDescription, error)
|
|
112
|
-
}
|
|
113
|
-
}catch{
|
|
114
|
-
onWorkoutFailed("startCustomAssessment Failed", error.localizedDescription, error)
|
|
115
|
-
}
|
|
116
|
-
}
|
|
38
|
+
return nil
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@objc(configure:onSuccess:onFailure:)
|
|
42
|
+
func configure(key:NSString, onSuccess: @escaping RCTPromiseResolveBlock,onFailure:@escaping RCTPromiseRejectBlock) -> Void {
|
|
43
|
+
var isConfigDone = false
|
|
44
|
+
var didFail = false
|
|
45
|
+
SMKitUIModel.configure(authKey: "\(key)") {
|
|
46
|
+
if !isConfigDone{
|
|
47
|
+
isConfigDone = true
|
|
48
|
+
onSuccess("")
|
|
49
|
+
}
|
|
50
|
+
} onFailure: { err in
|
|
51
|
+
if !didFail{
|
|
52
|
+
didFail = true
|
|
53
|
+
onFailure("Configure Failed", err?.localizedDescription ?? "", err)
|
|
54
|
+
}
|
|
117
55
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
let config = WorkoutConfig(
|
|
146
|
-
week: week,
|
|
147
|
-
bodyZone: bodyZone,
|
|
148
|
-
difficultyLevel: difficultyLevel,
|
|
149
|
-
workoutDuration: workoutDuration,
|
|
150
|
-
programID: programID
|
|
151
|
-
)
|
|
152
|
-
|
|
153
|
-
SMKitUIModel.startWorkoutFromProgram(viewController: smkitUIViewController, workoutConfig: config, delegate: self) { error in
|
|
154
|
-
onWorkoutFailed("StartWorkoutProgram Failed", error.localizedDescription, error)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@objc(startAssessment:showSummary:userData:forceShowUserDataScreen:customAssessmentID:onWorkoutDidFinish:onWorkoutFailed:)
|
|
59
|
+
func startAssessment(type:NSString, showSummary:Bool, userData:NSString?, forceShowUserDataScreen:Bool, customAssessmentID:String?, onWorkoutDidFinish: @escaping RCTPromiseResolveBlock, onWorkoutFailed:@escaping RCTPromiseRejectBlock){
|
|
60
|
+
DispatchQueue.main.async {[weak self] in
|
|
61
|
+
|
|
62
|
+
guard let self = self,
|
|
63
|
+
let smkitUIViewController = smkitUIViewController else {
|
|
64
|
+
onWorkoutFailed("StartAssessment Failed", "Failed to present view", nil)
|
|
65
|
+
return
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
self.onWorkoutDidFinish = onWorkoutDidFinish
|
|
69
|
+
self.onWorkoutFailed = onWorkoutFailed
|
|
70
|
+
|
|
71
|
+
do{
|
|
72
|
+
let userData = try self.getUserData(rawJson: userData)
|
|
73
|
+
if let type = AssessmentTypes(rawValue: "\(type)"){
|
|
74
|
+
try SMKitUIModel.startAssessmet(
|
|
75
|
+
viewController: smkitUIViewController,
|
|
76
|
+
type: type,
|
|
77
|
+
customAssessmentID:customAssessmentID == "" ? nil : customAssessmentID,
|
|
78
|
+
userData: userData,
|
|
79
|
+
forceShowUserDataScreen: forceShowUserDataScreen,
|
|
80
|
+
showSummary: showSummary,
|
|
81
|
+
delegate: self){error in
|
|
82
|
+
onWorkoutFailed("StartAssessment Failed", error.localizedDescription, error)
|
|
155
83
|
}
|
|
84
|
+
}else{
|
|
85
|
+
onWorkoutFailed("StartAssessment Failed", "Invalid type", nil)
|
|
156
86
|
}
|
|
87
|
+
}catch{
|
|
88
|
+
onWorkoutFailed("StartAssessment Failed", error.localizedDescription, error)
|
|
89
|
+
}
|
|
157
90
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
@objc(startCustomWorkout:onWorkoutDidFinish:onWorkoutFailed:)
|
|
94
|
+
func startCustomWorkout(rawJson:String, onWorkoutDidFinish: @escaping RCTPromiseResolveBlock, onWorkoutFailed:@escaping RCTPromiseRejectBlock){
|
|
95
|
+
DispatchQueue.main.async {[weak self] in
|
|
96
|
+
|
|
97
|
+
guard let self = self,
|
|
98
|
+
let smkitUIViewController = smkitUIViewController else {
|
|
99
|
+
onWorkoutFailed("StartCustomWorkout Failed", "Failed to present view", nil)
|
|
100
|
+
return
|
|
101
|
+
}
|
|
102
|
+
self.onWorkoutDidFinish = onWorkoutDidFinish
|
|
103
|
+
self.onWorkoutFailed = onWorkoutFailed
|
|
104
|
+
do{
|
|
171
105
|
let json = try stringJsonToDic(stringJSON: rawJson)
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
)
|
|
106
|
+
let workout = try SMWorkout(FromJson: json)
|
|
107
|
+
try SMKitUIModel.startWorkout(viewController: smkitUIViewController, workout: workout, delegate: self)
|
|
108
|
+
}catch{
|
|
109
|
+
onWorkoutFailed("StartCustomWorkout Failed", error.localizedDescription, error)
|
|
110
|
+
}
|
|
176
111
|
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
@objc(startCustomAssessment:userData:forceShowUserDataScreen:showSummary:onWorkoutDidFinish:onWorkoutFailed:)
|
|
115
|
+
func startCustomAssessment(rawJson:String, userData:NSString?, forceShowUserDataScreen:Bool, showSummary:Bool, onWorkoutDidFinish: @escaping RCTPromiseResolveBlock, onWorkoutFailed:@escaping RCTPromiseRejectBlock){
|
|
116
|
+
DispatchQueue.main.async { [weak self] in
|
|
117
|
+
guard let self = self,
|
|
118
|
+
let smkitUIViewController = smkitUIViewController else {
|
|
119
|
+
onWorkoutFailed("startCustomAssessment Failed", "Failed to present view", nil)
|
|
120
|
+
return
|
|
121
|
+
}
|
|
122
|
+
self.onWorkoutDidFinish = onWorkoutDidFinish
|
|
123
|
+
self.onWorkoutFailed = onWorkoutFailed
|
|
124
|
+
|
|
125
|
+
do{
|
|
126
|
+
let userData = try self.getUserData(rawJson: userData)
|
|
127
|
+
let json = try stringJsonToDic(stringJSON: rawJson)
|
|
128
|
+
let assessment = try SMWorkoutAssessment.initFromJSON(json)
|
|
129
|
+
try SMKitUIModel.startCustomAssessment(viewController: smkitUIViewController, assessment: assessment, userData:userData, forceShowUserDataScreen: forceShowUserDataScreen, showSummary: showSummary, delegate: self) { error in
|
|
130
|
+
onWorkoutFailed("startCustomAssessment Failed", error.localizedDescription, error)
|
|
187
131
|
}
|
|
188
|
-
|
|
132
|
+
}catch{
|
|
133
|
+
onWorkoutFailed("startCustomAssessment Failed", error.localizedDescription, error)
|
|
134
|
+
}
|
|
189
135
|
}
|
|
190
|
-
}
|
|
136
|
+
}
|
|
191
137
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
138
|
+
@objc(startWorkoutProgram:onWorkoutDidFinish:onWorkoutFailed:)
|
|
139
|
+
func startWorkoutProgram(rawJson:String, onWorkoutDidFinish: @escaping RCTPromiseResolveBlock, onWorkoutFailed:@escaping RCTPromiseRejectBlock){
|
|
140
|
+
self.onWorkoutDidFinish = onWorkoutDidFinish
|
|
141
|
+
self.onWorkoutFailed = onWorkoutFailed
|
|
142
|
+
|
|
143
|
+
DispatchQueue.main.async { [weak self] in
|
|
144
|
+
guard let self = self,
|
|
145
|
+
let smkitUIViewController = smkitUIViewController else {
|
|
146
|
+
onWorkoutFailed("StartWorkoutProgram Failed", "Failed to present view", nil)
|
|
147
|
+
return
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
guard let json = try? stringJsonToDic(stringJSON: rawJson),
|
|
151
|
+
let week = json["week"] as? Int,
|
|
152
|
+
let zone = json["bodyZone"] as? String,
|
|
153
|
+
let difficultyLevelRaw = json["difficultyLevel"] as? String,
|
|
154
|
+
let workoutDurationRaw = json["workoutDuration"] as? String,
|
|
155
|
+
let programID = json["programID"] as? String,
|
|
156
|
+
let bodyZone = BodyZone(rawValue: zone),
|
|
157
|
+
let difficultyLevel = WorkoutDifficulty(rawValue: difficultyLevelRaw),
|
|
158
|
+
let workoutDuration = WorkoutDuration(rawValue: workoutDurationRaw)
|
|
159
|
+
else {
|
|
160
|
+
onWorkoutFailed("StartWorkoutProgram Failed", "Invalid Workout Config", nil)
|
|
161
|
+
return
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
let config = WorkoutConfig(
|
|
165
|
+
week: week,
|
|
166
|
+
bodyZone: bodyZone,
|
|
167
|
+
difficultyLevel: difficultyLevel,
|
|
168
|
+
workoutDuration: workoutDuration,
|
|
169
|
+
programID: programID
|
|
170
|
+
)
|
|
171
|
+
|
|
172
|
+
SMKitUIModel.startWorkoutFromProgram(viewController: smkitUIViewController, workoutConfig: config, delegate: self) { error in
|
|
173
|
+
onWorkoutFailed("StartWorkoutProgram Failed", error.localizedDescription, error)
|
|
174
|
+
}
|
|
200
175
|
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
176
|
+
}
|
|
177
|
+
private func stringJsonToDic(stringJSON:String) throws -> [String:Any]{
|
|
178
|
+
guard let data = stringJSON.data(using: .utf8),
|
|
179
|
+
let json = try JSONSerialization.jsonObject(with: data) as? [String:Any]
|
|
180
|
+
else { return [:] }
|
|
181
|
+
return json
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
override class func requiresMainQueueSetup() -> Bool {
|
|
185
|
+
true
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
func getUserData(rawJson:NSString?) throws -> UserData?{
|
|
189
|
+
guard let rawJson = rawJson as? String else { return nil }
|
|
190
|
+
let json = try stringJsonToDic(stringJSON: rawJson)
|
|
191
|
+
return UserData(
|
|
192
|
+
gender: Gender(rawValue: json["gender"] as? String ?? "") ?? .Female,
|
|
193
|
+
birthday: getBirthdayDate(from: json["age"] as? Int ?? 0) ?? Date()
|
|
194
|
+
)
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
func getBirthdayDate(from age: Int) -> Date? {
|
|
198
|
+
// Create a date components instance to subtract years
|
|
199
|
+
var dateComponents = DateComponents()
|
|
200
|
+
dateComponents.year = -age
|
|
201
|
+
|
|
202
|
+
// Use the current calendar and current date to calculate the birth date
|
|
203
|
+
let calendar = Calendar.current
|
|
204
|
+
if let birthDate = calendar.date(byAdding: dateComponents, to: Date()) {
|
|
205
|
+
return birthDate
|
|
205
206
|
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
207
|
+
return nil
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
func reset(){
|
|
211
|
+
summaryData = nil
|
|
212
|
+
didReciveSummary = false
|
|
213
|
+
workoutDidEnd = false
|
|
214
|
+
didCompleteWorkout = false
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
extension SMKitUIManager:SMKitUIWorkoutDelegate{
|
|
219
|
+
func handleWorkoutErrors(error: any Error) {
|
|
220
|
+
onWorkoutFailed?("Workout Exercise Error", error.localizedDescription, error)
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
func workoutDidFinish() {
|
|
224
|
+
didCompleteWorkout = true
|
|
225
|
+
workoutDidEnd = true
|
|
226
|
+
|
|
227
|
+
SMKitUIModel.exitSDK()
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
func didExitWorkout() {
|
|
231
|
+
didCompleteWorkout = false
|
|
232
|
+
workoutDidEnd = true
|
|
233
|
+
|
|
234
|
+
SMKitUIModel.exitSDK()
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
func sendResult(){
|
|
238
|
+
guard let onWorkoutDidFinish = self.onWorkoutDidFinish else {
|
|
239
|
+
onWorkoutFailed?("Unable to create summary", "Missing callback" , nil)
|
|
240
|
+
return
|
|
221
241
|
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
242
|
+
|
|
243
|
+
do{
|
|
244
|
+
let result:[String:Any] = [
|
|
245
|
+
"summary": try summaryData?.toStringJson() ?? "",
|
|
246
|
+
"didFinish": didCompleteWorkout
|
|
247
|
+
]
|
|
248
|
+
onWorkoutDidFinish(result)
|
|
249
|
+
reset()
|
|
250
|
+
}catch{
|
|
251
|
+
onWorkoutFailed?("Unable to create summary", error.localizedDescription, error as NSError)
|
|
225
252
|
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
func exerciseDidFinish(data: ExerciseData) {
|
|
256
|
+
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
func didReceiveSummaryData(data: WorkoutSummaryData?) {
|
|
260
|
+
summaryData = data;
|
|
261
|
+
didReciveSummary = true
|
|
262
|
+
}
|
|
226
263
|
}
|
|
227
264
|
|
|
228
265
|
extension WorkoutSummaryData{
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
266
|
+
func json() throws -> String{
|
|
267
|
+
let jsonEncoder = JSONEncoder()
|
|
268
|
+
let jsonData = try jsonEncoder.encode(self)
|
|
269
|
+
return String(data: jsonData, encoding: String.Encoding.utf8) ?? ""
|
|
270
|
+
}
|
|
234
271
|
}
|
|
235
272
|
|
|
236
|
-
extension
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
return SMWorkoutAssessmet(
|
|
247
|
-
id: json["id"] as? String,
|
|
248
|
-
name: json["name"] as? String,
|
|
249
|
-
workoutIntro: json["workoutIntro"] as? String,
|
|
250
|
-
soundtrack: json["soundtrack"] as? String,
|
|
251
|
-
assessmentsExercises: assessmentsExercises,
|
|
252
|
-
getInFrame: json["getInFrame"] as? String,
|
|
253
|
-
bodycalFinished: json["bodycalFinished"] as? String,
|
|
254
|
-
workoutClosure: json["workoutClosure"] as? String
|
|
255
|
-
)
|
|
273
|
+
extension SMWorkoutAssessment{
|
|
274
|
+
static func initFromJSON(_ json: [String:Any]) throws -> SMWorkoutAssessment{
|
|
275
|
+
var assessmentsExercises:[SMAssessmentExercise] = []
|
|
276
|
+
|
|
277
|
+
if let exercise = json["exercises"] as? [[String:Any]] {
|
|
278
|
+
try exercise.forEach({
|
|
279
|
+
try assessmentsExercises.append(SMAssessmentExercise(FromJson: $0))
|
|
280
|
+
})
|
|
256
281
|
}
|
|
282
|
+
|
|
283
|
+
return SMWorkoutAssessment(
|
|
284
|
+
id: json["id"] as? String,
|
|
285
|
+
name: json["name"] as? String,
|
|
286
|
+
workoutIntro: json["workoutIntro"] as? String,
|
|
287
|
+
soundtrack: json["soundtrack"] as? String,
|
|
288
|
+
assessmentsExercises: assessmentsExercises,
|
|
289
|
+
getInFrame: json["getInFrame"] as? String,
|
|
290
|
+
bodycalFinished: json["bodycalFinished"] as? String,
|
|
291
|
+
workoutClosure: json["workoutClosure"] as? String
|
|
292
|
+
)
|
|
293
|
+
}
|
|
257
294
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../../../example/src/App.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../../../example/src/App.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAuBnD,QAAA,MAAM,GAAG,yBAwYN,CAAA;AA+KH,eAAe,GAAG,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare const EditText: ({ placeholder, value, onChangeText, editable }: {
|
|
3
|
+
placeholder?: string | undefined;
|
|
4
|
+
value?: string | undefined;
|
|
5
|
+
onChangeText?: ((_text: string) => void) | undefined;
|
|
6
|
+
editable?: boolean | undefined;
|
|
7
|
+
}) => React.JSX.Element;
|
|
8
|
+
export default EditText;
|
|
9
|
+
//# sourceMappingURL=EditText.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EditText.d.ts","sourceRoot":"","sources":["../../../../../example/src/components/EditText.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,QAAA,MAAM,QAAQ;;;4BAA2D,MAAM;;uBAa9E,CAAC;AAkBF,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare const ThreeCheckboxes: ({ list, onPress }: {
|
|
3
|
+
list?: string[] | undefined;
|
|
4
|
+
onPress?: ((_index: number) => void) | undefined;
|
|
5
|
+
}) => React.JSX.Element;
|
|
6
|
+
export default ThreeCheckboxes;
|
|
7
|
+
//# sourceMappingURL=ThreeCheckboxes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThreeCheckboxes.d.ts","sourceRoot":"","sources":["../../../../../example/src/components/ThreeCheckboxes.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAGxC,QAAA,MAAM,eAAe;;wBAAsC,MAAM;uBAsBhE,CAAA;AA8BD,eAAe,eAAe,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sency/react-native-smkit-ui",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"description": "react-native-smkit-ui",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -151,5 +151,8 @@
|
|
|
151
151
|
"module",
|
|
152
152
|
"typescript"
|
|
153
153
|
]
|
|
154
|
+
},
|
|
155
|
+
"dependencies": {
|
|
156
|
+
"@react-native-clipboard/clipboard": "^1.15.0"
|
|
154
157
|
}
|
|
155
158
|
}
|
|
@@ -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.
|
|
18
|
+
s.dependency "SMKitUI" ,'0.3.0'
|
|
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.
|