fad629338e
Two-way driving only worked watch->phone: the watch's navigated driver broadcast and the phone auto-presented a follower cover. The reverse failed on both ends — the phone's in-list ExerciseProgressView never broadcast (only its cover did), and the watch had no surface to present an incoming run. - Wire the live channel into the phone's in-list driver (broadcast + follow) via a progressView(logID:) helper in WorkoutLogListView. - Add a watch follower cover (LiveRunCoverView, mirroring the phone's), presented from ContentView when the phone drives a run the watch isn't already in; the watch bridge gains presentable / muteLive. - Add a navigatedRunID guard on both sides so a device already in the run follows it inline rather than stacking a cover over itself. Now starting or driving on either device surfaces the run on the other — as a follower cover when idle, or inline when already in that run — and either side can take over. Claude-Session: https://claude.ai/code/session_01SCv7zvGFcKy47KSTnTLxRe
26 lines
734 B
Swift
26 lines
734 B
Swift
//
|
|
// ContentView.swift
|
|
// Workouts Watch App
|
|
//
|
|
// Copyright 2025 Rouslan Zenetl. All Rights Reserved.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct ContentView: View {
|
|
@Environment(WatchConnectivityBridge.self) private var bridge
|
|
|
|
var body: some View {
|
|
ActiveWorkoutGateView()
|
|
// The iPhone started driving a run we're not already in — follow it live here.
|
|
.fullScreenCover(isPresented: Binding(
|
|
get: { bridge.presentable != nil },
|
|
set: { presenting in if !presenting { bridge.muteLive() } }
|
|
)) {
|
|
if let frame = bridge.presentable {
|
|
LiveRunCoverView(frame: frame) { bridge.muteLive() }
|
|
}
|
|
}
|
|
}
|
|
}
|