Offline banner: label the bundled-dump fallback with its snapshot date
The no-network last resort (bundled real dump) now shows a tappable banner above the tabs — 'Offline data from 15 Aug / Pull to refresh to update prices' — so stale snapshot data is never presented as live. Banner date comes from the dump's own data_updated stamp (FuelStore.offlineDataLabel, ISO 8601 with/without fractional seconds). Cleared on any successful fetch. - BundledDumpProvider.dataUpdatedStamp (JSONSerialization, app target) - ContentView: offlineDataDate state, offlineBanner view (tip-card styling, orange wifi.slash + arrow.clockwise, tap = force refresh), refresh() clears/sets it, -forceOfflineDump QA launch hook (serves the dump and skips auto-refresh so the banner stays up for captures) - Localizable.strings: 3 keys (banner title/subtitle/a11y) - +3 tests: OfflineDataLabelTests (101 total)
This commit is contained in:
@@ -15,4 +15,14 @@ enum BundledDumpProvider {
|
||||
guard let asset = NSDataAsset(name: "FuelBoardDump") else { return nil }
|
||||
return try? FuelPriceProvider.decodeStations(from: asset.data)
|
||||
}
|
||||
|
||||
/// The GOV.UK `data_updated` stamp from the bundled envelope (ISO 8601).
|
||||
/// Labels the offline-data banner honestly ("Offline data from 15 Aug")
|
||||
/// instead of presenting the build's snapshot as live.
|
||||
static var dataUpdatedStamp: String? {
|
||||
guard let asset = NSDataAsset(name: "FuelBoardDump"),
|
||||
let obj = try? JSONSerialization.jsonObject(with: asset.data)
|
||||
as? [String: Any] else { return nil }
|
||||
return obj["data_updated"] as? String
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user