From 29e299d55809651187498c30734073f889b9c16c Mon Sep 17 00:00:00 2001 From: FuelBoard Contributor Date: Mon, 19 Oct 2026 16:28:47 +0100 Subject: [PATCH] Default station taps to the detail sheet MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The default tap action was Directions: tapping a row handed straight off to Apple Maps. That leaves the app with no way back, and on a fresh install it hides everything the row already knows — address, distance, the Worth the Drive breakdown — behind a jump to another app. The detail sheet shows the same station with Directions one tap away inside it, so it is the better default to land on. Directions remains available, both in the sheet and by picking it in Settings. The fallback in loadStationTapAction is the whole change. Every consumer — row taps, the notification path in ProximityMonitor, Station.tapDestinationURL for widgets — already resolves the setting at the point of use rather than caching it, so none needed touching and none can drift away from the others. An explicit choice is not overridden: the fallback applies only when nothing is stored, and the only writer is the Settings picker. Anyone who deliberately chose Directions keeps it. Comments that existed to explain the old default are corrected rather than left contradicting the code — the section comment and the enum doc in FuelStore, and the FB_DETAIL_DEBUG hook's rationale in ContentView. That hook is now near redundant since the default is the sheet; it is kept because it still overrides a stored Directions on a simulator. The default itself is still untested: loadStationTapAction reads the keychain before defaults, and the SwiftPM suite never touches the keychain today, so a test would risk an access prompt hanging the run. Tests: 278 pass. --- FuelBoard/ContentView.swift | 7 ++++--- Shared/FuelStore.swift | 11 ++++++----- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/FuelBoard/ContentView.swift b/FuelBoard/ContentView.swift index a5d2dc0..d62d62c 100644 --- a/FuelBoard/ContentView.swift +++ b/FuelBoard/ContentView.swift @@ -1054,9 +1054,10 @@ struct ContentView: View { sortMode = .worthTheDrive } // QA temp: `FB_DETAIL_DEBUG=1` (DEBUG builds only) forces - // "Tap station = More info". The stored default is open-Apple-Maps, - // so on a simulator a tap bounces out to Maps with no way back and - // the Worth the Drive detail section can't be checked at all. + // "Tap station = More info". The default is already the detail + // sheet, so this only matters on a simulator whose store has + // "Directions" saved — it overrides the stored choice either way, + // which keeps the Worth the Drive detail section reachable. if ProcessInfo.processInfo.environment["FB_DETAIL_DEBUG"] == "1" { stationTapAction = .showDetails } diff --git a/Shared/FuelStore.swift b/Shared/FuelStore.swift index 29e72b6..d4bccbf 100644 --- a/Shared/FuelStore.swift +++ b/Shared/FuelStore.swift @@ -245,8 +245,8 @@ enum PriceDisplayStyle: String, Codable, CaseIterable, Identifiable { // MARK: - Station tap action /// What happens when a station row is tapped in the Stations/Favourites tabs: -/// open Apple Maps directions immediately (historic behaviour, default), or -/// show a detail sheet (name, address, distance, Directions button). +/// open Apple Maps directions immediately, or show a detail sheet (name, +/// address, distance, Directions button) — the default. enum StationTapAction: String, Codable, CaseIterable, Identifiable { case openMap // tap → Apple Maps directions straight away case showDetails // tap → detail sheet, Directions button inside @@ -801,8 +801,9 @@ struct FuelStore { saveString(style.rawValue, service: priceDisplayStyleKey) } - // MARK: Station tap action — open map vs detail sheet. Stored raw value; - // default open map preserves the historic tap behaviour for existing installs. + // MARK: Station tap action — detail sheet vs open map. Stored raw value; + // the default is the detail sheet, so a tap always lands somewhere the app + // can come back from. Directions still one tap away, inside the sheet. static let stationTapActionKey = "fuelboard.stationTapAction" @@ -810,7 +811,7 @@ struct FuelStore { if let raw = loadString(service: stationTapActionKey), let action = StationTapAction(rawValue: raw) { return action } - return .openMap + return .showDetails } static func saveStationTapAction(_ action: StationTapAction) {