@@ -10,7 +10,7 @@ import QuickPoseCore
1010import QuickPoseSwiftUI
1111
1212struct VoiceCommands {
13- public static let standInsideBBox = Text2Speech ( text : " Stand so that your whole body is inside the bounding box " )
13+ public static let standInsideBBox = " Stand so that your whole body is inside the bounding box "
1414}
1515
1616class SessionData : ObservableObject {
@@ -30,8 +30,6 @@ struct QuickPoseBasicView: View {
3030 @EnvironmentObject var viewModel : ViewModel
3131 @EnvironmentObject var sessionConfig : SessionConfig
3232
33- private var exercise : Exercise
34-
3533 @State private var overlayImage : UIImage ?
3634
3735 @State private var feedbackText : String ? = nil
@@ -55,10 +53,6 @@ struct QuickPoseBasicView: View {
5553
5654 let bboxTimer = TimerManager ( )
5755
58- init ( exercise: Exercise ) {
59- self . exercise = exercise
60- }
61-
6256 func goToResults( ) {
6357 DispatchQueue . main. async {
6458 sessionData. seconds = Int ( exerciseTimer. getTotalSeconds ( ) )
@@ -104,7 +98,7 @@ struct QuickPoseBasicView: View {
10498 InstructionsView ( ) . overlay ( alignment: . bottom) {
10599 Button ( action: {
106100 state = WorkoutState . bbox
107- VoiceCommands . standInsideBBox. say ( )
101+ Text2Speech ( text : VoiceCommands . standInsideBBox) . say ( )
108102 } ) {
109103 Text ( " Start Workout " ) . foregroundColor ( . white)
110104 . padding ( )
@@ -156,7 +150,7 @@ struct QuickPoseBasicView: View {
156150 }
157151 }
158152 . onAppear {
159- quickPose. start ( features: exercise. features, onFrame: { status, image, features, feedback, landmarks in
153+ quickPose. start ( features: sessionConfig . exercise. features, onFrame: { status, image, features, feedback, landmarks in
160154
161155
162156
@@ -204,7 +198,7 @@ struct QuickPoseBasicView: View {
204198 }
205199
206200 if ( state == WorkoutState . exercise && !exerciseTimer. isRunning ( ) ) {
207- Text2Speech ( text: " Now let's start the \( exercise. name) exercise " ) . say ( )
201+ Text2Speech ( text: " Now let's start the \( sessionConfig . exercise. name) exercise " ) . say ( )
208202 exerciseTimer. start ( )
209203 }
210204
@@ -217,7 +211,7 @@ struct QuickPoseBasicView: View {
217211 feedbackText = nil
218212 }
219213
220- if case . fitness = exercise. features. first, let result = features [ exercise. features. first!] {
214+ if case . fitness = sessionConfig . exercise. features. first, let result = features [ sessionConfig . exercise. features. first!] {
221215 counter. count ( probability: result. value)
222216 if ( counter. getCount ( ) > count) {
223217 Text2Speech ( text: String ( counter. getCount ( ) ) ) . say ( )
@@ -248,7 +242,7 @@ struct QuickPoseBasicView: View {
248242 UIApplication . shared. isIdleTimerDisabled = true
249243 }
250244 . onDisappear {
251- let sessionDataDump = SessionDataModel ( exercise: exercise. name, count: Int ( counter. getCount ( ) ) , seconds: Int ( exerciseTimer. getTotalSeconds ( ) ) , date: Date ( ) )
245+ let sessionDataDump = SessionDataModel ( exercise: sessionConfig . exercise. name, count: Int ( counter. getCount ( ) ) , seconds: Int ( exerciseTimer. getTotalSeconds ( ) ) , date: Date ( ) )
252246 appendToJson ( sessionData: sessionDataDump)
253247
254248 quickPose. stop ( )
0 commit comments