Skip to content

Background location permissions flow - GPS trip#77939

Merged
AndrewGable merged 19 commits intoExpensify:mainfrom
software-mansion-labs:@GCyganek/gps/gps-location-permissions-flow
Jan 12, 2026
Merged

Background location permissions flow - GPS trip#77939
AndrewGable merged 19 commits intoExpensify:mainfrom
software-mansion-labs:@GCyganek/gps/gps-location-permissions-flow

Conversation

@GCyganek
Copy link
Contributor

@GCyganek GCyganek commented Dec 17, 2025

Explanation of Change

Adding background location permissions flow to get location permissions required to start the GPS trip. Location tracking will be added in the next PR

Fixed Issues

$ #77218

MOBILE-EXPENSIFY: https://github.com/Expensify/Mobile-Expensify/pull/13809

Tests

In case you want the OS modals to be shown again in the app (reset permissions state for the app):

  • Android: clear app cache in settings or download on a device/simulator that has not had the app installed
  • iOS: download on a device/simulator that has not had the app installed yet

Android:

Test 1)

Prerequisites: Location permissions not granted and not asked for yet

  1. Go to the GPS distance request screen
  2. Tap Start
  3. Verify that it shows “Location access required” modal with Allow and Dismiss buttons and tap Allow
  4. Tap Dismiss and verify that it closes the modal without starting the trip
  5. Tap Start again
  6. Tap Allow and verify that it opens the OS modal with the foreground location permissions request
  7. Tap ‘While using the app’ with ‘Precise’ option selected
  8. Verify that a modal pops up instructing the user to give the background location permissions in the app’s settings
  9. Tap Settings
  10. Verify that it redirects the user to the app’s settings screen
  11. Switch to ‘Allow all the time’ and go back to the app
  12. Verify that the GPS trip has started successfully

Test 2)

Prerequisites: ‘Allow only while using the app’ + ‘Use precise location’ location permissions set and not asked for yet in the app

  1. Go to the GPS distance request screen
  2. Tap Start
  3. Verify that a modal pops up instructing the user to give the background location permissions in the app’s settings
  4. Tap Settings
  5. Verify that it redirects the user to the app’s settings screen
  6. Switch to ‘Allow all the time’ and go back to the app
  7. Verify that the GPS trip has started successfully

Test 3)

Prerequisites: Location permissions denied and already asked for

  1. Go to the GPS distance request screen
  2. Tap Start
  3. Verify that it shows “Location access required” modal with Settings and Dismiss buttons
  4. Tap Dismiss and verify that it closes the modal without starting the trip
  5. Tap Start again
  6. Tap Settings and verify that it redirects the user to the app’s settings screen
  7. Change the location permissions to ‘Allow all the time’ with ‘Use precise location’ toggle on and go back to the app
  8. Tap Start and verify that it starts the trip without asking for the permissions

Test 4)

Prerequisites: Location permissions already granted (‘Allow all the time’ and ‘Precise’ selected)

  1. Go to the GPS distance request screen
  2. Tap Start
  3. Verify that the GPS trip has started without any permissions requests

Test 5)

Prerequisites: ‘Allow all the time’ without ‘Use precise location’ location permissions set and not asked for yet in the app

  1. Go to the GPS distance request screen
  2. Tap Start
  3. Verify that it shows “Location access required” modal with Allow and Dismiss buttons and tap Allow
  4. Verify that an OS modal appears with a request to change the location accuracy to ‘Precise’
  5. Switch to ‘Precise’ accuracy
  6. Verify that the GPS trip has started successfully

Test 6)

Prerequisites: Location permissions not granted and not asked for yet

  1. Go to the GPS distance request screen
  2. Tap Start
  3. Verify that it shows “Location access required” modal with Allow and Dismiss buttons and tap Allow
  4. Tap Allow and verify that it opens the OS modal with the foreground location permissions request
  5. Tap ‘While using the app’ with ‘Approximate’ option selected
  6. Verify that the trip has not started
  7. Tap Start again
  8. Verify that it shows “Location access required” modal again with Allow and Dismiss buttons and tap Allow
  9. Verify that an OS modal appears with request for ‘Precise’ location permission
  10. Switch to ‘Precise’
  11. Verify that it shows “Location access required” modal with Settings and Dismiss buttons and tap Settings
  12. Verify that it redirects the user to the app’s settings screen
  13. Switch to ‘Allow all the time’ and go back to the app
  14. Verify that the GPS trip has started successfully

Test 7)

Prerequisites: Foreground location permissions granted, precise location not granted and can’t be asked for, background location not granted and can be asked for

  1. Go to the GPS distance request screen
  2. Tap Start
  3. Verify that it shows “Location access required” modal again with Allow and Dismiss buttons and tap Allow
  4. Verify that it shows “Precise location required” modal with Dismiss and Settings buttons
  5. Tap Settings and verify that it redirects the user to the app’s settings screen
  6. Enable ‘Use precise location’ and go back to the app
  7. Tap Start again
  8. Verify that it shows “Location access required” modal with Dismiss and Settings buttons
  9. Tap Settings
  10. Verify that it redirects the user to the app’s settings screen
  11. Switch to ‘Allow all the time’ and go back to the app
  12. Verify that the GPS trip has started successfully

