Skip to content

Add a map on the GPS screen that shows the trip live#87103

Merged
puneetlath merged 10 commits into
Expensify:mainfrom
software-mansion-labs:@GCyganek/gps/add-map-to-gps-screen
Apr 14, 2026
Merged

Add a map on the GPS screen that shows the trip live#87103
puneetlath merged 10 commits into
Expensify:mainfrom
software-mansion-labs:@GCyganek/gps/add-map-to-gps-screen

Conversation

@GCyganek

@GCyganek GCyganek commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

Explanation of Change

Adds a map on the native GPS distance screen. Fixes map layers to draws the route below the user-location dot, updates user location using the latest GPS trip point, moves GPSTooltip to be shown above the Start/Stop button. Makes sure that GPS screen works fine in landscape mode.

Fixed Issues

$ #86026
PROPOSAL: N/A

Tests

Disabled location permissions:

  1. Open FAB > Track Distance > GPS with disabled location permissions
  2. Make sure that the map is displayed correctly using fallback location (San Francisco)
  3. Tap Start and make sure that the location permission flow starts

With enabled location permissions:

  1. FAB > Track Distance > GPS
  2. Tap Start and grant required location permissions if needed
  3. Make sure that the route, distance and user's location is updated correctly during the ongoing trip and that the
  4. Stop the trip
  5. Make sure that the Discard and Next buttons are displayed and that the map shows the full route
  6. Verify there are no layout bugs

In landscape mode:
Follow the scenarios above in the landscape mode and verify that the layout doesn't break and that the panel on the right with distance counter and waypoints is scrollable if needed

  • Verify that no errors appear in the JS console

Offline tests

QA Steps

Same as tests

  • 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
    • MacOS: Desktop
  • 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 verified there are no new alerts related to the canBeMissing param for useOnyx
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • 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 shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I used JaimeGPT to get English > Spanish translation. I then posted it in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • 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)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • 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)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • 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 a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • 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
Screen.Recording.2026-04-07.at.14.37.08.mov
Screen.Recording.2026-04-07.at.14.40.50.mov
iOS: Native
Screen.Recording.2026-04-07.at.14.14.58.mov
Screen.Recording.2026-04-07.at.14.33.25.mov
Screen.Recording.2026-04-07.at.14.05.00.mov

No location permission defaults to San Francisco:

Screenshot 2026-04-07 at 14 35 34
Screen.Recording.2026-04-07.at.14.35.57.mov
MacOS: Chrome / Safari

route drawn below the user location blue dot check:

Screenshot 2026-04-07 at 13 38 53

@codecov

codecov Bot commented Apr 3, 2026

Copy link
Copy Markdown

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.

Files with missing lines Coverage Δ
src/CONST/index.ts 92.30% <ø> (-1.35%) ⬇️
src/components/MapView/Direction.tsx 0.00% <ø> (ø)
src/components/MapView/Direction.website.tsx 0.00% <ø> (ø)
src/styles/index.ts 48.20% <ø> (-0.56%) ⬇️
src/libs/GPSDraftDetailsUtils.ts 0.00% <0.00%> (ø)
src/components/MapView/MapView.tsx 43.07% <0.00%> (-0.68%) ⬇️
src/libs/actions/GPSDraftDetails.ts 0.00% <0.00%> (ø)
...OURequestStepDistanceGPS/GPSButtons/GPSTooltip.tsx 0.00% <0.00%> (ø)
...tep/IOURequestStepDistanceGPS/GPSButtons/index.tsx 0.00% <0.00%> (ø)
...step/IOURequestStepDistanceGPS/Waypoints/index.tsx 0.00% <0.00%> (ø)
... and 1 more
... and 406 files with indirect coverage changes

@GCyganek

GCyganek commented Apr 3, 2026

Copy link
Copy Markdown
Contributor Author

@Expensify/design could you build and test to see if everything looks fine to you here? This PR only adds the map and current location tracking while the trip is in progress, edit flow will be added in a separate PR

Screen.Recording.2026-04-03.at.17.54.07.mov

I have a few questions:

  1. Shouldn't we move the tooltip somewhere else? Now it will cover the Distance Counter:
Screenshot_20260403-163538
  1. Do we want to have these new start & end icons and updated route trip line according to this design only on the GPS map, or should I update it for all maps that show routes (Map distance request for example)?

  2. Is the map behaviour ok at the moment - flying to the latest point on GPS updates, zooming out to show full route on trip stop, etc?

