Location-driven results: widget fetches its own location (async, cache fallback), app auto-requests on first launch, Halifax sample stations
This commit is contained in:
@@ -2,11 +2,6 @@ import SwiftUI
|
||||
import CoreLocation
|
||||
import WidgetKit
|
||||
|
||||
struct Coordinate: Equatable {
|
||||
let lat: Double
|
||||
let lng: Double
|
||||
}
|
||||
|
||||
struct ContentView: View {
|
||||
@Environment(\.scenePhase) private var scenePhase
|
||||
|
||||
@@ -111,6 +106,11 @@ struct ContentView: View {
|
||||
}
|
||||
}
|
||||
.onAppear {
|
||||
// Auto-request location on first launch so the widget gets a
|
||||
// fresh fix without the user hunting for the button.
|
||||
if FuelStore.loadLocation() == nil {
|
||||
locationManager.requestUpdate()
|
||||
}
|
||||
Task { await refresh() }
|
||||
}
|
||||
.onChange(of: scenePhase) { _, newPhase in
|
||||
|
||||
Reference in New Issue
Block a user