Favourites: drag-and-drop reorder per fuel; stored order drives single-widget favourite
This commit is contained in:
@@ -159,7 +159,8 @@ struct ContentView: View {
|
||||
selectedFuel: selectedFuel,
|
||||
location: location,
|
||||
distanceUnit: distanceUnit,
|
||||
onToggleFavourite: toggleFavourite
|
||||
onToggleFavourite: toggleFavourite,
|
||||
onReorder: reorderFavourites
|
||||
)
|
||||
.tabItem { Label("Favourites", systemImage: "star.fill") }
|
||||
|
||||
@@ -395,6 +396,17 @@ struct ContentView: View {
|
||||
fuel: alertsFuel, radiusKM: effectiveAlertsRadiusKM)
|
||||
}
|
||||
|
||||
/// Drag-and-drop reorder from the Favourites tab — persists the new order
|
||||
/// and refreshes every surface that consumes it (widgets + geofence
|
||||
/// priority, which follows the stored order).
|
||||
private func reorderFavourites(_ newOrder: [FavouriteEntry]) {
|
||||
favourites = newOrder
|
||||
FuelStore.saveFavourites(favourites)
|
||||
WidgetCenter.shared.reloadAllTimelines()
|
||||
monitor.update(stations: stations, favourites: refreshedFavourites,
|
||||
fuel: alertsFuel, radiusKM: effectiveAlertsRadiusKM)
|
||||
}
|
||||
|
||||
/// Fetches fresh prices, but only when the cache is stale — unless
|
||||
/// `force` is true (pull-to-refresh is the manual override).
|
||||
private func refresh(force: Bool = false) async {
|
||||
|
||||
Reference in New Issue
Block a user