Adjust rest time from the watch with the same 1-second stepper
A gear on the watch root opens a small Settings sheet whose stepper edits the shared restSeconds default (10-180s, 1s steps). Edits ride a new settingsUpdate message to the phone - debounced per stepper burst, falling back to transferUserInfo when unreachable - which clamps the value, writes the shared default, and re-echoes it to every device through the application context. While an edit is pending on the watch, an in-flight context's stale rest value is skipped so it can't yank the stepper back mid-edit.
This commit is contained in:
@@ -27,6 +27,8 @@ struct ActiveWorkoutGateView: View {
|
||||
/// takes over editing the run we're inside.
|
||||
@State private var path: [ActiveWorkoutRoute] = []
|
||||
|
||||
@State private var showingSettings = false
|
||||
|
||||
private var activeWorkouts: [Workout] {
|
||||
workouts.filter { $0.status == .inProgress || $0.status == .notStarted }
|
||||
}
|
||||
@@ -66,6 +68,19 @@ struct ActiveWorkoutGateView: View {
|
||||
WorkoutLogListView(workout: workout)
|
||||
}
|
||||
}
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .topBarTrailing) {
|
||||
Button {
|
||||
showingSettings = true
|
||||
} label: {
|
||||
Image(systemName: "gearshape")
|
||||
}
|
||||
.accessibilityLabel("Settings")
|
||||
}
|
||||
}
|
||||
.sheet(isPresented: $showingSettings) {
|
||||
NavigationStack { WatchSettingsView() }
|
||||
}
|
||||
// The phone's pushes aren't decoding (its app updated first; this one hasn't
|
||||
// yet) — everything shown is frozen at the last good sync. Say so rather than
|
||||
// silently presenting stale workouts until the watch app catches up.
|
||||
|
||||
Reference in New Issue
Block a user