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