wip
This commit is contained in:
@@ -45,11 +45,14 @@ class WatchWorkout: NSObject, ObservableObject, HKWorkoutSessionDelegate, HKLive
|
||||
|
||||
func startWorkout() {
|
||||
if isInWorkout { return }
|
||||
setupCore()
|
||||
hkWorkoutSession.startActivity(with: Date())
|
||||
isInWorkout = true
|
||||
//WKInterfaceDevice.current().play(.start)
|
||||
}
|
||||
|
||||
func stopWorkout(sendDetails: Bool) {
|
||||
hkWorkoutSession.endCurrentActivity(on: Date())
|
||||
hkWorkoutSession.end()
|
||||
}
|
||||
|
||||
@@ -125,10 +128,13 @@ class WatchWorkout: NSObject, ObservableObject, HKWorkoutSessionDelegate, HKLive
|
||||
}
|
||||
|
||||
func workoutSession(_ workoutSession: HKWorkoutSession, didFailWithError error: Error) {
|
||||
workoutSession.end()
|
||||
setupCore()
|
||||
startWorkout()
|
||||
beginBuilderWorkout()
|
||||
print("[didFailWithError] Workout Builder changed event: \(error.localizedDescription)")
|
||||
// trying to go from ended to something so just end it all
|
||||
if workoutSession.state == .ended {
|
||||
getWorkoutBuilderDetails(completion: {
|
||||
self.setupCore()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func workoutBuilder(_ workoutBuilder: HKLiveWorkoutBuilder, didCollectDataOf collectedTypes: Set<HKSampleType>) {
|
||||
|
||||
Reference in New Issue
Block a user