Live Activity: cheapest-in-radius Lock Screen/Dynamic Island pill
- Shared FuelBoardLiveActivityAttributes/ContentState (app + widget targets) - FuelBoardLiveActivity Widget: ActivityConfiguration rendered by the widget extension - Lock Screen banner + Dynamic Island (leading/trailing/bottom, compact, minimal), tap anywhere -> maps:// directions to the best station - LiveActivityManager (app side): request/update/end; mirrors the app list's TOP badge (selected fuel + chosen distance radius, price-then-distance ties); local start-date tracking for the 8h cap (this SDK's Activity has no startDate) - auto-restarts at 7h59m; silent no-op when disabled/denied - Wiring: 250m/60s location hook (incl. background significant-change wake-ups), refresh completion, fuel/radius/unit changes, toggle flip - Settings toggle + FuelStore persistence (keychain-backed, app-group) - App-Info.plist: NSSupportsLiveActivities
This commit is contained in:
@@ -12,6 +12,10 @@ 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. Mirrors the app list's TOP badge (selected fuel +
|
||||
/// distance radius) and re-updates as the user drives.
|
||||
@Binding var liveActivityEnabled: Bool
|
||||
/// 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
|
||||
@@ -66,6 +70,17 @@ 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)
|
||||
} header: {
|
||||
Text("Live Activity")
|
||||
} footer: {
|
||||
Text("Shows the cheapest station for your selected fuel within your chosen distance on the Lock Screen and Dynamic Island. 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()
|
||||
|
||||
Reference in New Issue
Block a user