From 5d26509034a18e4985647d6a7435b7870bea8fcd Mon Sep 17 00:00:00 2001 From: FuelBoard Contributor Date: Wed, 19 Aug 2026 16:39:49 +0100 Subject: [PATCH] live activity: always render full card (drop compact fallback) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Long station names inflated richBody's IDEAL width, so ViewThatFits (which measures ideal, untruncated text) decided 'rich doesn't fit' and fell back to the compact strip — that's why 5-mi / long-named activities rendered small while 10-15-mi / short names stayed full. With .supplementalActivityFamilies already removed, the body is only ever Lock-Screen width, so drop ViewThatFits and compactBody entirely and always render the full three-column card; the station caption line-limits + scale-downs + tail-truncates in place. --- .../FuelBoardLiveActivityView.swift | 55 ++++--------------- 1 file changed, 12 insertions(+), 43 deletions(-) diff --git a/FuelBoardWidgets/FuelBoardLiveActivityView.swift b/FuelBoardWidgets/FuelBoardLiveActivityView.swift index df2b722..8d6a242 100644 --- a/FuelBoardWidgets/FuelBoardLiveActivityView.swift +++ b/FuelBoardWidgets/FuelBoardLiveActivityView.swift @@ -62,25 +62,19 @@ struct FuelBoardLiveActivity: Widget { private struct FuelBoardLiveActivityView: View { let context: ActivityViewContext - /// Full rich layout needs at least this much width. iPhone/iPad Lock - /// Screen Live Activities are always wider than this, so they get the - /// full view; the CarPlay/Apple Watch Smart Stack small slot is far - /// narrower, so it reliably falls through to `compactBody`. - private let richMinWidth: CGFloat = 290 - /// Only genuinely small slots get the compact strip — cap it so a - /// mid-width surface can never squeeze the full view into the car. - private let compactMaxWidth: CGFloat = 220 - var body: some View { Link(destination: context.state.mapsURL) { - ViewThatFits(in: .horizontal) { - // rich first — wins on full-width Lock Screen / banner - richBody - .frame(minWidth: richMinWidth) - // compact fallback — the car's small supplemental slot - compactBody - .frame(maxWidth: compactMaxWidth) - } + // Always the full three-column card. The station caption is + // line-limited + scale-down + tail-truncated, so a LONG station + // name truncates in place instead of inflating this view's ideal + // width and tricking ViewThatFits into falling back to the compact + // strip (that is exactly what made 5-mi / long-named activities + // render small while 10-15-mi / short names stayed full). + // + // No ViewThatFits / compactBody: with `.supplementalActivityFamilies` + // removed, this body is only ever handed Lock-Screen width, so the + // compact fallback was both dead weight and the cause of the bug. + richBody } } @@ -119,32 +113,7 @@ private struct FuelBoardLiveActivityView: View { .padding() } - /// Minimal strip for the small CarPlay / Watch Smart Stack slot: - /// glyph + fuel left, bold price right, truncated station below. - private var compactBody: some View { - VStack(alignment: .leading, spacing: 3) { - HStack(spacing: 5) { - Image(systemName: "fuelpump.fill") - .font(.caption2) - .foregroundStyle(.green) - Text(context.state.fuel.displayName) - .font(.caption2.weight(.semibold)) - .lineLimit(1) - Spacer(minLength: 4) - FuelStore.priceTextAttributed(context.state.pricePence, - style: context.state.priceDisplayStyle, - size: 15, weight: .bold) - .lineLimit(1) - } - Text("\(context.state.stationName) · \(context.state.distanceText)") - .font(.system(size: 9)) - .foregroundStyle(.secondary) - .lineLimit(1) - .minimumScaleFactor(0.7) - .truncationMode(.tail) - } - .padding(8) - } + // NOTE: `compactBody` was removed — always render `richBody` (see body). } /// Dynamic Island expanded regions + compact trailing — price only.