Siri: favourite price + favourite directions (top favourite per fuel); trim to 10 AppShortcuts (Apple cap)
This commit is contained in:
@@ -60,6 +60,23 @@ enum SiriCheapestLookup {
|
||||
return plain.date(from: string)
|
||||
}
|
||||
|
||||
/// The user's TOP favourite for `fuel`: the first entry in the manual
|
||||
/// favourites order (the Favourites tab's drag-and-drop order IS the
|
||||
/// widget/priority order — the first station of a fuel is its "single
|
||||
/// widget" favourite). Favourites are refreshed against the current
|
||||
/// station dump first so prices are as fresh as the cache allows;
|
||||
/// stations missing from the dump keep their cached snapshot, so the
|
||||
/// answer still works fully offline. Returns nil when the user has no
|
||||
/// favourite for that fuel.
|
||||
static func topFavourite(
|
||||
in favourites: [FavouriteEntry],
|
||||
from stations: [FuelStation],
|
||||
fuel: FuelType
|
||||
) -> FavouriteEntry? {
|
||||
let refreshed = FuelStore.refreshedFavourites(favourites, from: stations)
|
||||
return refreshed.first { $0.fuel == fuel }
|
||||
}
|
||||
|
||||
/// Apple Maps URL for turn-by-turn directions to a point. MUST be the
|
||||
/// universal-link form (https://maps.apple.com) — OpenURLIntent rejects
|
||||
/// custom schemes like `maps://`, and the https form survives copy/paste
|
||||
|
||||
Reference in New Issue
Block a user