Skip to content

Commit 0f53f79

Browse files
committed
stop workout button
1 parent 4889f48 commit 0f53f79

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

FitCount/Workout/QuickPoseBasicView.swift

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,15 @@ struct QuickPoseBasicView: View {
5858
self.exercise = exercise
5959
}
6060

61+
func goToResults() {
62+
DispatchQueue.main.async {
63+
sessionData.seconds = Int(exerciseTimer.getTotalSeconds())
64+
sessionData.count = Int(counter.getCount())
65+
66+
isActive = true // Set the state variable to trigger the navigation
67+
}
68+
}
69+
6170
var body: some View {
6271
VStack{
6372
NavigationLink(value: "Workout results") {
@@ -80,6 +89,16 @@ struct QuickPoseBasicView: View {
8089
BoundingBoxView(isInBBox: isInBBox, indicatorWidth: indicatorWidth)
8190
}
8291
}
92+
.overlay(alignment: .topTrailing) {
93+
Button(action: {
94+
goToResults()
95+
}) {
96+
Image(systemName: "xmark.circle.fill")
97+
.font(.system(size: 44))
98+
.foregroundColor(.indigo)
99+
}
100+
.padding()
101+
}
83102

84103
.overlay(alignment: .bottom) {
85104
if (state == WorkoutState.exercise) {
@@ -185,12 +204,7 @@ struct QuickPoseBasicView: View {
185204
count = counter.getCount()
186205

187206
if (sessionConfig.useReps && count >= sessionConfig.nReps || !sessionConfig.useReps && Int(exerciseTimer.getTotalSeconds()) >= (sessionConfig.nSeconds + sessionConfig.nMinutes * 60)) {
188-
DispatchQueue.main.async {
189-
sessionData.seconds = Int(exerciseTimer.getTotalSeconds())
190-
sessionData.count = Int(counter.getCount())
191-
192-
isActive = true // Set the state variable to trigger the navigation
193-
}
207+
goToResults()
194208
}
195209
measure = result.value
196210
}

0 commit comments

Comments
 (0)