iOS:

Test 1)

Prerequisites: Location permissions not granted (with Precise Location toggle on) and not asked for yet

  1. Go to the GPS distance request screen and tap Start
  2. Verify that it shows “Location access required” modal with Dismiss and Allow buttons
  3. Tap Dismiss and verify that it closes the modal without starting the trip
  4. Tap Start again
  5. Tap Allow and verify that it opens the OS modal with the foreground location permissions request
  6. Tap ‘Allow While Using App’
  7. Verify that a new OS modal pops up with the background location permissions request
  8. Tap ‘Change to always allow’
  9. Tap Start again
  10. Verify that the GPS trip has started

Test 2)

Prerequisites: Location permissions not granted and not asked for yet

  1. Go to the GPS distance request screen and tap Start
  2. Verify that it shows “Location access required” modal with Dismiss and Allow buttons
  3. Tap Allow and verify that it opens the OS modal with the foreground location permissions request
  4. Tap ‘Don’t Allow’
  5. Verify that the trip doesn’t start and that tapping Start opens a “Location access required” modal with Dismiss and Settings buttons

Test 3)

Prerequisites: Location permissions already granted (‘Always’ option selected and Precise Location toggled on)

  1. Go to the GPS distance request screen
  2. Tap Start
  3. Verify that the GPS trip has started without any permissions requests

Test 4)

Prerequisites: Location permissions already granted (‘Always’ option selected) without Precise Location

  1. Go to the GPS distance request screen
  2. Tap Start
  3. Verify that it shows “Precise location required” modal with Dismiss and Settings buttons
  4. Tap Settings and enable Precise Location
  5. Go back to the app and tap Start again
  6. Verify that the GPS trip has started without any permissions requests

Test 5)

Prerequisites: Location permissions denied and already asked for

  1. Go to the GPS distance request screen
  2. Tap Start
  3. Verify that the a modal pops up telling the user that the location permissions are required to use this feature with Settings and Dismiss buttons
  4. Tap Dismiss and verify that it closes the modal without starting the trip
  5. Tap Start again
  6. Tap Settings and verify that it redirects the user to the app’s settings screen
  7. Change the location permissions to ‘Always’ and enable Precise Location and go back to the app
  8. Tap Start and verify that it starts the trip without asking for the permissions

Test 6)

Prerequisites: ‘Allow While Using App’ location permissions (with Precise Location toggled on) set and not asked for yet in the app

  1. Go to the GPS distance request screen
  2. Tap Start
  3. Verify that it opens the background location permissions OS modal
  4. Tap ‘Change to always allow’
  5. Verify that the trip has started

Test 7)

Prerequisites: ‘Allow While Using App’ location permissions set and not asked for yet in the app

  1. Go to the GPS distance request screen
  2. Tap Start
  3. Verify that it opens the background location permissions OS modal
  4. Tap ‘Keep only while using’
  5. Verify that the trip hasn’t started and that tapping Start opens a “Location access required” modal with Dismiss and Settings buttons
  • Verify that no errors appear in the JS console

Offline tests

Same as 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
not-asked-yet-can-grant-all.mov
bg-not-granted-can-ask.mov
Screen.Recording.2026-01-08.at.11.17.37.mov
already-granted.mov
precise-location-not-granted-other-granted.mov
precise-location-not-granted-at-first.mov
precise-location-not-granted-cant-be-asked.mov
iOS: Native
1-not-gratned-not-asked.mov
2-dont-allow.mov
3-granted-already.mov
Screen.Recording.2026-01-07.at.18.18.30.mov
5-denied-and-asked-for.mov
6-change-always-allow.mov
7-keep-only-while-using.mov

@melvin-bot
Copy link

melvin-bot bot commented Dec 17, 2025

Hey, I noticed you changed src/languages/en.ts in a PR from a fork. For security reasons, translations are not generated automatically for PRs from forks.

If you want to automatically generate translations for other locales, an Expensify employee will have to:

  1. Look at the code and make sure there are no malicious changes.
  2. Run the Generate static translations GitHub workflow. If you have write access and the K2 extension, you can simply click: [this button]

Alternatively, if you are an external contributor, you can run the translation script locally with your own OpenAI API key. To learn more, try running:

npx ts-node ./scripts/generateTranslations.ts --help

Typically, you'd want to translate only what you changed by running npx ts-node ./scripts/generateTranslations.ts --compare-ref main

@OSBotify
Copy link
Contributor

🦜 Polyglot Parrot! 🦜

Squawk! Looks like you added some shiny new English strings. Allow me to parrot them back to you in other tongues:

