Skip to content

Open location settings from the GPS location services modal on Android - #103197

Merged
roryabraham merged 2 commits into
mainfrom
claude-openLocationSettingsGPS
Oct 8, 2026
Merged

roryabraham merged 2 commits into
mainfrom
claude-openLocationSettingsGPS

Conversation

@MelvinBot

@MelvinBot MelvinBot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

When device location services are off, the GPS trip "Location access required" modal's Open settings button sent users to the top-level device settings page. They then had to find the location toggle themselves.

This PR opens the location settings page directly on Android:

  • Android: sends android.settings.LOCATION_SOURCE_SETTINGS instead of the generic android.settings.SETTINGS intent. If the device can't handle that intent, it falls back to Linking.openSettings() (the app's settings page), so the button never does nothing.
  • iOS: unchanged. Apple has no supported deep link to Privacy & Security > Location Services, and on iOS 26 both App-Prefs:General and App-Prefs:Privacy&path=LOCATION open the same Settings > Apps list.

Web is unchanged (openSettings/index.ts).

Fixed Issues

$ #102961
PROPOSAL: #102961 (comment)

Tests

  1. Turn off location services for the whole device
  2. Go to FAB > Track distance > GPS and tap Start.
  3. Verify a "Location access required" modal appears with Open settings and Dismiss buttons
  4. Tap Dismiss and verify the modal closes and no trip starts
  5. Tap Start again, tap Open settings, and verify the device location settings open
  6. Device settings page is opened instead of device location settings page when location is disabled in device.
  • Verify that no errors appear in the JS console

Offline tests

N/A

QA Steps

Android: Native

  1. Turn off location services for the whole device
  2. Open the app and go to FAB > Track distance > GPS, then tap Start
  3. Verify a "Location access required" modal appears with Open settings and Dismiss buttons
  4. Tap Dismiss and verify the modal closes and no trip starts
  5. Tap Start again, then tap Open settings
  6. Verify the device Location settings page opens directly (not the top-level device Settings page)

iOS: Native (regression)

  1. Turn off Location Services for the whole device (Settings > Privacy & Security > Location Services)
  2. Open the app and go to FAB > Track distance > GPS, then tap Start
  3. Verify a "Location access required" modal appears with Open settings and Dismiss buttons
  4. Tap Open settings and verify the Settings app opens (same behavior as production)

Web / mWeb (regression)

  1. Go to FAB > Track distance > GPS
  2. Verify the tab shows "Track distance on your phone" with a Download the app button, and nothing breaks
  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari

…id and iOS

Co-authored-by: Nicolás Bonet <NicolasBonet@users.noreply.github.com>
@codecov

codecov Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ Changes either increased or maintained existing code coverage, great job!

Files with missing lines Coverage Δ
...stanceGPS/GPSButtons/openSettings/index.android.ts 0.00% <0.00%> (ø)
... and 238 files with indirect coverage changes

@MelvinBot

MelvinBot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 Web test steps verification results: ✅ pass

The PR's Tests section is still a TODO, so I ran the linked issue's repro steps on web. On web, the GPS tab shows a "Track distance on your phone / Download the app" prompt with no Start button, so the native-only Open settings change can't be reached and the web flow is unaffected.
GPS tab showing Track distance on your phone with Download the app button

Step Status
Open FAB > Track distance; distance page opens with a GPS tabTrack distance opened with Map, Manual, GPS, and Odometer tabs.
Track distance panel with Map/Manual/GPS/Odometer tabs
✅
Select the GPS tab; it renders without a crash or blank screenGPS tab shows "Track distance on your phone" text and a single "Download the app" button. No Start button, no blank screen, no crash.
GPS tab showing Track distance on your phone with Download the app button
✅
Tap Start with location unavailable; "Location access required" modal appearsNot applicable on web. The GPS tab has no Start button, so the modal can't be triggered.
✅
Tap Dismiss; modal closes and no trip startsNot applicable on web. No modal appears.
✅
Tap Open settings; nothing breaks on webNot applicable on web. Open settings isn't reachable, and web openSettings is an unchanged no-op.
✅
No new JS console errors related to GPS or openSettingsConsole logs can't be captured on web in this environment. No error banners, broken layout, or crash appeared, and the app stayed interactive.
✅

