Files
workouts/Workouts/ContentView.swift
T
rzen 90deb582fe 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.
2026-07-09 15:18:13 -04:00

31 lines
1.0 KiB
Swift

//
// ContentView.swift
// Workouts
//
// Copyright 2025 Rouslan Zenetl. All Rights Reserved.
//
import SwiftUI
struct ContentView: View {
@Environment(LiveRunState.self) private var liveRun
var body: some View {
WorkoutLogsView()
// Prop the phone up and it runs the live Apple Watch workout — two-way: drive from
// either device and the other follows.
.fullScreenCover(isPresented: Binding(
get: { liveRun.presentable != nil },
set: { presenting in if !presenting { liveRun.mute() } }
)) {
if let frame = liveRun.presentable {
// Re-key on the followed log so a flow-mode auto-advance (the driver
// moving to the next exercise) rebuilds the mirror for the new exercise
// instead of leaving a stale one pinned to the previous log.
LiveRunCoverView(frame: frame) { liveRun.mute() }
.id(frame.logID)
}
}
}
}