Settings Debug: device coordinates + in-range station indicator
- Debug section now shows the last device fix (lat/lng to 5dp) and its age. - In-range indicator uses the SAME criteria as live alerts: stations selling the monitored fuel within the alert radius of the fix. Green dot + count when in range, red when none, grey while waiting for a fix. - Shows the cheapest in-range station (name, distance, price). - ProximityMonitor recomputes the snapshot on every location/stations change and on Debug-section appear; ContentView passes the live status. - SettingsView extracted to its own property to keep TabView body within the compiler type-check budget. 35 tests pass.
This commit is contained in:
+18
-10
@@ -144,16 +144,7 @@ struct ContentView: View {
|
||||
)
|
||||
.tabItem { Label("Alerts", systemImage: "bell.fill") }
|
||||
|
||||
SettingsView(
|
||||
distanceUnit: $distanceUnit,
|
||||
alertsFuel: alertsFuel,
|
||||
alertsRadiusKM: alertsRadius,
|
||||
testAlertResult: monitor.lastTestResult,
|
||||
onTestAlert: { monitor.sendTestNotification() },
|
||||
onPlainTestAlert: { monitor.sendPlainTestNotification() },
|
||||
onShowOnboarding: { showOnboarding = true }
|
||||
)
|
||||
.tabItem { Label("Settings", systemImage: "gearshape.fill") }
|
||||
settingsTab
|
||||
}
|
||||
.fullScreenCover(isPresented: $showOnboarding) {
|
||||
OnboardingView {
|
||||
@@ -255,6 +246,23 @@ struct ContentView: View {
|
||||
}
|
||||
}
|
||||
|
||||
/// The Settings tab, extracted from `body` so the TabView expression stays
|
||||
/// within the compiler's type-check budget.
|
||||
private var settingsTab: some View {
|
||||
SettingsView(
|
||||
distanceUnit: $distanceUnit,
|
||||
alertsFuel: alertsFuel,
|
||||
alertsRadiusKM: alertsRadius,
|
||||
testAlertResult: monitor.lastTestResult,
|
||||
onTestAlert: { monitor.sendTestNotification() },
|
||||
onPlainTestAlert: { monitor.sendPlainTestNotification() },
|
||||
onRefreshDebugStatus: { monitor.refreshDebugStatus() },
|
||||
onShowOnboarding: { showOnboarding = true },
|
||||
debugStatus: monitor.debugStatus
|
||||
)
|
||||
.tabItem { Label("Settings", systemImage: "gearshape.fill") }
|
||||
}
|
||||
|
||||
private func toggleFavourite(_ station: FuelStation, fuel: FuelType) {
|
||||
let key = FavouriteEntry(station: station, fuel: fuel)
|
||||
if favourites.contains(where: { $0.id == key.id }) {
|
||||
|
||||
Reference in New Issue
Block a user