fix: back button bounces user back into selected business #31

Merged
koda merged 2 commits from schwifty/fix-back-button-bounce into main 2026-03-22 22:32:12 +00:00
Collaborator

Problem

Tapping Back from ScanView takes you to the business list, but then immediately re-navigates into the same business.

Root Cause

BusinessListView.loadBusinesses() runs on .task (every mount) and checks AppPrefs.lastBusinessId — which was saved when the user selected the business. So it auto-selects the same business instantly.

Fix

  • Clear AppPrefs.lastBusinessId in backToBusinessList()
  • Add skipAutoNav flag to also prevent the single-business auto-select from firing when user explicitly went back
  • Flag resets after one load cycle so fresh app launches still auto-nav normally

Test Plan

  • Select a business → tap Back → should stay on business list
  • Select a business → kill app → reopen → should auto-nav to last business (lastBusinessId gets set on select, cleared on back)
  • Single business account → login → should auto-nav → tap Back → should stay on list

🤖 Generated with Claude Code

## Problem Tapping Back from ScanView takes you to the business list, but then immediately re-navigates into the same business. ## Root Cause `BusinessListView.loadBusinesses()` runs on `.task` (every mount) and checks `AppPrefs.lastBusinessId` — which was saved when the user selected the business. So it auto-selects the same business instantly. ## Fix - Clear `AppPrefs.lastBusinessId` in `backToBusinessList()` - Add `skipAutoNav` flag to also prevent the single-business auto-select from firing when user explicitly went back - Flag resets after one load cycle so fresh app launches still auto-nav normally ## Test Plan - [ ] Select a business → tap Back → should stay on business list - [ ] Select a business → kill app → reopen → should auto-nav to last business (lastBusinessId gets set on select, cleared on back) - [ ] Single business account → login → should auto-nav → tap Back → should stay on list 🤖 Generated with [Claude Code](https://claude.com/claude-code)
schwifty added 2 commits 2026-03-22 21:48:00 +00:00
The app crashed immediately when tapping QR scan because the Info.plist
was missing the required NSCameraUsageDescription key. iOS kills the app
with EXC_BAD_INSTRUCTION when camera access is requested without it.

Also fixes:
- Flash toggle could SIGABRT if lockForConfiguration failed (try? + unconditional unlock)
- Camera setup now logs errors instead of silently failing

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When tapping Back from ScanView, BusinessListView remounts and .task fires
loadBusinesses() which sees AppPrefs.lastBusinessId still set — immediately
re-navigating into the same business. Fix: clear lastBusinessId on back,
and add skipAutoNav flag to also prevent single-business auto-select from
firing when user explicitly navigated back.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
koda merged commit a6ba88803c into main 2026-03-22 22:32:12 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: payfrit/payfrit-beacon-ios#31
No description provided.