WIP
This commit is contained in:
@@ -30,9 +30,10 @@ class WatchDelegate: NSObject, WKApplicationDelegate {
|
||||
HKObjectType.quantityType(forIdentifier: .heartRate)!,
|
||||
HKObjectType.quantityType(forIdentifier: .activeEnergyBurned)!,
|
||||
HKObjectType.quantityType(forIdentifier: .oxygenSaturation)!,
|
||||
HKObjectType.activitySummaryType(),
|
||||
HKQuantityType.workoutType()
|
||||
]
|
||||
HKHealthStore().requestAuthorization(toShare: healthKitTypes, read: healthKitTypes) { (succ, error) in
|
||||
HKHealthStore().requestAuthorization(toShare: nil, read: healthKitTypes) { (succ, error) in
|
||||
if !succ {
|
||||
fatalError("Error requesting authorization from health store: \(String(describing: error)))")
|
||||
}
|
||||
|
||||
@@ -45,14 +45,14 @@ class WatchWorkout: NSObject, ObservableObject, HKWorkoutSessionDelegate, HKLive
|
||||
|
||||
func startWorkout() {
|
||||
if isInWorkout { return }
|
||||
isInWorkout = true
|
||||
setupCore()
|
||||
hkWorkoutSession.startActivity(with: Date())
|
||||
isInWorkout = true
|
||||
//WKInterfaceDevice.current().play(.start)
|
||||
}
|
||||
|
||||
func stopWorkout(sendDetails: Bool) {
|
||||
hkWorkoutSession.endCurrentActivity(on: Date())
|
||||
// hkWorkoutSession.endCurrentActivity(on: Date())
|
||||
hkWorkoutSession.end()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user