View the translation diff
diff --git a/src/languages/de.ts b/src/languages/de.ts
index c44e2f00..67040908 100644
--- a/src/languages/de.ts
+++ b/src/languages/de.ts
@@ -7977,6 +7977,41 @@ Hier ist ein *Testbeleg*, um dir zu zeigen, wie es funktioniert:`,
         },
         admins: {title: 'Admins', findAdmin: 'Admin finden', primaryContact: 'Hauptansprechpartner', addPrimaryContact: 'Primären Kontakt hinzufügen', settings: 'Einstellungen'},
     },
+    gps: {
+        tooltip: 'GPS-Verfolgung läuft! Wenn du fertig bist, stoppe die Verfolgung unten.',
+        disclaimer: 'Benutze GPS, um eine Ausgabe von deiner Reise zu erstellen. Tippe unten auf „Start“, um mit der Aufzeichnung zu beginnen.',
+        error: {failedToStart: 'Standortverfolgung konnte nicht gestartet werden.', failedToGetPermissions: 'Die erforderlichen Standortberechtigungen konnten nicht abgerufen werden.'},
+        trackingDistance: 'Strecke wird verfolgt...',
+        stopped: 'Angehalten',
+        start: 'Start',
+        stop: 'Stopp',
+        discard: 'Verwerfen',
+        stopGpsTrackingModal: {
+            title: 'GPS-Tracking stoppen',
+            prompt: 'Bist du sicher? Dadurch wird deine aktuelle Reise beendet.',
+            cancel: 'Verfolgung fortsetzen',
+            confirm: 'GPS-Tracking stoppen',
+        },
+        discardDistanceTrackingModal: {
+            title: 'Entfernungsverfolgung verwerfen',
+            prompt: 'Bist du sicher? Dadurch wird deine aktuelle Reise verworfen und kann nicht rückgängig gemacht werden.',
+            confirm: 'Entfernungsverfolgung verwerfen',
+        },
+        zeroDistanceTripModal: {title: 'Ausgabe kann nicht erstellt werden', prompt: 'Sie können keine Ausgabe mit demselben Start- und Zielort erstellen.'},
+        locationRequiredModal: {
+            title: 'Standortzugriff erforderlich',
+            prompt: 'Bitte erlaube den Standortzugriff in den Einstellungen deines Geräts, um die GPS-Distanzverfolgung zu starten.',
+            allow: 'Erlauben',
+        },
+        androidBackgroundLocationRequiredModal: {
+            title: 'Zugriff auf den Standort im Hintergrund erforderlich',
+            prompt: 'Bitte erlaube den Zugriff auf den Standort im Hintergrund in den Geräteeinstellungen (Option „Immer zulassen“), um die GPS-Distanzverfolgung zu starten.',
+        },
+        preciseLocationRequiredModal: {
+            title: 'Genaue Position erforderlich',
+            prompt: 'Bitte aktiviere „genaue Standortbestimmung“ in den Einstellungen deines Geräts, um die GPS‑Streckenverfolgung zu starten.',
+        },
+    },
 };
 // IMPORTANT: This line is manually replaced in generate translation files by scripts/generateTranslations.ts,
 // so if you change it here, please update it there as well.
diff --git a/src/languages/fr.ts b/src/languages/fr.ts
index 52aa9a1d..1166ceff 100644
--- a/src/languages/fr.ts
+++ b/src/languages/fr.ts
@@ -7982,6 +7982,41 @@ Voici un *reçu test* pour vous montrer comment cela fonctionne :`,
         },
         admins: {title: 'Admins', findAdmin: 'Trouver un admin', primaryContact: 'Contact principal', addPrimaryContact: 'Ajouter un contact principal', settings: 'Paramètres'},
     },
+    gps: {
+        tooltip: 'Suivi GPS en cours ! Quand vous avez terminé, arrêtez le suivi ci-dessous.',
+        disclaimer: 'Utilisez le GPS pour créer une dépense à partir de votre trajet. Touchez Démarrer ci-dessous pour commencer le suivi.',
+        error: {failedToStart: 'Impossible de démarrer le suivi de la localisation.', failedToGetPermissions: 'Échec de l’obtention des autorisations de localisation requises.'},
+        trackingDistance: 'Suivi de la distance...',
+        stopped: 'Arrêté',
+        start: 'Commencer',
+        stop: 'Arrêter',
+        discard: 'Ignorer',
+        stopGpsTrackingModal: {
+            title: 'Arrêter le suivi GPS',
+            prompt: 'Êtes-vous sûr(e) ? Cela mettra fin à votre trajet actuel.',
+            cancel: 'Reprendre le suivi',
+            confirm: 'Arrêter le suivi GPS',
+        },
+        discardDistanceTrackingModal: {
+            title: 'Ignorer le suivi de la distance',
+            prompt: 'Êtes-vous sûr(e) ? Cela annulera votre parcours en cours et ne pourra pas être annulé.',
+            confirm: 'Ignorer le suivi de la distance',
+        },
+        zeroDistanceTripModal: {title: 'Impossible de créer la dépense', prompt: 'Vous ne pouvez pas créer une dépense avec le même lieu de départ et d’arrivée.'},
+        locationRequiredModal: {
+            title: 'Accès à la localisation requis',
+            prompt: 'Veuillez autoriser l’accès à la localisation dans les paramètres de votre appareil pour lancer le suivi de distance GPS.', //_/\__/_/  \_,_/\__/\__/\_,_/
+            allow: 'Autoriser',
+        },
+        androidBackgroundLocationRequiredModal: {
+            title: 'Accès à la position en arrière-plan requis',
+            prompt: 'Veuillez autoriser l’accès à la localisation en arrière-plan dans les paramètres de votre appareil (option « Autoriser tout le temps ») pour démarrer le suivi de distance par GPS.',
+        },
+        preciseLocationRequiredModal: {
+            title: 'Emplacement précis requis',
+            prompt: 'Veuillez activer la « localisation précise » dans les paramètres de votre appareil pour commencer le suivi de distance GPS.',
+        },
+    },
 };
 // IMPORTANT: This line is manually replaced in generate translation files by scripts/generateTranslations.ts,
 // so if you change it here, please update it there as well.
