tvOS allow audio in other apps, iOS show complete sheet without watch
This commit is contained in:
@@ -42,6 +42,8 @@ class HealthKitHelper {
|
||||
{ (sampleQuery, results, error ) -> Void in
|
||||
|
||||
if let queryError = error {
|
||||
self.shitReturned()
|
||||
self.shitReturned()
|
||||
print( "There was an error while reading the samples: \(queryError.localizedDescription)")
|
||||
} else {
|
||||
for samples: HKSample in results! {
|
||||
@@ -86,10 +88,8 @@ class HealthKitHelper {
|
||||
self.healthKitWorkoutData.minHeartRate = _minHeartRate
|
||||
self.healthKitWorkoutData.maxHeartRate = _maxHeartRate
|
||||
print("got heart")
|
||||
DispatchQueue.main.async {
|
||||
self.shitReturned()
|
||||
}
|
||||
}
|
||||
self.shitReturned()
|
||||
})
|
||||
healthStore.execute(heartQuery)
|
||||
}
|
||||
@@ -108,10 +108,8 @@ class HealthKitHelper {
|
||||
if let result = result {
|
||||
self.healthKitWorkoutData.caloriesBurned = result.sumQuantity()?.doubleValue(for: HKUnit.kilocalorie()) ?? -1
|
||||
print("got total burned")
|
||||
DispatchQueue.main.async {
|
||||
self.shitReturned()
|
||||
}
|
||||
}
|
||||
self.shitReturned()
|
||||
})
|
||||
healthStore.execute(calQuery)
|
||||
}
|
||||
@@ -121,7 +119,7 @@ class HealthKitHelper {
|
||||
self.returnCount += 1
|
||||
print("\(self.returnCount)")
|
||||
if self.returnCount == 2 {
|
||||
self.completion!(self.healthKitWorkoutData)
|
||||
self.completion?(self.healthKitWorkoutData)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,10 +19,10 @@ struct WorkoutDetailView: View {
|
||||
|
||||
enum Sheet: Identifiable {
|
||||
case completedWorkout([String: Any])
|
||||
var id: String { return UUID().uuidString }
|
||||
var id: String { return "completedWorkoutSheet" }
|
||||
}
|
||||
|
||||
@State var presentedSheet: Sheet?
|
||||
@State var workoutComplete: Sheet?
|
||||
@State var workoutToPlan: Workout?
|
||||
@State var showExecersizeInfo: Bool = false
|
||||
|
||||
@@ -134,13 +134,14 @@ struct WorkoutDetailView: View {
|
||||
.frame(height: 44)
|
||||
|
||||
}
|
||||
.sheet(item: $presentedSheet) { item in
|
||||
.sheet(item: $workoutComplete) { item in
|
||||
switch item {
|
||||
case .completedWorkout(let data):
|
||||
CompletedWorkoutView(postData: data,
|
||||
workout: workout,
|
||||
completedWorkoutDismissed: { uploaded in
|
||||
if uploaded {
|
||||
bridgeModule.resetCurrentWorkout()
|
||||
dismiss()
|
||||
}
|
||||
})
|
||||
@@ -195,7 +196,8 @@ struct WorkoutDetailView: View {
|
||||
func startWorkout(workout: Workout) {
|
||||
bridgeModule.completedWorkout = {
|
||||
if let workoutData = createWorkoutData() {
|
||||
presentedSheet = .completedWorkout(workoutData)
|
||||
workoutComplete = .completedWorkout(workoutData)
|
||||
} else {
|
||||
bridgeModule.resetCurrentWorkout()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user