Alerts: move geofence monitoring status to Settings debug; plain-language footer

This commit is contained in:
FuelBoard Contributor
2026-08-14 10:34:45 +01:00
parent edf376d378
commit aa95d214e8
3 changed files with 38 additions and 30 deletions
+18 -29
View File
@@ -1,11 +1,13 @@
import SwiftUI
/// Alerts tab enables the cheapest-station proximity alerts and shows what's
/// being monitored. The fuel being monitored is chosen HERE, independently of
/// the Stations-tab selection: users can browse any fuel without re-targeting
/// their alerts (and vice versa). The Live Activity section also lives here
/// it mirrors this page's shape (toggle + fuel + distance) so the two
/// "notify me while driving" surfaces sit together.
/// Alerts tab enables the cheapest-station proximity alerts. The fuel being
/// monitored is chosen HERE, independently of the Stations-tab selection:
/// users can browse any fuel without re-targeting their alerts (and vice
/// versa). The Live Activity section also lives here it mirrors this page's
/// shape (toggle + fuel + distance) so the two "notify me while driving"
/// surfaces sit together. Geofence plumbing (count, 18-limit) lives in
/// Settings Debug; the user-facing page keeps a plain-language explainer
/// plus a 0-stations hint.
struct AlertsView: View {
@Binding var enabled: Bool
@Binding var radius: Double // stored in km (monitor + storage)
@@ -113,34 +115,21 @@ struct AlertsView: View {
Text("\(value) \(distanceUnit.label(for: Double(value)))").tag(AlertRadiusChoice.fixed(value))
}
}
if enabled && monitoredCount == 0 {
Text("No stations monitored yet — open the Stations tab to load prices first.")
.font(.caption)
.foregroundStyle(.secondary)
}
} header: {
Text("Cheapest-station alerts")
} footer: {
Text("When you approach a station that is the cheapest within the radius, FuelBoard sends a notification — even with the app closed. Alerts watch for the cheapest \\(fuel.displayName.lowercased()) station within the radius. Follow search mirrors the Stations-tab distance, capped at 8 miles for reliable geofencing.")
Text("When you approach a station that is the cheapest within the radius, FuelBoard sends a notification — even with the app closed. Nearby stations selling \(fuel.displayName.lowercased()) are watched — favourites get priority — and each station alerts at most once per hour. Follow search mirrors the Stations-tab distance, capped at 8 miles for reliable geofencing.")
}
if enabled {
Section("Monitoring") {
if monitoredCount == 0 {
Text("No stations monitored yet — open the Stations tab to load prices first.")
.font(.caption)
.foregroundStyle(.secondary)
} else {
LabeledContent("Geofenced stations", value: "\(monitoredCount)")
Text("Your favourites for \(fuel.displayName.lowercased()) get priority, then the closest stations selling that fuel fill the rest (18 max, iOS region limit).")
.font(.caption)
.foregroundStyle(.secondary)
Text("Alerts are checked against the cheapest station within the trigger radius for the fuel chosen above. Each station alerts at most once per hour.")
.font(.caption)
.foregroundStyle(.secondary)
}
}
if let lastAlert {
Section("Last alert") {
Label(lastAlert, systemImage: "bell.badge.fill")
.font(.footnote)
}
if enabled, let lastAlert {
Section("Last alert") {
Label(lastAlert, systemImage: "bell.badge.fill")
.font(.footnote)
}
}