Pass locationPermissionGranted=true when permission was already grant…#83354
Conversation
| setStartLocationPermissionFlow(true); | ||
| return; | ||
| } | ||
| navigateToConfirmationStep(newReceiptFiles, true); |
There was a problem hiding this comment.
❌ CONSISTENCY-3 (docs)
The GPS permission handling logic inside processReceipts and submitReceipts is structurally identical — both check shouldSkipConfirmation, gpsRequired, shouldStartLocationPermissionFlow, and now both call navigateToConfirmationStep(files, true); return; in the same way. This PR extends the existing duplication with the same two new lines in both functions.
Consider extracting a shared helper that encapsulates the skip-confirmation + GPS navigation decision, for example:
function navigateWithLocationCheck(files: ReceiptFile[]) {
if (shouldSkipConfirmation) {
const gpsRequired = initialTransaction?.amount === 0 && iouType !== CONST.IOU.TYPE.SPLIT;
if (gpsRequired) {
if (shouldStartLocationPermissionFlow) {
setStartLocationPermissionFlow(true);
return;
}
navigateToConfirmationStep(files, true);
return;
}
}
navigateToConfirmationStep(files, false);
}Then both processReceipts and submitReceipts can call navigateWithLocationCheck(files) instead of duplicating this block.
Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4bd6caca42
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| setStartLocationPermissionFlow(true); | ||
| return; | ||
| } | ||
| navigateToConfirmationStep(newReceiptFiles, true); |
There was a problem hiding this comment.
Respect prompt cooldown before treating location as granted
Passing true here makes the skip-confirmation flow behave as if location access is already granted whenever shouldStartLocationPermissionFlow is false, but that flag is also false when the user recently tapped “Not now” (see updateLastLocationPermissionPrompt usage in IOURequestStepScan/index.tsx). In that case handleMoneyRequestStepScanParticipants() will call getCurrentPosition(), which requests foreground permission again, effectively bypassing the cooldown and re-prompting users you intentionally deferred; this affects both this branch and the mirrored submitReceipts branch.
Useful? React with 👍 / 👎.
trjExpensify
left a comment
There was a problem hiding this comment.
- Please add the screen recordings to the OP for tests.
- To clarify on this step, the typical fallback is the user's default currency isn't it? Not just randomly USD?
Verify the expense is created with the correct location-based currency (not a fallback like USD)
|
Updated, yep that's the expected result |
Reviewer Checklist
Screenshots/Videos |
Can you please do this? Thanks. |
|
Added videos for all platforms but android web |
|
@MobileMage is it not working correctly for you on Android Chrome? I was having the same problem. |
|
Yeah, just keeps loading after uploading an image @Ollyws |
|
🚧 @Valforte has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/Valforte in version: 9.3.37-0 🚀
|
|
Deploy Blocker #85158 was identified to be related to this PR. |
|
🚀 Deployed to production by https://github.com/cristipaval in version: 9.3.37-10 🚀
|





Explanation of Change
When a user scans a receipt without currency via the Quick Action Button (QAB), the app should use GPS coordinates to determine the correct currency based on location. However, after the user has already granted location permission (e.g., from a previous expense creation), subsequent receipt scans fail to collect GPS coordinates because
navigateToConfirmationStepis called withlocationPermissionGranted = falsehardcoded, even when permission was already granted.This fix updates
useReceiptScan.tsso that whenshouldSkipConfirmationis true, GPS is required, andshouldStartLocationPermissionFlowreturns false (meaning permission was already granted), we passlocationPermissionGranted = truetonavigateToConfirmationStep. This ensuresgetCurrentPositionis called downstream to collect GPS coordinates, allowing the backend to assign the correct location-based currency.The fix applies to both the
processReceiptsandsubmitReceiptsfunctions.Fixed Issues
$ #81184
PROPOSAL: #81184 (comment)
Tests
Precondition: Location permission should be granted
Offline tests
N/A -- GPS/location and receipt scanning require network connectivity.
QA Steps
Same as tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Kapture.2026-03-10.at.02.26.49.mp4
Android: mWeb Chrome
iOS: Native
Kapture.2026-03-10.at.01.49.23.mp4
iOS: mWeb Safari
Kapture.2026-03-10.at.12.43.33.mp4
MacOS: Chrome / Safari
Kapture.2026-03-05.at.21.37.49.mp4