Small widget: support .systemMedium so the icon menu offers both sizes

The iOS 18+ long-press app-icon menu (turn icon into a widget) shows
the supported SIZES of the FIRST-registered widget kind only — it
does not list widget kinds and is not keyed by intent type (two
distinct intents in 6375af4 changed nothing on-device). The bundle's
first kind (FuelPriceSmallWidget, small-first since 38b47ee) therefore
decided the menu offered only the small tile.

The early build worked because FuelPriceWidget was registered first
back then. Reordering to medium-first would fix the menu but flip the
gallery order (38b47ee). Instead: this first kind now supports BOTH
.systemSmall and .systemMedium, so the icon menu offers both size
tiles (ChatGPT/Safari behave the same way — their first kind supports
several families). The gallery still lists both widget kinds in bundle
order; the Small entry just gains a medium variant. The shared view
already branches on family, so medium renders the station list.
This commit is contained in:
FuelBoard Contributor
2026-08-14 02:53:52 +01:00
parent 6375af4c05
commit b94f769750
+18 -11
View File
@@ -75,16 +75,23 @@ struct FuelPriceWidget: Widget {
} }
} }
// Small widget exactly ONE station (the first of the configured result). // Small widget exactly ONE station (the first of the configured result)
// Uses its OWN intent TYPE (FuelBoardSmallWidgetConfigurationIntent) with the // when rendered at systemSmall; the SAME kind also supports .systemMedium,
// IDENTICAL minimal parameter set as the medium intent. iOS keys the // where the shared view renders the station list (identical content to the
// long-press app-icon contextual menu by configuration-intent TYPE, so two // medium widget the view branches on family, not kind).
// kinds sharing one intent collapsed there to the first-registered kind (the //
// small widget won medium vanished from the icon menu). Distinct intent // WHY medium is here (2026-08-14): the iOS 18+ long-press app-icon menu
// TYPE, same minimal params: restores both entries in the icon menu AND keeps // ("turn app icon into a widget") shows the supported SIZES of the
// fresh-widget default-config resolution working (the skeleton root cause was // FIRST-registered widget kind only it does NOT list widget kinds, and it
// the extra favourite AppEntity params, not intent separation see the // is NOT keyed by configuration-intent type (a two-intent experiment,
// Fresh-widget defaults section). Favourites sort on the small face shows the // 6375af4, changed nothing on-device). So the bundle's first kind decides
// which size tiles the icon menu offers: small-only meant the menu showed
// only the small tile even though the app has a medium widget. Giving this
// first-registered kind BOTH .systemSmall and .systemMedium puts both size
// tiles in the icon menu (ChatGPT/Safari show multiple sizes the same way
// their first kind supports several families). The gallery still lists both
// widget kinds in bundle order (small, then medium); this kind's entry just
// gains a medium variant. Favourites sort on the small face shows the
// cheapest favourite of the chosen fuel. // cheapest favourite of the chosen fuel.
struct FuelPriceSmallWidget: Widget { struct FuelPriceSmallWidget: Widget {
let kind = "FuelPriceWidgetSmall" let kind = "FuelPriceWidgetSmall"
@@ -104,7 +111,7 @@ struct FuelPriceSmallWidget: Widget {
} }
.configurationDisplayName("FuelBoard Small") .configurationDisplayName("FuelBoard Small")
.description("Fuel prices near you. Configure fuel + sort per widget.") .description("Fuel prices near you. Configure fuel + sort per widget.")
.supportedFamilies([.systemSmall]) .supportedFamilies([.systemSmall, .systemMedium])
.disfavoredLocations([.carPlay], for: [.systemSmall]) .disfavoredLocations([.carPlay], for: [.systemSmall])
} }
} }