diff --git a/src/languages/it.ts b/src/languages/it.ts
index 6e2b708b..71a41caf 100644
--- a/src/languages/it.ts
+++ b/src/languages/it.ts
@@ -7964,6 +7964,41 @@ Ecco una *ricevuta di prova* per mostrarti come funziona:`,
             settings: 'Impostazioni',
         },
     },
+    gps: {
+        tooltip: 'Monitoraggio GPS in corso! Quando hai finito, interrompi il monitoraggio qui sotto.',
+        disclaimer: 'Usa il GPS per creare una spesa dal tuo viaggio. Tocca Avvia qui sotto per iniziare il tracciamento.',
+        error: {failedToStart: 'Impossibile avviare il tracciamento della posizione.', failedToGetPermissions: 'Impossibile ottenere le autorizzazioni di localizzazione richieste.'},
+        trackingDistance: 'Tracciamento distanza...',
+        stopped: 'Interrotto',
+        start: 'Avvia',
+        stop: 'Interrompi',
+        discard: 'Scarta',
+        stopGpsTrackingModal: {
+            title: 'Interrompi il tracciamento GPS',
+            prompt: 'Sei sicuro? Questo terminerà il tuo percorso attuale.',
+            cancel: 'Riprendi il tracciamento',
+            confirm: 'Interrompi il tracciamento GPS',
+        },
+        discardDistanceTrackingModal: {
+            title: 'Scarta monitoraggio distanza',
+            prompt: 'Sei sicuro? Questo annullerà il tuo percorso attuale e non potrà essere annullato.',
+            confirm: 'Scarta monitoraggio distanza',
+        },
+        zeroDistanceTripModal: {title: 'Impossibile creare la spesa', prompt: 'Non puoi creare una spesa con la stessa località di partenza e di arrivo.'},
+        locationRequiredModal: {
+            title: 'Accesso alla posizione richiesto',
+            prompt: 'Consenti l’accesso alla posizione nelle impostazioni del dispositivo per avviare il tracciamento della distanza GPS.',
+            allow: 'Consenti',
+        },
+        androidBackgroundLocationRequiredModal: {
+            title: 'Accesso alla posizione in background richiesto',
+            prompt: 'Consenti l’accesso alla posizione in background nelle impostazioni del dispositivo (opzione “Consenti sempre”) per avviare il tracciamento della distanza tramite GPS.',
+        },
+        preciseLocationRequiredModal: {
+            title: 'Posizione precisa richiesta',
+            prompt: 'Per favore, abilita la “posizione precisa” nelle impostazioni del dispositivo per avviare il tracciamento della distanza GPS.',
+        },
+    },
 };
 // IMPORTANT: This line is manually replaced in generate translation files by scripts/generateTranslations.ts,
 // so if you change it here, please update it there as well.
diff --git a/src/languages/ja.ts b/src/languages/ja.ts
index 6d87a9b3..823d9c23 100644
--- a/src/languages/ja.ts
+++ b/src/languages/ja.ts
@@ -7897,6 +7897,25 @@ Expensify の使い方をお見せするための*テストレシート*がこ
         },
         admins: {title: '管理者', findAdmin: '管理者を検索', primaryContact: '主要連絡先', addPrimaryContact: '主要連絡先を追加', settings: '設定'},
     },
+    gps: {
+        tooltip: 'GPS 追跡を進行中です!完了したら、下で追跡を停止してください。',
+        disclaimer: '移動中の経路から、GPS を使って経費を作成しましょう。下の「開始」をタップして追跡を始めてください。',
+        error: {failedToStart: '位置情報の追跡を開始できませんでした。', failedToGetPermissions: '必要な位置情報の権限を取得できませんでした。'},
+        trackingDistance: '距離を追跡中...',
+        stopped: '停止',
+        start: '開始',
+        stop: '停止',
+        discard: '破棄',
+        stopGpsTrackingModal: {title: 'GPS追跡を停止', prompt: '本当に終了しますか?現在のジャーニーが終了します。', cancel: '追跡を再開', confirm: 'GPS追跡を停止'},
+        discardDistanceTrackingModal: {title: '距離の追跡を破棄', prompt: '本当に実行しますか?現在の行程が破棄され、元に戻すことはできません。', confirm: '距離の追跡を破棄'},
+        zeroDistanceTripModal: {title: '経費を作成できません', prompt: '開始地点と終了地点が同じ経路では経費を作成できません。'},
+        locationRequiredModal: {title: '位置情報へのアクセスが必要です', prompt: 'GPS で距離を追跡するには、デバイスの設定で位置情報へのアクセスを許可してください。', allow: '許可'},
+        androidBackgroundLocationRequiredModal: {
+            title: 'バックグラウンド位置情報へのアクセスが必要です',
+            prompt: 'GPS距離の追跡を開始するには、デバイスの設定でバックグラウンドの位置情報アクセスを許可し(「常に許可」オプション)、有効にしてください。',
+        },
+        preciseLocationRequiredModal: {title: '正確な位置情報が必要です', prompt: 'GPS距離の追跡を開始するには、デバイスの設定で「正確な位置情報」を有効にしてください。'},
+    },
 };
 // IMPORTANT: This line is manually replaced in generate translation files by scripts/generateTranslations.ts,
 // so if you change it here, please update it there as well.
diff --git a/src/languages/nl.ts b/src/languages/nl.ts
index 67e2b076..a7ab293d 100644
--- a/src/languages/nl.ts
+++ b/src/languages/nl.ts
@@ -7950,6 +7950,38 @@ Hier is een *testbon* om je te laten zien hoe het werkt:`,
             settings: 'Instellingen',
         },
     },
