Make the live run two-way: drive from either device

The propped-up iPhone now runs the real ExerciseProgressView for a live
watch workout instead of a read-only mirror, and the live-run channel is
symmetric — either device can drive the flow and the other follows.

Each page transition is classified human / auto / remote: only human
transitions (swipe, Start, One More, swipe-back reset) are broadcast and
recorded by the actor; auto-advances (rest / timed-work countdown) record
locally but aren't sent, since both devices reach them independently off
the shared wall-clock anchors; an applied remote frame jumps the page
without re-recording or re-broadcasting. That rule is also what stops an
echo loop.

- PhoneConnectivityBridge gains sendLiveProgress/sendLiveEnded (the
  missing phone->watch direction); WatchConnectivityBridge receives
  frames into an observable liveIncoming via a new didReceiveMessage
  route. Both share one increasing per-run version sequence so the
  stale-frame guard works across the two devices' counters.
- Both ExerciseProgressViews gain an incomingFrame input + applyIncoming
  (syncing setCount for a remote One More); the iPhone one gains the
  liveSnapshot/broadcast machinery the watch already had.
- New LiveRunCoverView wraps the real driver for the cover (resolves the
  workout, persists via SyncEngine, wires the live channel + close);
  ContentView presents it; LiveProgressMirrorView is removed.

Claude-Session: https://claude.ai/code/session_01SCv7zvGFcKy47KSTnTLxRe
This commit is contained in:
2026-06-20 22:11:05 -04:00
parent b911818587
commit 8f69497b24
10 changed files with 407 additions and 276 deletions
+5 -4
View File
@@ -24,10 +24,11 @@ your own iCloud Drive.
page with **One More** and a **Done** that auto-completes after a countdown. A
phase-dot row (purple work, teal rest) tracks progress. Rest time and the
auto-finish countdown are configurable; changes sync back to the phone.
- **Live workout mirror** — prop your iPhone up during an Apple Watch workout and it
mirrors the run in real time: the same Ready → work/rest → Finish flow with live
timers, following the watch set by set. It's read-only — the watch stays in control,
and the timers stay in step because each device counts off shared start times.
- **Two-way live run** — prop your iPhone up during an Apple Watch workout and it runs
the same Ready → work/rest → Finish flow with live timers, in step with the watch. It's
bidirectional: drive from either device — swipe ahead, finish a set, add one — and the
other follows. Only *human* transitions are sent; automatic ones (a rest timer ending)
advance both devices independently off shared start times, so they never fight.
- **iCloud Drive sync** — your data lives as human-readable JSON in your iCloud
Drive, synced across devices and visible in the Files app. iCloud is required.