From 7357eb98c34f4e719a6e9f483a1f9f785d3901ba Mon Sep 17 00:00:00 2001 From: FuelBoard Contributor Date: Thu, 13 Aug 2026 16:51:21 +0100 Subject: [PATCH] Small widget favourites: fuel row returns to the config sheet (picks the default favourite); pinned favourite wins, fuel-tagged picker rows when favourites span >1 fuel; fallback = selected fuel's cheapest favourite --- FuelBoardWidgets/FuelPriceWidget.swift | 37 +++++++++++++++-------- FuelBoardWidgets/WidgetConfigIntent.swift | 20 ++++++------ 2 files changed, 35 insertions(+), 22 deletions(-) diff --git a/FuelBoardWidgets/FuelPriceWidget.swift b/FuelBoardWidgets/FuelPriceWidget.swift index 7501eb7..b471c9f 100644 --- a/FuelBoardWidgets/FuelPriceWidget.swift +++ b/FuelBoardWidgets/FuelPriceWidget.swift @@ -162,20 +162,31 @@ struct FuelPriceTimelineProvider 1 return DisplayRepresentation( - stringLiteral: hasOtherFuel ? "\(name) · \(entry.fuel.displayName)" : name + stringLiteral: multiFuel ? "\\(name) · \\(entry.fuel.displayName)" : name ) } @@ -167,9 +167,10 @@ struct FuelBoardWidgetConfigurationIntent: WidgetConfigurationIntent, WidgetConf // SMALL widget intent: same knobs as the list widget, PLUS a pinned-favourite // picker for Favourites sort (a small widget shows exactly ONE station, so the -// user chooses which favourite). In Favourites mode the Fuel + Distance rows -// are hidden — the chosen favourite carries its own fuel, and there is no -// radius when a station is pinned. +// user chooses which favourite). Favourites mode keeps the Fuel row — it +// mirrors the app's Favourites tab: pick the fuel, then the favourite. The +// pinned favourite wins when set; the Fuel row picks the default favourite on +// a fresh widget. Distance stays hidden (a pinned station has no radius). struct FuelBoardSmallWidgetConfigurationIntent: WidgetConfigurationIntent, WidgetConfigValues { static var title: LocalizedStringResource = "Fuel & Sort" static var description = IntentDescription("Which fuel, ordering, radius and pinned favourite this small widget shows.") @@ -190,8 +191,9 @@ struct FuelBoardSmallWidgetConfigurationIntent: WidgetConfigurationIntent, Widge static var parameterSummary: some ParameterSummary { When(\.$sort, .equalTo, WidgetSort.favourites) { - Summary("Show \(\.$favourite)") { + Summary("Show \(\.$fuel) favourite \(\.$favourite)") { \.$sort + \.$fuel \.$favourite } } otherwise: {