Skip to content

feat(camera)!: migrate to @nativescript-community/perms v3 - #676

Open
NathanWalker wants to merge 1 commit into
mainfrom
fix/camera-perms-v3
Open

feat(camera)!: migrate to @nativescript-community/perms v3#676
NathanWalker wants to merge 1 commit into
mainfrom
fix/camera-perms-v3

Conversation

@NathanWalker

@NathanWalker NathanWalker commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Part of the perms v2 → v3 migration.

The bug

perms v3 resolves request() to a Status string, not the v2 [Status, boolean] tuple. mapStatus read it as a tuple:

if (result && result.length > 1) {
  if (Object.keys(Status).findIndex((k) => k === result[0]) >= 0) {
    status = Status[result[0]];
  }
}

Against v3, 'authorized'.length > 1 passes and result[0] is 'a', which matches no Status key. Every result mapped to Status.unknown, so requestPermissions(), requestCameraPermissions() and requestPhotosPermissions() all reported Success: false even when the user granted access.

function mapStatus(result: permissions.Status): Status {
  return Status[result] ?? Status.unknown;
}

The unknown-status fallback is preserved; the exported PermissionResult / PermissionsResult shapes are unchanged, so index.d.ts needs no edit.

Verification

nx build camera clean against perms 3.0.11 (with #679 applied).

Merge order

Needs #679. Merge alongside the other three migrations.

🤖 Generated with Claude Code

perms v3 changed `check()`/`request()` to resolve to a `Status` string
instead of the v2 `[Status, boolean]` tuple.

Under v3 `mapStatus` matched the first *character* of the status string
against the Status keys, so every permission result mapped to
`Status.unknown` and `requestPermissions()` always reported failure.

BREAKING CHANGE: requires @nativescript-community/perms v3. Apps pinning
perms v2 must upgrade alongside this release.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 24, 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: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d4a3eb4b-ac09-4bee-b31a-f845e61c404c

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.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant