Add per-split rest length and hands-free auto-advance flow
Two per-split settings, with the global Settings values as defaults: - restSeconds: Int? — per-split rest, used between sets and (in flow) between exercises; nil falls back to the global default. - autoAdvance: Bool? — flow mode: finishing an exercise rests, then opens the next one hands-free, all the way through the split. Both are optional, snapshotted onto WorkoutDocument at the start sites (no live split link), and not schema-bumped — same degradation pattern as activityType. A thin RunFlowView wrapper (iOS + watch) owns the on-screen log and swaps it via .id(currentLogID) on hand-off, so the per-exercise ExerciseProgressView stays per-logID and untouched; the between-exercise rest reuses the existing .rest countdown as the terminal page. The mirror reuses the per-logID live channel: the wrapper suppresses the boundary .ended teardown so it follows across exercises, and ContentView re-keys the cover on frame.logID — no sync-bridge changes. Morning Wake-Up ships as a flowing 45s-work / 15s-rest routine. New Rest & Pacing section in the split editor exposes both controls.
This commit is contained in:
@@ -29,6 +29,9 @@ struct SplitAddEditView: View {
|
||||
@State private var color: String = "indigo"
|
||||
@State private var systemImage: String = "dumbbell.fill"
|
||||
@State private var activityType: WorkoutActivityType = .traditionalStrength
|
||||
@State private var autoAdvance: Bool = false
|
||||
@State private var restOverrideEnabled: Bool = false
|
||||
@State private var restSecondsValue: Int = 45
|
||||
@State private var showingIconPicker: Bool = false
|
||||
@State private var showingDeleteConfirmation: Bool = false
|
||||
|
||||
@@ -42,6 +45,9 @@ struct SplitAddEditView: View {
|
||||
_color = State(initialValue: split.color)
|
||||
_systemImage = State(initialValue: split.systemImage)
|
||||
_activityType = State(initialValue: split.activityTypeEnum)
|
||||
_autoAdvance = State(initialValue: split.autoAdvance ?? false)
|
||||
_restOverrideEnabled = State(initialValue: split.restSeconds != nil)
|
||||
_restSecondsValue = State(initialValue: split.restSeconds ?? 45)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,6 +117,25 @@ struct SplitAddEditView: View {
|
||||
Text("Determines how this workout is categorized in Apple Health and how it credits your Activity rings.")
|
||||
}
|
||||
|
||||
Section {
|
||||
Toggle("Auto-Advance Exercises", isOn: $autoAdvance)
|
||||
|
||||
Toggle("Custom Rest Time", isOn: $restOverrideEnabled)
|
||||
if restOverrideEnabled {
|
||||
Stepper(value: $restSecondsValue, in: 10...180, step: 5) {
|
||||
HStack {
|
||||
Text("Rest Time")
|
||||
Spacer()
|
||||
Text("\(restSecondsValue)s").foregroundColor(.secondary)
|
||||
}
|
||||
}
|
||||
}
|
||||
} header: {
|
||||
Text("Rest & Pacing")
|
||||
} footer: {
|
||||
Text("Auto-Advance flows from one exercise to the next with a rest between, so you can run the whole split hands-free. Custom Rest Time sets this split's rest — used between sets, and between exercises when auto-advancing; otherwise the Settings default applies.")
|
||||
}
|
||||
|
||||
if let split = split {
|
||||
Section(header: Text("Exercises")) {
|
||||
NavigationLink {
|
||||
@@ -178,6 +203,8 @@ struct SplitAddEditView: View {
|
||||
doc.color = color
|
||||
doc.systemImage = systemImage
|
||||
doc.activityType = activityType.rawValue
|
||||
doc.restSeconds = restOverrideEnabled ? restSecondsValue : nil
|
||||
doc.autoAdvance = autoAdvance ? true : nil
|
||||
doc.updatedAt = Date()
|
||||
Task { await sync.save(split: doc) }
|
||||
} else {
|
||||
@@ -193,7 +220,9 @@ struct SplitAddEditView: View {
|
||||
createdAt: Date(),
|
||||
updatedAt: Date(),
|
||||
exercises: [],
|
||||
activityType: activityType.rawValue
|
||||
activityType: activityType.rawValue,
|
||||
restSeconds: restOverrideEnabled ? restSecondsValue : nil,
|
||||
autoAdvance: autoAdvance ? true : nil
|
||||
)
|
||||
Task { await sync.save(split: doc) }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user