Live Activity: price now respects the Price display style — style carried in ContentState (captured at push time, extension renders deterministically instead of re-reading storage), setting change pushes an in-place content update via explicit override (no save-ordering race)
This commit is contained in:
@@ -28,12 +28,15 @@ enum LiveActivityManager {
|
||||
|
||||
/// Recomputes the cheapest-in-radius station and updates the activity.
|
||||
/// Passing `enabled: false` (or no usable data) ends any running activity.
|
||||
/// `priceDisplayStyle` overrides the saved style (used when the setting
|
||||
/// just changed and the save may not have landed yet); nil = read storage.
|
||||
static func update(
|
||||
stations: [FuelStation],
|
||||
fuel: FuelType,
|
||||
radiusKM: Double,
|
||||
location: Coordinate?,
|
||||
enabled: Bool
|
||||
enabled: Bool,
|
||||
priceDisplayStyle: PriceDisplayStyle? = nil
|
||||
) {
|
||||
guard enabled, let location else {
|
||||
end()
|
||||
@@ -53,6 +56,7 @@ enum LiveActivityManager {
|
||||
stationName: best.name,
|
||||
brand: best.brand,
|
||||
pricePence: price,
|
||||
priceDisplayStyle: priceDisplayStyle ?? FuelStore.loadPriceDisplayStyle(),
|
||||
distanceKM: best.distanceKM(to: location.lat, lng2: location.lng),
|
||||
lat: best.lat,
|
||||
lng: best.lng,
|
||||
|
||||
Reference in New Issue
Block a user