Widgets: merge small+medium into one kind (both sizes, one gallery entry)

This commit is contained in:
FuelBoard Contributor
2026-08-14 09:52:50 +01:00
parent e62177ae2e
commit 3dd567a5cc
3 changed files with 20 additions and 100 deletions
-48
View File
@@ -120,51 +120,3 @@ struct FuelBoardWidgetConfigurationIntent: WidgetConfigurationIntent, WidgetConf
}
}
}
// The SMALL widget's OWN intent TYPE. iOS keys the long-press app-icon
// contextual menu (iOS 18+ "turn icon into a widget") by configuration-intent
// TYPE, so two widget kinds sharing one intent collapse there to a single
// entry the first-registered kind. (The + gallery is kind-keyed, which is
// why it still lists both.) This intent carries the IDENTICAL minimal
// parameter set as the medium intent fuel/sort/distance only, NO AppEntity
// params (the favouriteFuel/favourite AppEntity params were what broke
// fresh-widget default-config resolution, not intent separation; see
// Fresh-widget defaults). Sharing the generic provider keeps the timeline
// logic in one place.
struct FuelBoardSmallWidgetConfigurationIntent: WidgetConfigurationIntent, WidgetConfigValues {
static var title: LocalizedStringResource = "Fuel & Sort"
static var description = IntentDescription("Which fuel, ordering and search radius this widget shows.")
@Parameter(title: "Fuel", default: .e10)
var fuel: WidgetFuel
@Parameter(title: "Sort by", default: .cheapest)
var sort: WidgetSort
@Parameter(title: "Distance", default: WidgetDistance(id: 5))
var distance: WidgetDistance
/// Edit-Widget UI: same layout as the medium intent Distance only for
/// Cheapest ordering; hidden for Closest and Favourites.
static var parameterSummary: some ParameterSummary {
When(\.$sort, .equalTo, WidgetSort.cheapest) {
Summary("Show \(\.$fuel) by \(\.$sort) within \(\.$distance)") {
\.$fuel
\.$sort
\.$distance
}
} otherwise: {
When(\.$sort, .equalTo, WidgetSort.favourites) {
Summary("Show \(\.$fuel) favourites") {
\.$fuel
\.$sort
}
} otherwise: {
Summary("Show \(\.$fuel) by \(\.$sort)") {
\.$fuel
\.$sort
}
}
}
}
}