[GPS] Update user location on GPS screen when there is no active GPS trip#91418
[GPS] Update user location on GPS screen when there is no active GPS trip#91418GCyganek wants to merge 7 commits into
Conversation
|
@Expensify/design @JmillsExpensify so I added user's location updates every 5 seconds even if there is no active GPS trip, but in this case I feel like it would be better to not move the map to the updated location every time and staying on the recorded route is better than this IMO: Screen.Recording.2026-05-22.at.12.50.29.movWhat do you think? And is 5 seconds ok? |
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
|
Can you rephrase, I'm not quite following... |
|
Hmm, yes I think I agree with Gabriel. Basically if we move to the updated location it's a bit jarring with the zoom. Then additionally, the blue dot sticks at the last recorded location. Is that what you mean? |
|
Sorry, what I mean is currently because we do not update current location when GPS tracking is paused/not started the map shows the whole recorded route and user can freely move the map. But now when I added current location updates every 5 seconds when the tracking is not active, the map keeps moving to show latest location on every update, so user can't freely move the map or see the recorded trip without the map flying to latest location after a few seconds as you can see on the video. IMO it would be better to:
|
|
Nice, yeah I think that makes sense then and I agree. The first bullet makes the most sense to try first, right? |
Yep, just wanted to confirm that you want it like this |
|
Nice, I agree as well. Let's try the first one and we can always re-assess later. |
|
I'll push changes in a moment, but now it will work like this: Screen.Recording.2026-05-25.at.11.16.51.movSee it follows users location when there is no recorded trip and while recording it, but afterwards it does not follow the user, it just keeps showing the recorded route. When user moves the map and then taps map controls it moves it back to the recorded trip |
|
I think that looks good? Happy to help test as well. |
|
@codex review |
|
@shawnborton feel free to run build here to test and see if it works good for you |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 94488137b1
ℹ️ 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".
|
🚧 @shawnborton has triggered a test Expensify/App build. You can view the workflow run here. |
This comment has been minimized.
This comment has been minimized.
|
I found a bug in one edge case where it throws an error and I just fixed it, so it shouldn't appear in the next build, sorry for that in case you encounter it |
|
🚧 @shawnborton 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! 🧪🧪
|
|
I will test this tomorrow at some point I hope, sorry for the delay! |
No problem! |
The only perceivable change on this PR is that now when the tracking is not active the current location marker is still being updated every 5 seconds. The screenshot you attached has recorded route and there were no changes according to how often we do location updates while recording the GPS trip. As Jason mentioned on related issue, we will probably experiment with location updates frequency once we will work on user's activity updates. But I can change the frequency of user location updates while not recording a GPS trip if you want something else than 5 seconds |
|
Ah okay, apologies for the confusion! All good on my end then, looking forward to the route improvements :) |
No worries, will switch this for review then, thank you! |
|
@dukenv0307 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] |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppScreen.Recording.2026-05-27.at.15.38.27.movAndroid: mWeb ChromeiOS: HybridAppScreen.Recording.2026-05-27.at.15.16.30.moviOS: mWeb SafariMacOS: Chrome / Safari |

Explanation of Change
When there is no active GPS trip on the GPS distance tracking screen, the user's location marker on the map was not being updated. This PR adds a foreground location polling interval (every 5s) via
useFocusEffectthat callsgetCurrentPositionAsyncand updates the Onyx user location. Polling is skipped when a GPS trip is already in progress (background tracking handles it). Requested hereisSingleSegmentRouteis fixed as it was returningtruefor[[]]which is a multi segment empty routeFixed Issues
$ #85802
PROPOSAL: N/A
Tests
FAB > Track Distance > GPS
Do not start a GPS trip — remain on the screen with tracking stopped.
Move the device (or simulate location change in the simulator/emulator).
Verify that the user location marker on the map updates within ~5 seconds to reflect the new position.
Tap
StartMove the device/simulate location changes.
Verify that the map continues to update the user's location
Tap
StopVerify that the map doesn't move to show the current location updates - it should be showing the full recorded route instead.
Verify that current location polling resumes and the location marker is up to date even with no active GPS trip.
Go back
Return to GPS screen, verify that map loads with the recorded trip in view
Tap discard button
Verify that it moves the map to the current user's location marker after discarding the trip
Go back
Return to GPS screen, verify that the map loads with the current location marker as a center point
Offline tests
N/A
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
screen-20260522-131352-1779448372381.2.mp4
iOS: Native
Uploading Screen Recording 2026-05-25 at 12.26.06.mov…