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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user