From aed99e3f32530be3904b76508bb8204f7c6d44cf Mon Sep 17 00:00:00 2001 From: FuelBoard Contributor Date: Fri, 14 Aug 2026 14:05:42 +0100 Subject: [PATCH] Siri directions: speak the station before Maps hand-off (.result(opensIntent:dialog:)) --- FuelBoard/SiriShortcuts.swift | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/FuelBoard/SiriShortcuts.swift b/FuelBoard/SiriShortcuts.swift index 77a0d22..374d567 100644 --- a/FuelBoard/SiriShortcuts.swift +++ b/FuelBoard/SiriShortcuts.swift @@ -148,7 +148,7 @@ struct DirectionsToCheapestFuelIntent: AppIntent { self.fuel = fuel } - func perform() async throws -> some IntentResult & OpensIntent { + func perform() async throws -> some IntentResult & ProvidesDialog & OpensIntent { let stations = FuelStore.loadStations() guard !stations.isEmpty else { @@ -172,8 +172,17 @@ struct DirectionsToCheapestFuelIntent: AppIntent { throw DirectionsError("I couldn't find any station selling \(fuelName) within \(radiusText) of you.") } + // Speak where we're taking the user BEFORE the Maps hand-off — a + // silent jump straight into Maps is jarring. The `.result(opensIntent: + // dialog:)` overload (confirmed in the iOS 26 SDK interface) lets the + // intent do both: announce the station, then open it. + let distanceKM = station.distanceKM(to: coordinate.lat, lng2: coordinate.lng) + let distanceText = FuelStore.loadDistanceUnit().format(distanceKM) let url = SiriCheapestLookup.mapsURL(latitude: station.lat, longitude: station.lng) - return .result(opensIntent: OpenURLIntent(url)) + return .result( + opensIntent: OpenURLIntent(url), + dialog: IntentDialog(stringLiteral: "Opening Maps to \(station.name), \(distanceText) away.") + ) } }