+    gps: {
+        tooltip: 'GPS-tracking bezig! Als je klaar bent, stop dan hieronder met tracken.',
+        disclaimer: 'Gebruik GPS om een uitgave van je reis te maken. Tik hieronder op Start om het volgen te beginnen.',
+        error: {failedToStart: 'Locatiebijhouding starten is mislukt.', failedToGetPermissions: 'Verkrijgen van vereiste locatierechten mislukt.'},
+        trackingDistance: 'Afstand bijhouden...',
+        stopped: 'Gestopt',
+        start: 'Start',
+        stop: 'Stoppen',
+        discard: 'Verwerpen',
+        stopGpsTrackingModal: {
+            title: 'GPS-tracking stoppen',
+            prompt: 'Weet je het zeker? Hiermee beëindig je je huidige flow.',
+            cancel: 'Hervatten met volgen',
+            confirm: 'GPS-tracking stoppen',
+        },
+        discardDistanceTrackingModal: {
+            title: 'Afstandstracking negeren',
+            prompt: 'Weet je het zeker? Dit verwijdert je huidige traject en kan niet ongedaan worden gemaakt.',
+            confirm: 'Afstandstracking negeren',
+        },
+        zeroDistanceTripModal: {title: 'Kan geen uitgave aanmaken', prompt: 'Je kunt geen uitgave aanmaken met dezelfde begin- en eindlocatie.'},
+        locationRequiredModal: {
+            title: 'Locatietoegang vereist',
+            prompt: 'Sta locatietoegang toe in de instellingen van je apparaat om GPS-afstandsregistratie te starten.',
+            allow: 'Toestaan',
+        },
+        androidBackgroundLocationRequiredModal: {
+            title: 'Toegang tot locatie op de achtergrond vereist',
+            prompt: 'Sta achtergrondlocatietoegang toe in de instellingen van je apparaat (de optie “Altijd toestaan”) om het bijhouden van de GPS-afstand te starten.',
+        },
+        preciseLocationRequiredModal: {title: 'Precieze locatie vereist', prompt: 'Schakel "precieze locatie" in de instellingen van je apparaat in om GPS-afstandsregistratie te starten.'},
+    },
 };
 // IMPORTANT: This line is manually replaced in generate translation files by scripts/generateTranslations.ts,
 // so if you change it here, please update it there as well.