I asked 2 more questions here

@JmillsExpensify

JmillsExpensify commented Apr 5, 2026

Copy link
Copy Markdown
Contributor

flying to the latest point on GPS updates, zooming out to show full route on trip stop, etc?

This sounds fine to me.

@shawnborton

Copy link
Copy Markdown
Contributor

Shouldn't we move the tooltip somewhere else? Now it will cover the Distance Counter:

It might make sense to move it directly above the Stop button?

Do we want to have these new start & end icons and updated route trip line according to this design only

We can keep the original designs for now, so no need to update these. We can come in later and do design tweaks to the shapes/icons/etc. cc @Expensify/design for a gut check. If we do update them, we should update them for EVERY single kind of map we have.

Is the map behaviour ok at the moment - flying to the latest point on GPS updates, zooming out to show full route on trip stop, etc?

Yup, all good.

@shawnborton

Copy link
Copy Markdown
Contributor

For this design so far:
CleanShot 2026-04-06 at 12 00 46@2x

Are we able to place the green line underneath the blue dot? And can we use a rounded edge of the line, like so:
CleanShot 2026-04-06 at 12 01 31@2x

BTW - what color is the current line we draw? Maybe we want to keep the same as we currently have so we aren't introducing those design changes here.

@GCyganek

GCyganek commented Apr 7, 2026

Copy link
Copy Markdown
Contributor Author

BTW - what color is the current line we draw? Maybe we want to keep the same as we currently have so we aren't introducing those design changes here.

I only changed line width from 7 to 8 px and opacity from 100% to 80% according to the design, current color is #03D47C (green400, where on the design it's green300) and it wasn't changed on this PR. I will restore the original line width and opacity and in case we won't to change it I'll do it on a separate PR

@shawnborton

Copy link
Copy Markdown
Contributor

Sounds good, thanks! Mostly just want to make sure the whole @Expensify/design is aligned on any new changes before we implement them.

@GCyganek

GCyganek commented Apr 7, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e781005a39

ℹ️ 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".

Comment thread src/pages/iou/request/step/IOURequestStepDistanceGPS/Waypoints/index.tsx Outdated
@GCyganek GCyganek marked this pull request as ready for review April 7, 2026 12:44
@GCyganek GCyganek requested review from a team as code owners April 7, 2026 12:44
@melvin-bot melvin-bot Bot requested review from JmillsExpensify and dukenv0307 and removed request for a team and JmillsExpensify April 7, 2026 12:44
@melvin-bot

melvin-bot Bot commented Apr 7, 2026

Copy link
Copy Markdown

@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]

@GCyganek

GCyganek commented Apr 7, 2026

Copy link
Copy Markdown
Contributor Author

I fixed the route being drawn on top of the user's location blue dot. I also noticed that the user's location was not being updated according to the points recorded during the GPS trip, so now it should follow the route line, you can see how it works on the videos in the PR description. I moved the GPS tooltip to be displayed above the Stop button (see iOS video in the PR description) I made sure that the GPS screen is displayed correctly in the landscape mode, although it looks a bit empty when there is no trip in progress:

Screenshot 2026-04-07 at 14 47 10

I will add pause/resume functionality in the follow-up PR to not make this one too big

@Expensify/design LMK if you have any feedback

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 519d46898b

ℹ️ 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".

Comment thread src/components/MapView/Direction.tsx Outdated
@shawnborton

Copy link
Copy Markdown
Contributor

If we are down for a little style update, this is where my head is at:
CleanShot 2026-04-08 at 09 30 14@2x

I could get down with any of those, with the latter 2 feeling the most legible. Feel free to tinker here.

@JmillsExpensify

Copy link
Copy Markdown
Contributor

I don't feel strongly, I defer to you all.

@dannymcclain

Copy link
Copy Markdown
Contributor

No super strong feelings—I think I somewhat prefer the all green? But I do admit that the latter two a probably more legible. Between those two, I think I like the green lines with blue markers better.

@shawnborton

Copy link
Copy Markdown
Contributor

I think I am in a similar boat. Time to call in... JUDGE JON 🔨

@GCyganek

GCyganek commented Apr 8, 2026

Copy link
Copy Markdown
Contributor Author

