Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
241 changes: 175 additions & 66 deletions frontend/ios/App/Watch/RestHold.swift

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions frontend/ios/App/Watch/SessionStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,11 @@ final class SessionStore: NSObject, ObservableObject, WCSessionDelegate, UNUserN
return workout == nil ? nil : workoutSeenAt
}

/// The rest page is what the set page shows (one source for LivePage and the badges).
var restPanel: Bool {
holdCountFrom == nil && holdEndsAt == nil && viewing == nil && (restEndsAt ?? .distantPast) > Date()
}

/// When the phone paused the workout (#976), nil while it runs.
var workoutPausedAt: Date? {
guard let d = SafeNum.date(ms: workout?.pausedAt), d.timeIntervalSince1970 > 0 else { return nil }
Expand Down Expand Up @@ -1540,6 +1545,12 @@ final class SessionStore: NSObject, ObservableObject, WCSessionDelegate, UNUserN
self.state.settings.effort = "rir"
self.lastLogged = SetRef(entry: 0, set: 1)
}
if screen == "rest" || screen == "effort" {
self.health.setDemoHeartRate(128)
self.workoutSeenAt = Date().addingTimeInterval(-(24 * 60 + 10))
if let n = SessionStore.argument("-OpenGymWatchRated").flatMap(Double.init), screen == "effort" { self.lastRated = n }
if let n = SessionStore.argument("-OpenGymWatchUnsynced").flatMap(Int.init) { self.unsentSets = n }
}
if screen == "hold" { self.startHold() }
if screen == "offline" { self.reachable = false; self.queued = 3; self.unsentSets = 3 }
if screen == "waiting" { self.queued = 2; self.unsentSets = 2; self.tab = .overview }
Expand Down
13 changes: 8 additions & 5 deletions frontend/ios/App/Watch/SessionView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,17 @@ struct SessionView: View {
}
}

/// Beside the clock: whether sets wait for the phone, and the heart rate.
/// Beside the clock: whether sets wait for the phone, and the heart rate. Not on the rest page:
/// it ignores the top safe area (the countdown sits there) and shows both itself.
struct SessionBadges: View {
@EnvironmentObject var store: SessionStore

var body: some View {
HStack(spacing: 4) {
SyncPill()
if store.show.showHr { HeartRateBadge(health: store.health) }
if !(store.tab == .set && store.restPanel) {
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
HStack(spacing: 4) {
SyncPill()
if store.show.showHr { HeartRateBadge(health: store.health) }
}
}
}
}
Expand Down Expand Up @@ -123,7 +126,7 @@ struct LivePage: View {
if store.holdCountFrom != nil { return .count }
if store.holdEndsAt != nil { return .hold }
if store.viewing != nil { return .fix }
if let end = store.restEndsAt, end > Date() { return .rest }
if store.restPanel { return .rest }
return store.entry != nil ? .set : .done
}

Expand Down
2 changes: 2 additions & 0 deletions frontend/ios/App/Watch/WorkoutManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ final class WorkoutManager: NSObject, ObservableObject, HKWorkoutSessionDelegate
}
@Published private(set) var heartRate: Double?
@Published private(set) var running = false
/// Demo screenshots only: a heart rate without a sensor.
func setDemoHeartRate(_ v: Double) { heartRate = v }
/// A session runs and no reading has come yet.
var measuring: Bool { running && heartRate == nil }

Expand Down
Binary file modified frontend/public/watch/rest-bar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified frontend/public/watch/rest-plain.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions frontend/src/views/WatchSettings.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ import { loadHealth, onHealthChange } from '../lib/health-sync.js'
import { fmtAgo } from '../lib/format.js'
import Icon from '../components/Icon.jsx'

// The two rest screens as the watch draws them (real CI screenshots in public/watch/).
// TODO swap rest-plain.png for the "effort-plain" CI shot once that run exists (ios.yml), so both show the effort chips.
// The two rest screens as the watch draws them (simulator screenshots of the effort screen from #1100, in public/watch/).
const REST_LOOKS = [
{ value: 'ring', label: 'Progress bar', img: 'watch/rest-bar.png', alt: 'Watch rest screen: the countdown with a thin progress bar under it' },
{ value: 'plain', label: 'Countdown only', img: 'watch/rest-plain.png', alt: 'Watch rest screen: just the big countdown' },
Expand Down
Loading