diff --git a/src/languages/pl.ts b/src/languages/pl.ts
index 4af2d97e..8be8279b 100644
--- a/src/languages/pl.ts
+++ b/src/languages/pl.ts
@@ -7929,6 +7929,36 @@ Oto *paragon testowy*, który pokazuje, jak to działa:`,
         },
         admins: {title: 'Administratorzy', findAdmin: 'Znajdź administratora', primaryContact: 'Główny kontakt', addPrimaryContact: 'Dodaj główny kontakt', settings: 'Ustawienia'},
     },
+    gps: {
+        tooltip: 'Śledzenie GPS w toku! Gdy skończysz, zatrzymaj śledzenie poniżej.',
+        disclaimer: 'Użyj GPS, aby utworzyć wydatek z Twojej podróży. Stuknij „Start” poniżej, aby rozpocząć śledzenie.',
+        error: {failedToStart: 'Nie udało się uruchomić śledzenia lokalizacji.', failedToGetPermissions: 'Nie udało się uzyskać wymaganych uprawnień do lokalizacji.'},
+        trackingDistance: 'Śledzenie dystansu…',
+        stopped: 'Zatrzymano',
+        start: 'Start',
+        stop: 'Zatrzymaj',
+        discard: 'Odrzuć',
+        stopGpsTrackingModal: {title: 'Zatrzymaj śledzenie GPS', prompt: 'Czy na pewno? To zakończy Twoją obecną podróż.', cancel: 'Wznów śledzenie', confirm: 'Zatrzymaj śledzenie GPS'},
+        discardDistanceTrackingModal: {
+            title: 'Odrzuć śledzenie dystansu',
+            prompt: 'Czy na pewno? Spowoduje to odrzucenie Twojej obecnej ścieżki i nie będzie można tego cofnąć.',
+            confirm: 'Odrzuć śledzenie dystansu',
+        },
+        zeroDistanceTripModal: {title: 'Nie można utworzyć wydatku', prompt: 'Nie możesz utworzyć wydatku z tym samym miejscem początkowym i końcowym.'},
+        locationRequiredModal: {
+            title: 'Wymagany dostęp do lokalizacji',
+            prompt: 'Aby rozpocząć śledzenie dystansu GPS, zezwól na dostęp do lokalizacji w ustawieniach swojego urządzenia.',
+            allow: 'Zezwól',
+        },
+        androidBackgroundLocationRequiredModal: {
+            title: 'Wymagany dostęp do lokalizacji w tle',
+            prompt: 'Zezwól aplikacji na dostęp do lokalizacji w tle w ustawieniach urządzenia (opcja „Zawsze zezwalaj”), aby rozpocząć śledzenie dystansu GPS.',
+        },
+        preciseLocationRequiredModal: {
+            title: 'Wymagane dokładne położenie',
+            prompt: 'Włącz proszę „dokładną lokalizację” w ustawieniach swojego urządzenia, aby rozpocząć śledzenie dystansu GPS.',
+        },
+    },
 };
 // IMPORTANT: This line is manually replaced in generate translation files by scripts/generateTranslations.ts,
 // so if you change it here, please update it there as well.
diff --git a/src/languages/pt-BR.ts b/src/languages/pt-BR.ts
index 736818b8..cace5632 100644
--- a/src/languages/pt-BR.ts
+++ b/src/languages/pt-BR.ts
@@ -7942,6 +7942,41 @@ Aqui está um *recibo de teste* para mostrar como funciona:`,
             settings: 'Configurações',
         },
     },
+    gps: {
+        tooltip: 'Rastreamento por GPS em andamento! Quando terminar, pare o rastreamento abaixo.',
+        disclaimer: 'Use o GPS para criar uma despesa a partir da sua viagem. Toque em Iniciar abaixo para começar o rastreamento.',
+        error: {failedToStart: 'Falha ao iniciar o rastreamento de localização.', failedToGetPermissions: 'Falha ao obter as permissões de localização necessárias.'},
+        trackingDistance: 'Acompanhando a distância...',
+        stopped: 'Parado',
+        start: 'Iniciar',
+        stop: 'Parar',
+        discard: 'Descartar',
+        stopGpsTrackingModal: {
+            title: 'Parar rastreamento por GPS',
+            prompt: 'Tem certeza? Isso encerrará sua jornada atual.',
+            cancel: 'Retomar rastreamento',
+            confirm: 'Parar rastreamento por GPS',
+        },
+        discardDistanceTrackingModal: {
+            title: 'Descartar rastreamento de distância',
+            prompt: 'Tem certeza? Isso descartará sua jornada atual e não poderá ser desfeito.',
+            confirm: 'Descartar rastreamento de distância',
+        },
+        zeroDistanceTripModal: {title: 'Não é possível criar a despesa', prompt: 'Você não pode criar uma despesa com o mesmo local de partida e de chegada.'},
+        locationRequiredModal: {
+            title: 'Acesso à localização necessário',
+            prompt: 'Permita o acesso à localização nas configurações do seu dispositivo para iniciar o rastreamento de distância por GPS.',
+            allow: 'Permitir',
+        },
+        androidBackgroundLocationRequiredModal: {
+            title: 'Acesso à localização em segundo plano necessário',
+            prompt: 'Permita o acesso à localização em segundo plano nas configurações do seu dispositivo (opção "Permitir o tempo todo") para iniciar o rastreamento de distância por GPS.',
+        },
+        preciseLocationRequiredModal: {
+            title: 'Localização precisa obrigatória',
+            prompt: 'Ative a opção "localização precisa" nas configurações do seu dispositivo para iniciar o rastreamento de distância por GPS.',
+        },
+    },
 };
 // IMPORTANT: This line is manually replaced in generate translation files by scripts/generateTranslations.ts,
 // so if you change it here, please update it there as well.
diff --git a/src/languages/zh-hans.ts b/src/languages/zh-hans.ts
index cd907d2e..f7abfcb4 100644
--- a/src/languages/zh-hans.ts
+++ b/src/languages/zh-hans.ts
@@ -7762,6 +7762,22 @@ ${reportName}
         enhancedSecurity: {title: '增强的安全性', subtitle: '要求您域内的成员使用单点登录登录、限制工作区创建等。', enable: '启用'},
         admins: {title: '管理员', findAdmin: '查找管理员', primaryContact: '主要联系人', addPrimaryContact: '添加主要联系人', settings: '设置'},
     },
