Skip to content

feat(imagepicker)!: migrate to @nativescript-community/perms v3 - #677

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

feat(imagepicker)!: migrate to @nativescript-community/perms v3#677
NathanWalker wants to merge 1 commit into
mainfrom
fix/imagepicker-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 single-permission request() to a Status string instead of the v2 [Status, boolean] tuple. The multi-permission MultiResult shape is unchanged, and mapResult discriminated between the two by array-shape:

if (Array.isArray(result) && result.length == 2) {
  authorized = result[0] === 'authorized' || result[0] === 'limited';
} else {
  // MultiResult branch
}

A v3 status string is not an array, so it fell to the MultiResult branch, found none of READ_MEDIA_IMAGES / READ_MEDIA_VIDEO on it, and left authorized at its true initializer. authorize() reported success no matter what the user chose — including on iOS, where request('photo') always returns a bare status.

Discriminating on typeof result === 'string' covers both call shapes correctly.

Breaking

AuthorizationResult.details is a public type and changes:

-details: MultiResult | Result;
+details: MultiResult | Status;

Result is generic in v3 (Result<T>) and no longer names the single-permission result at all — Status does.

Verification

nx build imagepicker 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 single-permission `request()` to resolve to a `Status`
string instead of the v2 `[Status, boolean]` tuple; the multi-permission
`MultiResult` shape is unchanged.

Under v3 `mapResult` took the MultiResult branch for a plain status
string, found none of the media permission keys on it, and returned
`authorized: true` regardless of what the user chose.

BREAKING CHANGE: `AuthorizationResult.details` is now `MultiResult | Status`
rather than `MultiResult | Result`, and perms v3 is required. 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: 6027f348-0614-45ed-a34b-a1c87c420999

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