feat: add real watch companion and dual IPA build workflow

This commit is contained in:
FuelBoard Contributor
2026-08-17 22:41:12 +01:00
parent cd2632377a
commit e004f25a31
16 changed files with 1293 additions and 28 deletions
File diff suppressed because one or more lines are too long
+15 -1
View File
@@ -327,7 +327,10 @@ struct ContentView: View {
monitor.update(stations: stations, favourites: refreshedFavourites,
fuel: alertsFuel, radiusKM: effectiveAlertsRadiusKM)
updateLiveActivity()
// No network fetch on foreground pull-to-refresh is the override.
if FuelStore.hasPendingWatchRefreshRequest {
Task { await handlePendingWatchRefreshRequest() }
}
// No network fetch on foreground unless the watch explicitly requests one.
} else {
locationManager.stopForegroundTracking()
}
@@ -680,6 +683,11 @@ struct ContentView: View {
fuel: alertsFuel, radiusKM: effectiveAlertsRadiusKM)
}
private func handlePendingWatchRefreshRequest() async {
guard FuelStore.hasPendingWatchRefreshRequest else { return }
await refresh(force: true)
}
/// Fetches fresh prices, but only when the cache is stale unless
/// `force` is true (pull-to-refresh is the manual override).
private func refresh(force: Bool = false) async {
@@ -698,6 +706,9 @@ struct ContentView: View {
stations = fetched
FuelStore.saveStations(fetched)
FuelStore.saveLastRefresh()
if force, FuelStore.hasPendingWatchRefreshRequest {
FuelStore.markWatchRefreshHandled()
}
// Persist envelope metadata (source, station count, GOV.UK
// dataset update time) for the Settings About section the
// live chain records whichever leg served the fetch.
@@ -720,6 +731,9 @@ struct ContentView: View {
// Live data restored any status banner no longer applies.
dataStatus = .live
} catch {
if force, FuelStore.hasPendingWatchRefreshRequest {
FuelStore.markWatchRefreshHandled()
}
statusMessage = "Live fetch failed: \(error.localizedDescription). Showing cached data."
if FuelStore.loadStations().isEmpty {
// No cached prices last resort is the bundled REAL dump