Skip to content

fix(mobile): recover the QR pairing scanner when camera access is denied - #6487

Open
hey-jj wants to merge 1 commit into
pingdotgg:mainfrom
hey-jj:fix/qr-camera-recovery
Open

fix(mobile): recover the QR pairing scanner when camera access is denied#6487
hey-jj wants to merge 1 commit into
pingdotgg:mainfrom
hey-jj:fix/qr-camera-recovery

Conversation

@hey-jj

@hey-jj hey-jj commented Aug 13, 2026

Copy link
Copy Markdown

What Changed

openScanner in ConnectionsNewRouteScreen now reads canAskAgain off 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 calls Linking.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. SettingsRouteScreen checks canAskAgain on 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.

before after

Verification

tsc --noEmit in apps/mobile exits clean. vp lint and vp fmt --check on 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/mobile is a pure-logic .test.ts file and the repo carries no React Native testing library, so covering an alert branch would mean adding that infrastructure first.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

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.

openScanner now branches on permission.canAskAgain after a denied requestCameraPermission() 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 calling Linking.openSettings()—the same pattern as notification permission handling on SettingsRouteScreen.

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.

@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ef40c6a1-0fdb-4a12-bf1f-98a8cced0c8f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Aug 13, 2026
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.
@hey-jj
hey-jj force-pushed the fix/qr-camera-recovery branch from 227b7c7 to 576bf70 Compare August 13, 2026 15:55
@hey-jj
hey-jj marked this pull request as ready for review August 13, 2026 15:56
@macroscopeapp

macroscopeapp Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: QR pairing scanner dead-ends once camera access is denied

1 participant