WIP
This commit is contained in:
@@ -15,6 +15,7 @@ enum WatchActions: Codable {
|
||||
case restartExercise
|
||||
case previousExercise
|
||||
case stopWorkout
|
||||
case pauseWorkout
|
||||
case workoutComplete(Data)
|
||||
}
|
||||
|
||||
@@ -318,6 +319,8 @@ extension BridgeModule: WCSessionDelegate {
|
||||
previousExercise()
|
||||
case .stopWorkout:
|
||||
completeWorkout()
|
||||
case .pauseWorkout:
|
||||
pauseWorkout()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ struct ContentView: View {
|
||||
MainWatchView()
|
||||
WatchControlView()
|
||||
}
|
||||
.padding()
|
||||
.tabViewStyle(PageTabViewStyle())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,8 +66,8 @@ struct MainWatchView: View {
|
||||
}
|
||||
}
|
||||
|
||||
//struct MainView_Previews: PreviewProvider {
|
||||
// static var previews: some View {
|
||||
// MainView()
|
||||
// }
|
||||
//}
|
||||
struct MainView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
MainWatchView()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,8 +30,7 @@ struct WatchControlView: View {
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
})
|
||||
.buttonStyle(BorderedButtonStyle(tint: .yellow))
|
||||
}
|
||||
VStack {
|
||||
|
||||
Button(action: {
|
||||
vm.previousExercise()
|
||||
}, label: {
|
||||
@@ -40,6 +39,16 @@ struct WatchControlView: View {
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
})
|
||||
.buttonStyle(BorderedButtonStyle(tint: .blue))
|
||||
}
|
||||
VStack {
|
||||
Button(action: {
|
||||
vm.pauseWorkout()
|
||||
}, label: {
|
||||
Image(systemName: "pause")
|
||||
.font(.title)
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
})
|
||||
.buttonStyle(BorderedButtonStyle(tint: .blue))
|
||||
|
||||
Button(action: {
|
||||
vm.nextExercise()
|
||||
@@ -54,8 +63,8 @@ struct WatchControlView: View {
|
||||
}
|
||||
}
|
||||
|
||||
//struct WatchControlView_Previews: PreviewProvider {
|
||||
// static var previews: some View {
|
||||
// WatchControlView(vm: WatchMainViewModel())
|
||||
// }
|
||||
//}
|
||||
struct WatchControlView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
WatchControlView(vm: WatchMainViewModel())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,6 +88,12 @@ class WatchMainViewModel: NSObject, ObservableObject {
|
||||
let data = try! JSONEncoder().encode(nextExerciseAction)
|
||||
send(data)
|
||||
}
|
||||
|
||||
func pauseWorkout() {
|
||||
let nextExerciseAction = WatchActions.pauseWorkout
|
||||
let data = try! JSONEncoder().encode(nextExerciseAction)
|
||||
send(data)
|
||||
}
|
||||
}
|
||||
|
||||
extension WatchMainViewModel {
|
||||
|
||||
Reference in New Issue
Block a user