view run · view recording

@MelvinBot

MelvinBot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 Android test steps verification results: ✅ pass

With device-wide Location off, the GPS "Open settings" button now opens the device Location settings page ("Use location") directly, not the top-level Settings page. Dismiss and returning to the app both worked with no crash. The PR's Tests section is still a TODO, so these steps come from the linked issue.
App home screen usable after returning from device settings

Step Status
Turn off device-wide location serviceslocation_mode is 0. The Location settings page shows "Use location" off and "Location is off".
Device Location settings page with Use location toggle off
✅
FAB > Track distance > GPS > Start shows "Location access required" modal with Open settings and DismissThe modal appeared with "Please allow location access in your device settings to start GPS distance tracking." and Dismiss and Open settings buttons.
Location access required modal with Dismiss and Open settings buttons
✅
Tap Dismiss; modal closes and no trip startsThe modal closed. The GPS tab still shows Start (not Stop), so no trip started.
GPS tab after dismissing modal, Start button still present
✅
Tap Start, then Open settings; device Location settings open directlyThe foreground activity was com.android.settings/.Settings$LocationSettingsActivity (the "Use location" page), not the top-level Settings page.
Location settings page opened directly after tapping Open settings
✅
Return to the app; it stays usable with no crashThe app came back on the GPS screen with Start intact. Navigation to Home and the nav bar worked normally.
App home screen usable after returning from device settings
✅

view run · view recording

@ZhenjaHorbach

ZhenjaHorbach commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

@NicolasBonet
Can you run adhoc builds, please, to make sure that it works correctly on iOS?

@NicolasBonet

Copy link
Copy Markdown
Contributor

@MelvinBot add the proper QA steps to the PR description

@NicolasBonet
NicolasBonet marked this pull request as ready for review October 6, 2026 15:30
@NicolasBonet
NicolasBonet requested a review from a team as a code owner October 6, 2026 15:30
@melvin-bot
melvin-bot Bot requested review from ZhenjaHorbach and joekaufmanexpensify and removed request for a team October 6, 2026 15:30
@melvin-bot

melvin-bot Bot commented Oct 6, 2026

Copy link
Copy Markdown

@ZhenjaHorbach Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@melvin-bot
melvin-bot Bot removed the request for review from a team October 6, 2026 15:30
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-06T15:41:11.697450Z 3d97c37 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

🚧 NicolasBonet has triggered a test Expensify/App build. You can view the workflow run here.

@MelvinBot

Copy link
Copy Markdown
Contributor Author

I added separate QA steps for each platform to the PR description, replacing "Same as tests":

  • Android: with location off, tap GPS Start, then Open settings. Verify the Location settings page opens, not the main Settings page.
  • iOS: same flow. Verify Privacy & Security > Location Services opens, not Settings > General. If iOS blocks the deep link, the Expensify app settings page should open instead.
  • Web / mWeb: a regression check. The GPS tab should still show "Track distance on your phone" with a Download the app button.

I left the Tests section as it was. Step 6 there describes the old bug ("Device settings page is opened instead of…"), not the expected result. You may want to remove it or reword it.


view run

@github-actions

This comment has been minimized.

@NicolasBonet

Copy link
Copy Markdown
Contributor

All yours @ZhenjaHorbach

@joekaufmanexpensify joekaufmanexpensify left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixing DB

@ZhenjaHorbach

ZhenjaHorbach commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
  • I verified tests pass on all platforms & I tested again on:
    • Android: HybridApp
    • Android: mWeb Chrome
    • iOS: HybridApp
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: HybridApp
Screen.Recording.2026-10-07.at.16.37.40.mov
Android: mWeb Chrome
Screen.Recording.2026-10-07.at.16.37.40.mov
iOS: HybridApp
Screen.Recording.2026-10-07.at.16.28.50.mov
iOS: mWeb Safari
Screen.Recording.2026-10-07.at.16.28.50.mov
MacOS: Chrome / Safari
Screen.Recording.2026-10-07.at.08.58.05.mov

@ZhenjaHorbach

Copy link
Copy Markdown
Contributor

@MelvinBot

