diff --git a/FuelBoardWidgets/FuelBoardLiveActivityView.swift b/FuelBoardWidgets/FuelBoardLiveActivityView.swift index ae46004..4c51e37 100644 --- a/FuelBoardWidgets/FuelBoardLiveActivityView.swift +++ b/FuelBoardWidgets/FuelBoardLiveActivityView.swift @@ -65,27 +65,26 @@ struct FuelBoardLiveActivity: Widget { private struct FuelBoardLiveActivityView: View { let context: ActivityViewContext - /// Full card needs at least this much width; iPhone/iPad Lock Screen is - /// always wider, so they always get it. Only genuinely small slots - /// (CarPlay small / Watch smart stack) fall through to `compactBody`. - private let richMinWidth: CGFloat = 280 - /// Cap the compact strip so a mid-width surface can't sneak it in. - private let compactMaxWidth: CGFloat = 230 + /// Below this ACTUAL proposed width we show the compact strip (CarPlay + /// small / Watch smart stack); at/above it we show the full card. The + /// decision is made from the real space the system hands the body via + /// GeometryReader, NOT from ViewThatFits ideal-width measurement — the + /// latter is broken for truncating text (a long station name inflates the + /// "ideal" width past the iPhone Lock Screen and collapses the full card). + private let compactWidthThreshold: CGFloat = 280 var body: some View { Link(destination: context.state.mapsURL) { - ViewThatFits(in: .horizontal) { - // rich FIRST — wins on the full-width iPhone/iPad Lock Screen. - // Its middle column is flexible + line-limited, so a LONG - // station name truncates in place and never inflates the ideal - // width (which used to trick ViewThatFits into falling back to - // compact on iPhone). - richBody - .frame(minWidth: richMinWidth) - // compact fallback — the small CarPlay / Watch smart-stack - // strip: fuel · price · station distance (no app name). - compactBody - .frame(maxWidth: compactMaxWidth) + GeometryReader { geo in + // Branch on the ACTUAL proposed width. iPhone/iPad offer the + // full Lock Screen width (>= threshold) → rich card, no matter + // how long the station name is. Truly small slots (CarPlay / + // Watch) offer much less → compact strip. + if geo.size.width >= compactWidthThreshold { + richBody + } else { + compactBody + } } } }