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:
FuelBoard Contributor
2026-08-14 21:06:04 +01:00
parent 8a589a35c1
commit bfb59d498a
4 changed files with 29 additions and 7 deletions
@@ -70,7 +70,9 @@ private struct FuelBoardLiveActivityView: View {
// RIGHT price
VStack(alignment: .trailing, spacing: 2) {
FuelStore.priceTextAttributed(context.state.pricePence, size: 22, weight: .bold)
FuelStore.priceTextAttributed(context.state.pricePence,
style: context.state.priceDisplayStyle,
size: 22, weight: .bold)
Text("Tap for directions")
.font(.caption2)
.foregroundStyle(.secondary)
@@ -86,7 +88,9 @@ private struct FuelBoardLiveActivityPriceView: View {
let context: ActivityViewContext<FuelBoardLiveActivityAttributes>
var body: some View {
FuelStore.priceTextAttributed(context.state.pricePence, size: 17, weight: .bold)
FuelStore.priceTextAttributed(context.state.pricePence,
style: context.state.priceDisplayStyle,
size: 17, weight: .bold)
}
}
@@ -126,9 +130,10 @@ extension FuelBoardLiveActivityAttributes.ContentState {
}
/// Price string from pence, in the user's chosen display style
/// (station sign "129.9" or pounds "£1.29/L").
/// (station sign "129.9" or pounds "£1.29/L"). Uses the style captured
/// in the state at push time.
var priceText: String {
FuelStore.priceText(pricePence)
FuelStore.priceText(pricePence, style: priceDisplayStyle)
}
/// Apple Maps directions URL to the pinned station.