@GCyganek, We'll do the edit/delete flows in the separate PRs, right?

Yes, that's the plan! Only adding the map here and adjusting the layout. Next PRs will add pause/resume functionality, style update (discussed in comments above) and edit flow, current discard button will be replaced by the delete icon on the distance counter level as on the design next to the edit icon

I'm currently working on fixing all remaining landscape mode bugs that were reported today by the QAs, after that I'll be back to working on the GPS features

@dubielzyk-expensify

Copy link
Copy Markdown
Contributor

Judge says.........

Green polyline and blue markers! Better for legibility of the route and then also won't get me in any weird accessibility troubles immediately 😂

I will say that I'm generally also a fan of a darker border or something on the polyline as I think by itself it blends in too much to the basemap with roads and lines etc. It improves legibility quite a bit more as well. (but I might be biased working on mapping software for 4 years 😅)

CleanShot 2026-04-09 at 08 37 08@2x

@shawnborton

Copy link
Copy Markdown
Contributor

Oh I can get down with that, I dig it. Thoughts @GCyganek ?

Copy link
Copy Markdown
Contributor

Wow yeah, that looks quite nice.

@dannymcclain

Copy link
Copy Markdown
Contributor

No qualms from me! Looks good! 👍

@GCyganek

Copy link
Copy Markdown
Contributor Author

Looks great! Will update map styles next week in a separate PR.

@puneetlath

Copy link
Copy Markdown
Contributor

Is this ready for final review then?

@GCyganek

Copy link
Copy Markdown
Contributor Author

@puneetlath yes, C+ approved

puneetlath
puneetlath previously approved these changes Apr 13, 2026
const styles = useThemeStyles();
const {windowWidth} = useWindowDimensions();

const {renderProductTrainingTooltip, shouldShowProductTrainingTooltip} = useProductTrainingContext(CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.GPS_TOOLTIP, !!isTracking);

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.

FYI, we'll need to whitelist this on the back-end to make it dismissible there too.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This component was only moved to a different directory, backend is already handled 😅


if (!gpsDraftDetails?.startAddress?.value && !gpsDraftDetails?.endAddress?.value) {
// eslint-disable-next-line rulesdir/no-negated-variables
const tripNotInitialized = (gpsDraftDetails?.gpsPoints?.length ?? 0) === 0 && !gpsDraftDetails?.isTracking;

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.

Boolean variable should start with "is". Perhaps something like

Suggested change
const tripNotInitialized = (gpsDraftDetails?.gpsPoints?.length ?? 0) === 0 && !gpsDraftDetails?.isTracking;
const isTripInitialized = (gpsDraftDetails?.gpsPoints?.length ?? 0) === 0 && !gpsDraftDetails?.isTracking;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done!

@puneetlath

Copy link
Copy Markdown
Contributor

@GCyganek I accidentally hit approve, but one comment to address. And then I just want to confirm whether the back-end for the product training tooltip has been done.

@GCyganek

Copy link
Copy Markdown
Contributor Author

@GCyganek I accidentally hit approve, but one comment to address. And then I just want to confirm whether the back-end for the product training tooltip has been done.

Backend is ready, I just moved the component to a different directory 😅

@puneetlath

Copy link
Copy Markdown
Contributor

Ok great.

@puneetlath puneetlath merged commit 6c6d79c into Expensify:main Apr 14, 2026
33 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

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

@OSBotify

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.

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/puneetlath in version: 9.3.60-0 🚀

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

Bundle Size Analysis (Sentry):

@MelvinBot

Copy link
Copy Markdown
Contributor

I reviewed the changes in this PR against the help site articles under docs/articles/.

Conclusion: No help site changes are required.

The two relevant articles are:

  • docs/articles/new-expensify/reports-and-expenses/Distance-Expenses.md
  • docs/articles/new-expensify/reports-and-expenses/Create-an-Expense.md

Both already accurately document the GPS distance tracking workflow. This PR adds visual/UI enhancements (live map during tracking, route layer ordering, user location dot, landscape mode support) but does not change any user-facing workflow steps, button labels, or feature behavior that the docs reference. The existing steps — Start → drive → Stop → review route → Create expense — remain correct as documented.

@jponikarchuk

Copy link
Copy Markdown

Deploy Blocker #88041 was identified to be related to this PR.

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/mountiny in version: 9.3.60-22 🚀

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

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.

10 participants