+    gps: {
+        tooltip: 'GPS 跟踪进行中!完成后,请在下方停止跟踪。',
+        disclaimer: '使用 GPS 根据您的行程创建报销。点击下方的“开始”以开始跟踪。',
+        error: {failedToStart: '启动位置跟踪失败。', failedToGetPermissions: '获取必需的位置权限失败。'},
+        trackingDistance: '正在跟踪距离…',
+        stopped: '已停止',
+        start: '开始',
+        stop: '停止',
+        discard: '丢弃',
+        stopGpsTrackingModal: {title: '停止 GPS 追踪', prompt: '你确定吗?这将结束你当前的旅程。', cancel: '恢复追踪', confirm: '停止 GPS 追踪'},
+        discardDistanceTrackingModal: {title: '丢弃距离跟踪', prompt: '您确定吗?这将放弃您当前的流程,且无法撤销。', confirm: '丢弃距离跟踪'},
+        zeroDistanceTripModal: {title: '无法创建报销', prompt: '你不能创建起点和终点相同的报销。'},
+        locationRequiredModal: {title: '需要访问位置信息', prompt: '请在设备设置中允许位置访问以开始 GPS 距离跟踪。', allow: '允许'},
+        androidBackgroundLocationRequiredModal: {title: '需要后台位置访问权限', prompt: '请在设备设置中允许应用使用“始终允许”位置访问权限,以开始 GPS 距离跟踪。'},
+        preciseLocationRequiredModal: {title: '需要精确位置', prompt: '请在设备设置中启用“精确位置”以开始 GPS 距离跟踪。'},
+    },
 };
 // IMPORTANT: This line is manually replaced in generate translation files by scripts/generateTranslations.ts,
 // so if you change it here, please update it there as well.

Note

You can apply these changes to your branch by copying the patch to your clipboard, then running pbpaste | git apply 😉

@codecov
Copy link

codecov bot commented Dec 22, 2025

Codecov Report

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

Files with missing lines Coverage Δ
...nceGPS/BackgroundLocationPermissionsFlow/index.tsx 0.00% <0.00%> (ø)
...tep/IOURequestStepDistanceGPS/GPSButtons/index.tsx 0.00% <0.00%> (ø)
...PS/BackgroundLocationPermissionsFlow/index.ios.tsx 0.00% <0.00%> (ø)
...ackgroundLocationPermissionsFlow/index.android.tsx 0.00% <0.00%> (ø)
... and 7 files with indirect coverage changes

@GCyganek GCyganek marked this pull request as ready for review January 7, 2026 10:06
@GCyganek GCyganek requested review from a team as code owners January 7, 2026 10:06
@melvin-bot melvin-bot bot requested review from JmillsExpensify and dangrous and removed request for a team January 7, 2026 10:06
@melvin-bot
Copy link

melvin-bot bot commented Jan 7, 2026

@dangrous 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
Copy link
Contributor Author

GCyganek commented Jan 7, 2026

@dangrous @JmillsExpensify please ignore, @dukenv0307 and @AndrewGable will review this

@dukenv0307
Copy link
Contributor

dukenv0307 commented Jan 7, 2026

  1. Open App
  2. Go to GPS trip
  3. Enable location permission
  4. Disable Use precise location
  5. Go to App again
  6. Observe that Location access required is shown

Expected: Disable Use precise location should show Precise location required modal

Screen.Recording.2026-01-07.at.22.57.06.mov

@GCyganek
Copy link
Contributor Author

GCyganek commented Jan 7, 2026

  1. Open App
  2. Go to GPS trip
  3. Enable location permission
  4. Disable Use precise location
  5. Go to App again
  6. Observe that Location access required is shown

Expected: Disable Use precise location should show Precise location required modal

Screen.Recording.2026-01-07.at.21.39.13.mov

In this case we don't even have foreground location permissions ('Allow only while using the app') granted, so it ends up asking the user to change that in the app's settings (no OS modal as I guess it has already been shown). Precise location required will be shown on iOS only if precise location is disabled AND foreground and background location permissions are granted ('Allow all the time' option is selected)

EDIT: We discussed in dms that there is no Location required modal before showing Precise location required modal as it should be (in 'Allow all the time' + precise location disabled), taking a look at this...

EDIT2: Ready, changed the flow for the fg & bg location permissions granted + precise location disabled to only show Precise location required modal without the Location required modal shown first

@AndrewGable AndrewGable requested a review from dukenv0307 January 7, 2026 17:17
@GCyganek GCyganek requested a review from dukenv0307 January 8, 2026 10:44
@melvin-bot
Copy link

melvin-bot bot commented Jan 8, 2026

🎯 @dukenv0307, thanks for reviewing and testing this PR! 🎉

An E/App issue has been created to issue payment here: #79086.

@dukenv0307
Copy link
Contributor

LGTM! All yours @Expensify/design

