Skip to content

feat(geolocation)!: migrate to @nativescript-community/perms v3 - #675

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

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

Conversation

@NathanWalker

@NathanWalker NathanWalker commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Part of the perms v2 → v3 migration. @nativescript/local-notifications@7.0.0 already requires perms v3; the remaining perms consumers in this repo still read the v2 shapes, so an app combining them gets whichever major npm hoists and the other side breaks.

The bug

perms v3 resolves check() to a Status string, not the v2 [Status, boolean] tuple. The old code indexed into it:

authorizedStatus.includes(accessFine[0]) && accessFine[1]

Against v3 that tests 'a' — the first character of 'authorized' — which is not in ['authorized', 'limited']. isEnabled() and _permissionIsGiven() therefore always resolved false, with no error thrown.

Second v3 change

LocationOptions.type was replaced by background:

-permissions.request('location', { type: 'always' })
+permissions.request('location', { background: true })

v3's getPermissionsList gates ACCESS_BACKGROUND_LOCATION on options.background === true, so the old type: 'always' silently stopped requesting background location. The type: '' on the foreground request was inert in both majors and is dropped.

Behavior parity

Dropping the tuple's second element is safe at these call sites: v2 only returned a meaningful boolean there for check('location', { type: 'always' }). These calls pass raw android permission strings, where v2 always returned true.

Verification

nx build geolocation clean against perms 3.0.11 (with #679 and #674 applied).

Merge order

Needs #679 — the workspace cannot type-check against the wrong perms major. Merge that 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, and renamed the location
`type: 'always'` option to `background: true`.

Under v3 the old tuple reads silently degraded rather than failing:
`authorizedStatus.includes(accessFine[0])` tested the first *character*
of the status string, so `isEnabled()` always resolved false.

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: 454b9d00-10cf-4437-9d9a-bb20d9456631

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