fix(mobile): recover the QR pairing scanner when camera access is denied - #6487
fix(mobile): recover the QR pairing scanner when camera access is denied#6487hey-jj wants to merge 1 commit into
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Denying the camera prompt once left the QR pairing scanner with no way out. Later taps resolved denied with no OS prompt and showed a one-button alert, so the camera became unreachable from inside the app. openScanner now branches on canAskAgain and offers Cancel and Open Settings when the system will not prompt again, matching the notification permission flow on the Settings screen.
227b7c7 to
576bf70
Compare
ApprovabilityVerdict: Approved 576bf70 Simple UX fix that adds an 'Open Settings' button when camera permission is permanently denied, following the exact same pattern already used for notification permissions in SettingsRouteScreen.tsx. Self-contained change using standard React Native APIs. You can customize Macroscope's approvability policy. Learn more. |
What Changed
openScannerinConnectionsNewRouteScreennow readscanAskAgainoff the camera permission result. When the system can still prompt, the existing one-button alert stays. When it cannot, the alert gains Cancel and Open Settings, and Open Settings callsLinking.openSettings().Both buttons that open the scanner, the header icon and the Allow camera button on the fallback card, call
openScanner, so one branch covers both.Why
Tap Don't Allow on the camera prompt once and the QR scanner is finished. Every later tap calls
requestCameraPermission(), which resolves denied with no OS prompt, and the screen shows a one-button alert that leads nowhere. The user cannot reach the camera from inside the app again.The Settings screen already solves this for notifications.
SettingsRouteScreencheckscanAskAgainon the denied result and offers Cancel and Open Settings. This copies that shape.Fixes #6486
UI Changes
Before: one alert, "Camera access needed", body "Allow camera access to scan an environment pairing QR code.", OK.
Before and after screenshots attach below.
After, when the system will not prompt again: "Camera access needed", body "Camera access was denied for this app. Open Settings to enable it.", Cancel and Open Settings.
Verification
tsc --noEmitinapps/mobileexits clean.vp lintandvp fmt --checkon the changed file both pass.The screenshots above come from an iPhone 16e simulator on iOS 26.3 with camera access already denied. The whole recovery was walked on that build. The header button showed the new alert, Open Settings left the app and landed on Settings under Privacy and Security, Camera, the app's toggle there turned camera access back on, and the header button then opened the scanner instead of the alert.
No test comes with this. Every test under
apps/mobileis a pure-logic.test.tsfile and the repo carries no React Native testing library, so covering an alert branch would mean adding that infrastructure first.Checklist
Note
Fix QR pairing scanner recovery when camera access is permanently denied
Updates the camera permission denied handling in ConnectionsNewRouteScreen.tsx to distinguish between two denied states. If the permission can still be requested again, an informational alert is shown. If the permission is permanently denied, the alert includes an "Open Settings" action that calls
Linking.openSettings()so users can grant access from the OS settings.Macroscope summarized 576bf70.
Note
Low Risk
Small UX change to camera permission alerts with no auth, data, or core business logic impact.
Overview
Fixes a dead-end when the user denies camera access and the OS will not show the permission prompt again on the Add Environment / QR scanner flow.
openScannernow branches onpermission.canAskAgainafter a deniedrequestCameraPermission()result. If the system can still prompt, the existing informational alert stays. If not, the alert explains that access was denied and offers Cancel and Open Settings, with Open Settings callingLinking.openSettings()—the same pattern as notification permission handling onSettingsRouteScreen.Both entry points (header scan control and the fallback Allow camera button) use
openScanner, so the recovery path applies everywhere the scanner is opened.Reviewed by Cursor Bugbot for commit 576bf70. Bugbot is set up for automated code reviews on this repo. Configure here.