Add a live status panel between the run screen's halves

Replaces the small target-HR pill on the iPhone run screen with a
glanceable big-digit strip between the timer flow and the figure —
heart rate (band-tinted with the cue arrow when the run carries a
target), HR zone, active calories, and the workout stopwatch. A
horizontal band in portrait, a vertical column in landscape (the
inverse of the half-and-half split, so it always sits between them).

The watch now rides the running calorie total and the HR zone (1-5,
computed watch-side where max HR is known) along with each live HR
sample; absent keys keep older builds wire-compatible both ways.
LiveRunState holds all three under the shared staleness expiry. The
screenshot rig seeds believable values so the run capture shows the
panel populated.
This commit is contained in:
2026-07-16 18:54:39 -04:00
parent a0f14f46e1
commit aa23d7baa7
10 changed files with 167 additions and 57 deletions
+12 -4
View File
@@ -149,13 +149,21 @@ enum WCPayload {
// the readout refreshes on the next one.
static let hrBpmKey = "hrBpm"
static let hrAtKey = "hrAt"
static let hrKcalKey = "hrKcal"
static let hrZoneKey = "hrZone"
static func encodeLiveHeartRate(bpm: Double, at date: Date) -> [String: Any] {
[typeKey: liveHeartRateType, hrBpmKey: bpm, hrAtKey: date]
/// The session's running calories and HR zone ride along with each sample when
/// known absent keys (an older watch, or no energy sample yet) decode as nil,
/// so the two builds stay wire-compatible in both directions.
static func encodeLiveHeartRate(bpm: Double, at date: Date, kcal: Double? = nil, zone: Int? = nil) -> [String: Any] {
var dict: [String: Any] = [typeKey: liveHeartRateType, hrBpmKey: bpm, hrAtKey: date]
if let kcal { dict[hrKcalKey] = kcal }
if let zone { dict[hrZoneKey] = zone }
return dict
}
static func decodeLiveHeartRate(_ dict: [String: Any]) -> (bpm: Double, at: Date)? {
static func decodeLiveHeartRate(_ dict: [String: Any]) -> (bpm: Double, at: Date, kcal: Double?, zone: Int?)? {
guard let bpm = dict[hrBpmKey] as? Double, let at = dict[hrAtKey] as? Date else { return nil }
return (bpm, at)
return (bpm, at, dict[hrKcalKey] as? Double, dict[hrZoneKey] as? Int)
}
}