Tap Start again, then tap Open settings
Verify the Settings app opens on Privacy & Security > Location Services (not Settings > General). If iOS blocks the deep link, verify the Expensify app settings page opens instead, so the button never does nothing

Won't your changes open the app's settings where we don't have location services settings(not Privacy & Security > Location Services)?

@MelvinBot

Copy link
Copy Markdown
Contributor Author

No. The app settings page is only a fallback. Normally the button opens Privacy & Security > Location Services.

The change first opens App-Prefs:Privacy&path=LOCATION. It calls Linking.openSettings() (Settings > Expensify) only if iOS rejects that URL (index.ios.ts:8).

You're right that Settings > Expensify can't turn on device-wide Location Services. The fallback is there so the button still does something. The old code had no fallback.

When the fallback runs

React Native rejects openURL only when iOS reports it couldn't open the URL (RCTLinkingManager.mm:91-113). If iOS opens Settings but ignores path=LOCATION, the fallback doesn't run, and you land on the Settings home page.

App-Prefs: is a private scheme, so how it behaves can change between iOS versions. I couldn't test on iOS in this run. Please check the adhoc iOS build on a device. If you'd rather drop the fallback, I can change it.


view run

@NicolasBonet

Copy link
Copy Markdown
Contributor

@ZhenjaHorbach what would be pending for the approval? 🤔

@ZhenjaHorbach

Copy link
Copy Markdown
Contributor

@ZhenjaHorbach what would be pending for the approval? 🤔

I will approve soon!
Just worried that we are using the wrong URL for iOS
But I'll try to experiment a bit

@ZhenjaHorbach

ZhenjaHorbach commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

@NicolasBonet

Looks like there's no supported way to deep link to Privacy & Security → Location Services. Apple DTS confirmed it here
On iOS 26 real devices, both the current App-Prefs:General (prod) and App-Prefs:Privacy&path=LOCATION (this branch's adhoc) just open the Settings → Apps list

I'd suggest we keep iOS as is and only ship the Android change (LOCATION_SOURCE_SETTINGS), which works as expected

@NicolasBonet

Copy link
Copy Markdown
Contributor

@MelvinBot let's do this: #103197 (comment)

…intent only

Co-authored-by: Nicolás Bonet <NicolasBonet@users.noreply.github.com>
@MelvinBot
MelvinBot requested a review from a team as a code owner October 7, 2026 14:01
@melvin-bot
melvin-bot Bot requested review from NicolasBonet and roryabraham and removed request for a team October 7, 2026 14:01
@melvin-bot

melvin-bot Bot commented Oct 7, 2026

Copy link
Copy Markdown

@NicolasBonet @roryabraham One of you needs to copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@MelvinBot MelvinBot changed the title Open location settings from the GPS location services modal on Android and iOS Open location settings from the GPS location services modal on Android Oct 7, 2026
@MelvinBot

Copy link
Copy Markdown
Contributor Author

Done. The PR now changes Android only. iOS matches production again.

  • iOS: I reverted index.ios.ts to App-Prefs:General with no fallback, the same as main.
  • Android: unchanged. It still opens LOCATION_SOURCE_SETTINGS and falls back to the app settings page.
  • PR description: I removed iOS from the title and explanation. The iOS QA steps are now a regression check.

ESLint passes on the changed folder.


view run

@roryabraham
roryabraham merged commit 1107bed into main Oct 8, 2026
56 of 76 checks passed
@roryabraham
roryabraham deleted the claude-openLocationSettingsGPS branch October 8, 2026 16:32
@OSBotify

OSBotify commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

🚧 roryabraham has triggered a test Expensify/App build. You can view the workflow run here.

@OSBotify OSBotify mentioned this pull request Oct 8, 2026
90 tasks done
@OSBotify

OSBotify commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/roryabraham in version: 9.5.6-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

@MelvinBot

Copy link
Copy Markdown
Contributor Author

No help site update is needed. This bug fix only changes which Android settings page the Open settings button opens, and no help article describes that button or where it leads.


view run

@OSBotify

OSBotify commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/puneetlath in version: 9.5.6-6 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

Bundle Size Analysis (Sentry):

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

Labels

Melvin-Test-Android Melvin-Test-Web Triggers Melvin to run the testing steps of the PR on web

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants