Alerts tab: picker-style config matching Live Activity; move Live Activity there

- Alerts section restyled to mirror the Live Activity section: one section
  with toggle + Fuel picker + Radius picker (was segmented fuel + slider)
- Alert radius options expanded to 1/2/3/5/8/10/15/20 (display unit, snapped
  to nearest option; stored km unchanged; validation widened to 33 km)
- Live Activity section moved from Settings into the Alerts tab so both
  'notify while driving' surfaces sit together
- SettingsView loses the Live Activity bindings/section
This commit is contained in:
FuelBoard Contributor
2026-08-12 22:30:54 +01:00
parent a721ccd187
commit 7f7c0fff03
4 changed files with 66 additions and 74 deletions
-35
View File
@@ -12,14 +12,6 @@ import WidgetKit
/// with no criteria at all.
struct SettingsView: View {
@Binding var distanceUnit: DistanceUnit
/// Whether the "cheapest nearby" Live Activity is shown on the Lock Screen
/// / Dynamic Island. Tracks its OWN fuel + radius (below) independent of
/// the Stations tab.
@Binding var liveActivityEnabled: Bool
/// Fuel the Live Activity tracks (independent of the Stations tab).
@Binding var liveActivityFuel: FuelType
/// Search radius (miles, 5/10/15) the Live Activity uses.
@Binding var liveActivityRadiusMiles: Int
/// The fuel + radius currently configured for alerts (mirrors the Alerts
/// tab) so the test notification matches what real alerts will say.
var alertsFuel: FuelType = .e10
@@ -74,33 +66,6 @@ struct SettingsView: View {
Text("Distances and search radii across the app, widget and alerts are shown in this unit.")
}
Section {
Toggle("Live Activity", isOn: $liveActivityEnabled)
Picker("Fuel", selection: $liveActivityFuel) {
ForEach(FuelType.allCases) { fuel in
Text(fuel.displayName).tag(fuel)
}
}
.onChange(of: liveActivityFuel) { _, newValue in
FuelStore.saveLiveActivityFuel(newValue)
}
Picker("Distance", selection: $liveActivityRadiusMiles) {
ForEach(FuelStore.stationRadiusOptions, id: \.self) { miles in
Text("\(miles) \(distanceUnit.label)").tag(miles)
}
}
.onChange(of: liveActivityRadiusMiles) { _, newValue in
FuelStore.saveLiveActivityRadiusMiles(newValue)
}
} header: {
Text("Live Activity")
} footer: {
Text("Shows the cheapest station for the fuel and distance you pick here on the Lock Screen and Dynamic Island — independent of the Stations tab. Updates as you drive; tap to open directions. Live Activities can be disabled in System Settings → Live Activities.")
}
.onChange(of: liveActivityEnabled) { _, newValue in
FuelStore.saveLiveActivityEnabled(newValue)
}
Section {
Button {
onShowOnboarding()