feat: add real watch companion and dual IPA build workflow
This commit is contained in:
@@ -339,6 +339,8 @@ struct FuelStore {
|
||||
static let liveActivityRadiusKey = "fuelboard.liveActivityRadiusMiles" // Int miles (5/10/15)
|
||||
static let onboardingCompletedKey = "fuelboard.onboardingCompleted" // Bool
|
||||
static let lastRefreshKey = "fuelboard.lastRefresh" // TimeInterval (seconds since 1970)
|
||||
static let watchRefreshRequestKey = "fuelboard.watchRefreshRequest" // TimeInterval (seconds since 1970)
|
||||
static let watchRefreshHandledKey = "fuelboard.watchRefreshHandled" // TimeInterval (seconds since 1970)
|
||||
static let relaySourceKey = "fuelboard.relaySource" // String — "api" | "csv"
|
||||
static let stationCountKey = "fuelboard.stationCount" // String — station count
|
||||
static let dataUpdatedKey = "fuelboard.dataUpdated" // String — govUK dataset update time
|
||||
@@ -846,6 +848,34 @@ struct FuelStore {
|
||||
saveString(String(date.timeIntervalSince1970), service: lastRefreshKey)
|
||||
}
|
||||
|
||||
static func requestWatchRefresh(_ date: Date = Date()) {
|
||||
saveString(String(date.timeIntervalSince1970), service: watchRefreshRequestKey)
|
||||
}
|
||||
|
||||
static func loadWatchRefreshRequest() -> Date? {
|
||||
if let raw = loadString(service: watchRefreshRequestKey), let ts = TimeInterval(raw) {
|
||||
return Date(timeIntervalSince1970: ts)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
static func markWatchRefreshHandled(_ date: Date = Date()) {
|
||||
saveString(String(date.timeIntervalSince1970), service: watchRefreshHandledKey)
|
||||
}
|
||||
|
||||
static func loadWatchRefreshHandled() -> Date? {
|
||||
if let raw = loadString(service: watchRefreshHandledKey), let ts = TimeInterval(raw) {
|
||||
return Date(timeIntervalSince1970: ts)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
static var hasPendingWatchRefreshRequest: Bool {
|
||||
guard let requested = loadWatchRefreshRequest() else { return false }
|
||||
guard let handled = loadWatchRefreshHandled() else { return true }
|
||||
return requested > handled
|
||||
}
|
||||
|
||||
// MARK: Relay metadata — shown in Settings → About. Written after each
|
||||
// successful full fetch so the About section reflects the live source.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user