@AndrewGable AndrewGable self-requested a review January 8, 2026 19:18
@dubielzyk-expensify
Copy link
Contributor

Running test builds

@github-actions
Copy link
Contributor

github-actions bot commented Jan 8, 2026

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

@github-actions
Copy link
Contributor

github-actions bot commented Jan 9, 2026

@dubielzyk-expensify
Copy link
Contributor

Dialogs are looking good to me 👍 One thing though: when you tap Allow on the location permission dialog I'd expect the location tracking to start immediately since you tapped start to get the dialog. That way we avoid having the user tap twice. cc @dannymcclain

@GCyganek
Copy link
Contributor Author

GCyganek commented Jan 9, 2026

Dialogs are looking good to me 👍 One thing though: when you tap Allow on the location permission dialog I'd expect the location tracking to start immediately since you tapped start to get the dialog. That way we avoid having the user tap twice. cc @dannymcclain

Let's say currently we have this flow:

  1. User taps Start
  2. Location required modal is displayed with Settings
  3. User taps Settings
  4. User is redirected to settings and grants all required permissions
  5. User comes back to app
  6. User has to tap Start again to start the trip

Do you want it to be like this (only 6. point changes)?:

  1. User taps Start
  2. Location required modal is displayed with Settings
  3. User taps Settings
  4. User is redirected to settings and grants all required permissions
  5. User comes back to app
  6. App checks permissions again automatically and starts the trip if all required permissions are granted OR displays the Location required modal again otherwise

In case that's what you want, would it be OK for you if I added this in a follow-up instead of here so that we can merge this PR faster and go to the next step of the release and also review this change concurrently?

@dannymcclain
Copy link
Contributor

I think it's fine to adjust in a follow up, but this is what I'm thinking:

If the user taps start and gets the location permissions pop up, and immediately allows all location services (while still in the app), we should just start tracking. If they have to exit the app to go to settings, I think it's ok to make them click start again when they come back. Happy for @dubielzyk-expensify to advise further 👍

@GCyganek
Copy link
Contributor Author

GCyganek commented Jan 9, 2026

If the user taps start and gets the location permissions pop up, and immediately allows all location services (while still in the app), we should just start tracking.

If I understand correctly, this is what we currently do. So, if there is no need for the user to change location permissions in the settings and they grant all required permissions using OS modals then we immediately start the trip without the need to tap Start again

If they have to exit the app to go to settings, I think it's ok to make them click start again when they come back.

There are two cases here:

  • on Android when we ask for background location permissions we use a function that waits for the user to come back from settings and checks if permissions are granted when they're back in the app so we can start the trip immediately
  • in other cases where user is redirected to settings coming back to the app requires user to tap Start again

And I guess @dubielzyk-expensify wants to change the second point so that in these scenarios we have a logic that checks for location permissions every time user comes back to the app from settings so that they dont need to tap Start again

@dannymcclain
Copy link
Contributor

Ok cool - I'll let him weigh in further!

Copy link
Contributor

@JmillsExpensify JmillsExpensify left a comment

Choose a reason for hiding this comment

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

Looks good. Part of an existing product initiative, and the PR has good testing steps.

@dubielzyk-expensify
Copy link
Contributor

And I guess @dubielzyk-expensify wants to change the second point so that in these scenarios we have a logic that checks for location permissions every time user comes back to the app from settings so that they dont need to tap Start again

I don't wanna change when you have to go to settings. But I think what I was experiencing won't happen in the first place unless you're in a weird state. You can see the video here that I click allow and have to click allow again, but I guess it's similarly to what you're saying @GCyganek .

ScreenRecording_01-12-2026.14-03-28_1.mov

So yeah I guess we leave that one alone. I was more worried about a scenario where you:

  1. Land on GPS screen
  2. Tap Start
  3. Get asked for permissions
  4. Say Allow
  5. No you have tap Start again

But realistically it doesn't look like that's a scenario that'll happen given we ask the permission as soon as you tap Track distance -> Map

@GCyganek
Copy link
Contributor Author

GCyganek commented Jan 12, 2026

So yeah I guess we leave that one alone. I was more worried about a scenario where you:

  1. Land on GPS screen
  2. Tap Start
  3. Get asked for permissions
  4. Say Allow
  5. No you have tap Start again

I can't see what happens on your video after you tap Allow (I guess OS modals are displayed, but they are not a part of the app so they don't get recorded), but this scenario shouldn't happen unless user does not grant all required permissions

@GCyganek
Copy link
Contributor Author

So everything looks good here, right?

@dubielzyk-expensify
Copy link
Contributor

Ahh yeah, classic iOS recording. Yep all good 👍

@AndrewGable AndrewGable merged commit 4947e55 into Expensify:main Jan 12, 2026
34 checks passed
@OSBotify
Copy link
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
Contributor

🚀 Deployed to staging by https://github.com/AndrewGable in version: 9.3.0-0 🚀

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

@OSBotify
Copy link
Contributor

🚀 Deployed to production by https://github.com/francoisl in version: 9.3.0-8 🚀

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.

8 participants