Rework the Apple Watch progress flow
Watch root lists every in-progress workout; picking an exercise runs a paged Ready -> work/rest -> Finish flow (One More + auto-firing Done), with a phase-dot row and brand-tinted count-up/down timers. Includes the configurable rest and auto-finish settings synced over WatchConnectivity and the wrist-down timer fix.
This commit is contained in:
@@ -10,17 +10,19 @@ enum WCPayload {
|
||||
static let workoutsKey = "workouts"
|
||||
static let workoutKey = "workout"
|
||||
static let restSecondsKey = "restSeconds"
|
||||
static let doneCountdownSecondsKey = "doneCountdownSeconds"
|
||||
|
||||
static let workoutUpdateType = "workoutUpdate" // watch → phone (one workout)
|
||||
static let requestSyncType = "requestSync" // watch → phone (please push state)
|
||||
|
||||
// MARK: - Phone → Watch (application context: latest-state-wins)
|
||||
|
||||
static func encodeState(splits: [SplitDocument], workouts: [WorkoutDocument], restSeconds: Int) -> [String: Any] {
|
||||
static func encodeState(splits: [SplitDocument], workouts: [WorkoutDocument], restSeconds: Int, doneCountdownSeconds: Int) -> [String: Any] {
|
||||
var dict: [String: Any] = [:]
|
||||
if let s = try? DocumentCoder.encoder.encode(splits) { dict[splitsKey] = s }
|
||||
if let w = try? DocumentCoder.encoder.encode(workouts) { dict[workoutsKey] = w }
|
||||
dict[restSecondsKey] = restSeconds
|
||||
dict[doneCountdownSecondsKey] = doneCountdownSeconds
|
||||
return dict
|
||||
}
|
||||
|
||||
@@ -36,6 +38,8 @@ enum WCPayload {
|
||||
|
||||
static func decodeRestSeconds(_ dict: [String: Any]) -> Int? { dict[restSecondsKey] as? Int }
|
||||
|
||||
static func decodeDoneCountdownSeconds(_ dict: [String: Any]) -> Int? { dict[doneCountdownSecondsKey] as? Int }
|
||||
|
||||
// MARK: - Watch → Phone (a single updated workout)
|
||||
|
||||
static func encodeWorkoutUpdate(_ workout: WorkoutDocument) -> [String: Any] {
|
||||
|
||||
@@ -22,6 +22,14 @@ extension Color {
|
||||
}
|
||||
}
|
||||
|
||||
/// Brand purple from the app logo (a touch brighter than the icon's `#7023BC`
|
||||
/// so it stays legible on the watch's black background). Used for the work phase —
|
||||
/// its count-up timer and progress dots.
|
||||
static let workTint = Color(red: 0.51, green: 0.22, blue: 0.84)
|
||||
|
||||
/// Light teal counterpart for the rest phase — its count-down timer and dots.
|
||||
static let restTint = Color(red: 0.44, green: 0.85, blue: 0.84)
|
||||
|
||||
/// Returns a darker shade by reducing HSB brightness (not opacity).
|
||||
func darker(by percentage: CGFloat = 0.2) -> Color {
|
||||
#if canImport(UIKit)
|
||||
|
||||
Reference in New Issue
Block a user