feat: honour Tap station action on notification and Live Activity taps

Notification body/action taps route through StationTapAction:
Open map opens Apple Maps (existing); More info presents the
in-app detail sheet (falls back to the map sheet when the
station is not in cache).

Live Activity Lock Screen card and island station row pick
their Link destination the same way: Maps URL for Open map,
fuelboard://station deep link for More info, handled in
FuelBoardApp and observed by ContentView.

Also adds the small non-interactive map preview above the
Directions button in the More info sheet.
This commit is contained in:
FuelBoard Contributor
2026-09-16 13:11:36 +01:00
parent 1299b4a004
commit 465e6cd4d4
6 changed files with 108 additions and 14 deletions
+18 -2
View File
@@ -69,9 +69,25 @@ struct FuelBoardApp: App {
/// `http://maps.apple.com` form is also handled, from very old timelines.
/// In CarPlay the widget uses the same `maps://` URL, which routes to
/// Apple Maps without ever launching this app.
/// A `fuelboard://station?stationID=` link (from a Live Activity tap when
/// Settings Tap station = More info) posts a notification that
/// ContentView observes to present the detail sheet.
private func handleOpenURL(_ url: URL) {
guard let components = URLComponents(url: url, resolvingAgainstBaseURL: false),
let items = components.queryItems
guard let components = URLComponents(url: url, resolvingAgainstBaseURL: false)
else { return }
if components.scheme == "fuelboard",
components.host == "station",
let id = components.queryItems?.first(where: { $0.name == "stationID" })?.value {
NotificationCenter.default.post(
name: .fuelBoardShowStationDetail,
object: nil,
userInfo: ["stationID": id]
)
return
}
guard let items = components.queryItems
else { return }
// Preferred: maps://?daddr=lat,lng&t=d (also covers http://maps.apple.com).