Default station taps to the detail sheet
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.
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user