diff --git a/src/components/FloatingGPSButton/index.native.tsx b/src/components/FloatingGPSButton/index.native.tsx new file mode 100644 index 000000000000..0d8d4c2c8b87 --- /dev/null +++ b/src/components/FloatingGPSButton/index.native.tsx @@ -0,0 +1,59 @@ +import React from 'react'; +import {View} from 'react-native'; +import Icon from '@components/Icon'; +import {PressableWithoutFeedback} from '@components/Pressable'; +import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset'; +import useLocalize from '@hooks/useLocalize'; +import useOnyx from '@hooks/useOnyx'; +import useTheme from '@hooks/useTheme'; +import useThemeStyles from '@hooks/useThemeStyles'; +import Navigation from '@libs/Navigation/Navigation'; +import {generateReportID} from '@libs/ReportUtils'; +import variables from '@styles/variables'; +import CONST from '@src/CONST'; +import ONYXKEYS from '@src/ONYXKEYS'; +import ROUTES from '@src/ROUTES'; + +function FloatingGpsButton() { + const [gpsDraftDetails] = useOnyx(ONYXKEYS.GPS_DRAFT_DETAILS, {canBeMissing: true}); + const {translate} = useLocalize(); + + const icons = useMemoizedLazyExpensifyIcons(['Location'] as const); + const {textMutedReversed} = useTheme(); + const styles = useThemeStyles(); + + if (!gpsDraftDetails?.isTracking) { + return null; + } + + const navigateToGpsScreen = () => { + const reportID = gpsDraftDetails?.reportID ?? generateReportID(); + Navigation.navigate(ROUTES.DISTANCE_REQUEST_CREATE_TAB_GPS.getRoute(CONST.IOU.ACTION.CREATE, CONST.IOU.TYPE.CREATE, CONST.IOU.OPTIMISTIC_TRANSACTION_ID, reportID)); + }; + + return ( + + + + + + ); +} + +FloatingGpsButton.displayName = 'FloatingGpsButton'; + +export default FloatingGpsButton; diff --git a/src/components/FloatingGPSButton/index.tsx b/src/components/FloatingGPSButton/index.tsx new file mode 100644 index 000000000000..e0f2ea10029d --- /dev/null +++ b/src/components/FloatingGPSButton/index.tsx @@ -0,0 +1,7 @@ +function FloatingGpsButton() { + return null; +} + +FloatingGpsButton.displayName = 'FloatingGpsButton'; + +export default FloatingGpsButton; diff --git a/src/components/Navigation/NavigationTabBar/index.tsx b/src/components/Navigation/NavigationTabBar/index.tsx index 69c812013c06..d5822700693a 100644 --- a/src/components/Navigation/NavigationTabBar/index.tsx +++ b/src/components/Navigation/NavigationTabBar/index.tsx @@ -5,6 +5,7 @@ import {View} from 'react-native'; import type {OnyxCollection} from 'react-native-onyx'; import type {ValueOf} from 'type-fest'; import FloatingCameraButton from '@components/FloatingCameraButton'; +import FloatingGPSButton from '@components/FloatingGPSButton'; import Icon from '@components/Icon'; // import * as Expensicons from '@components/Icon/Expensicons'; import ImageSVG from '@components/ImageSVG'; @@ -51,10 +52,10 @@ import NAVIGATION_TABS from './NAVIGATION_TABS'; type NavigationTabBarProps = { selectedTab: ValueOf; isTopLevelBar?: boolean; - shouldShowFloatingCameraButton?: boolean; + shouldShowFloatingButtons?: boolean; }; -function NavigationTabBar({selectedTab, isTopLevelBar = false, shouldShowFloatingCameraButton = true}: NavigationTabBarProps) { +function NavigationTabBar({selectedTab, isTopLevelBar = false, shouldShowFloatingButtons = true}: NavigationTabBarProps) { const theme = useTheme(); const styles = useThemeStyles(); @@ -512,7 +513,12 @@ function NavigationTabBar({selectedTab, isTopLevelBar = false, shouldShowFloatin onPress={navigateToSettings} /> - {shouldShowFloatingCameraButton && } + {shouldShowFloatingButtons && ( + <> + + + + )} ); } diff --git a/src/languages/de.ts b/src/languages/de.ts index 2d216c725dfe..bc56ed476d43 100644 --- a/src/languages/de.ts +++ b/src/languages/de.ts @@ -8049,7 +8049,8 @@ Hier ist ein *Testbeleg*, um dir zu zeigen, wie es funktioniert:`, subtitle: 'Protokolliere Meilen oder Kilometer automatisch mit GPS und verwandle Fahrten sofort in Ausgaben.', button: 'App herunterladen', }, - notification: {title: 'GPS-Tracking läuft', body: 'Wechsel zur App, um abzuschließen'}, + notification: {title: 'GPS-Tracking läuft', body: 'Zur App gehen, um abzuschließen'}, + fabGpsTripExplained: 'Zur GPS-Ansicht wechseln (Schnellaktion)', }, }; // IMPORTANT: This line is manually replaced in generate translation files by scripts/generateTranslations.ts, diff --git a/src/languages/en.ts b/src/languages/en.ts index 54a03f8bd775..aabf2b4f078f 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -7132,6 +7132,7 @@ const translations = { title: 'GPS tracking in progress', body: 'Go to the app to finish', }, + fabGpsTripExplained: 'Go to GPS screen (Floating action)', }, reportCardLostOrDamaged: { screenTitle: 'Report card lost or damaged', diff --git a/src/languages/es.ts b/src/languages/es.ts index 1fca52ab4101..1a0af9e82e62 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -8159,6 +8159,7 @@ ${amount} para ${merchant} - ${date}`, title: 'Seguimiento GPS en curso', body: 'Ve a la app para finalizar', }, + fabGpsTripExplained: 'Ir a la pantalla de GPS (Acción flotante)', }, }; diff --git a/src/languages/fr.ts b/src/languages/fr.ts index 1a8ec68cc22f..51fe31cd6476 100644 --- a/src/languages/fr.ts +++ b/src/languages/fr.ts @@ -8057,6 +8057,7 @@ Voici un *reçu test* pour vous montrer comment cela fonctionne :`, button: 'Télécharger l’application', }, notification: {title: 'Suivi GPS en cours', body: 'Allez dans l’application pour terminer'}, + fabGpsTripExplained: 'Aller à l’écran GPS (action flottante)', }, }; // IMPORTANT: This line is manually replaced in generate translation files by scripts/generateTranslations.ts, diff --git a/src/languages/it.ts b/src/languages/it.ts index 18487d44ad28..7a4f9795159c 100644 --- a/src/languages/it.ts +++ b/src/languages/it.ts @@ -8037,7 +8037,8 @@ Ecco una *ricevuta di prova* per mostrarti come funziona:`, subtitle: 'Registra automaticamente miglia o chilometri con il GPS e trasforma i viaggi in spese all’istante.', button: 'Scarica l’app', }, - notification: {title: 'Tracciamento GPS in corso', body: "Vai all'app per completare"}, + notification: {title: 'Tracciamento GPS in corso', body: "Vai all'app per terminare"}, + fabGpsTripExplained: 'Vai alla schermata GPS (azione flottante)', }, }; // IMPORTANT: This line is manually replaced in generate translation files by scripts/generateTranslations.ts, diff --git a/src/languages/ja.ts b/src/languages/ja.ts index 84ccb5c51040..2ee6ce032767 100644 --- a/src/languages/ja.ts +++ b/src/languages/ja.ts @@ -7952,6 +7952,7 @@ Expensify の使い方をお見せするための*テストレシート*がこ preciseLocationRequiredModal: {title: '正確な位置情報が必要です', prompt: 'GPS距離の追跡を開始するには、デバイスの設定で「正確な位置情報」を有効にしてください。'}, desktop: {title: 'スマートフォンで距離を記録する', subtitle: 'GPS で自動的にマイルまたはキロメートルを記録し、移動をすぐに経費に変換します。', button: 'アプリをダウンロード'}, notification: {title: 'GPS追跡を実行中', body: '完了するにはアプリに移動'}, + fabGpsTripExplained: 'GPS画面へ移動(フローティングアクション)', }, }; // IMPORTANT: This line is manually replaced in generate translation files by scripts/generateTranslations.ts, diff --git a/src/languages/nl.ts b/src/languages/nl.ts index 7a8891c17d33..cdd22ce5095f 100644 --- a/src/languages/nl.ts +++ b/src/languages/nl.ts @@ -8015,7 +8015,8 @@ Hier is een *testbon* om je te laten zien hoe het werkt:`, }, preciseLocationRequiredModal: {title: 'Precieze locatie vereist', prompt: 'Schakel "precieze locatie" in de instellingen van je apparaat in om GPS-afstandsregistratie te starten.'}, desktop: {title: 'Volg afstand op je telefoon', subtitle: 'Leg kilometers of mijlen automatisch vast met GPS en zet ritten direct om in uitgaven.', button: 'Download de app'}, - notification: {title: 'GPS-tracking bezig', body: 'Ga naar de app om af te ronden'}, + notification: {title: 'GPS-tracking bezig', body: 'Ga naar de app om te voltooien'}, + fabGpsTripExplained: 'Ga naar GPS-scherm (Zwevende actie)', }, }; // IMPORTANT: This line is manually replaced in generate translation files by scripts/generateTranslations.ts, diff --git a/src/languages/pl.ts b/src/languages/pl.ts index 050d837685d0..a65a395db3d7 100644 --- a/src/languages/pl.ts +++ b/src/languages/pl.ts @@ -7998,7 +7998,8 @@ Oto *paragon testowy*, który pokazuje, jak to działa:`, subtitle: 'Automatycznie rejestruj mile lub kilometry za pomocą GPS i natychmiast zamieniaj podróże w wydatki.', button: 'Pobierz aplikację', }, - notification: {title: 'Śledzenie GPS w toku', body: 'Przejdź do aplikacji, aby zakończyć'}, + notification: {title: 'Śledzenie GPS w toku', body: 'Przejdź do aplikacji, aby dokończyć'}, + fabGpsTripExplained: 'Przejdź do ekranu GPS (przycisk akcji)', }, }; // IMPORTANT: This line is manually replaced in generate translation files by scripts/generateTranslations.ts, diff --git a/src/languages/pt-BR.ts b/src/languages/pt-BR.ts index f56fc6037a0d..35601366d5d8 100644 --- a/src/languages/pt-BR.ts +++ b/src/languages/pt-BR.ts @@ -8008,7 +8008,8 @@ Aqui está um *recibo de teste* para mostrar como funciona:`, subtitle: 'Registre milhas ou quilômetros automaticamente com o GPS e transforme viagens em despesas instantaneamente.', button: 'Baixar o app', }, - notification: {title: 'Rastreamento de GPS em andamento', body: 'Vá para o app para finalizar'}, + notification: {title: 'Rastreamento por GPS em andamento', body: 'Ir para o app para finalizar'}, + fabGpsTripExplained: 'Ir para a tela de GPS (Ação flutuante)', }, }; // IMPORTANT: This line is manually replaced in generate translation files by scripts/generateTranslations.ts, diff --git a/src/languages/zh-hans.ts b/src/languages/zh-hans.ts index a857b376d81a..1bd39c77f6a7 100644 --- a/src/languages/zh-hans.ts +++ b/src/languages/zh-hans.ts @@ -7798,6 +7798,7 @@ ${reportName} preciseLocationRequiredModal: {title: '需要精确位置', prompt: '请在设备设置中启用“精确位置”以开始 GPS 距离跟踪。'}, desktop: {title: '在手机上跟踪距离', subtitle: '使用 GPS 自动记录英里或公里,并将行程即时转换为报销费用。', button: '下载应用程序'}, notification: {title: '正在进行 GPS 跟踪', body: '前往应用完成'}, + fabGpsTripExplained: '前往 GPS 屏幕(悬浮操作)', }, }; // IMPORTANT: This line is manually replaced in generate translation files by scripts/generateTranslations.ts, diff --git a/src/libs/actions/GPSDraftDetails.ts b/src/libs/actions/GPSDraftDetails.ts index 3db8c99883fd..17aa10935ac5 100644 --- a/src/libs/actions/GPSDraftDetails.ts +++ b/src/libs/actions/GPSDraftDetails.ts @@ -20,13 +20,14 @@ function setEndAddress(endAddress: GpsDraftDetails['endAddress']) { }); } -function initGpsDraft() { +function initGpsDraft(reportID: string) { Onyx.merge(ONYXKEYS.GPS_DRAFT_DETAILS, { gpsPoints: [], isTracking: true, distanceInMeters: 0, startAddress: {value: '', type: 'coordinates'}, endAddress: {value: '', type: 'coordinates'}, + reportID, }); } diff --git a/src/pages/domain/DomainInitialPage.tsx b/src/pages/domain/DomainInitialPage.tsx index f98f1fcdeccd..cb7ec2981eba 100644 --- a/src/pages/domain/DomainInitialPage.tsx +++ b/src/pages/domain/DomainInitialPage.tsx @@ -98,7 +98,7 @@ function DomainInitialPage({route}: DomainInitialPageProps) { !shouldDisplayLHB && ( ) } diff --git a/src/pages/iou/request/step/IOURequestStepDistanceGPS/GPSButtons/index.tsx b/src/pages/iou/request/step/IOURequestStepDistanceGPS/GPSButtons/index.tsx index 8550f183a754..8aaefb127f58 100644 --- a/src/pages/iou/request/step/IOURequestStepDistanceGPS/GPSButtons/index.tsx +++ b/src/pages/iou/request/step/IOURequestStepDistanceGPS/GPSButtons/index.tsx @@ -19,9 +19,10 @@ type ButtonsProps = { navigateToNextStep: () => void; setShouldShowStartError: React.Dispatch>; setShouldShowPermissionsError: React.Dispatch>; + reportID: string; }; -function GPSButtons({navigateToNextStep, setShouldShowStartError, setShouldShowPermissionsError}: ButtonsProps) { +function GPSButtons({navigateToNextStep, setShouldShowStartError, setShouldShowPermissionsError, reportID}: ButtonsProps) { const [startPermissionsFlow, setStartPermissionsFlow] = useState(false); const [showLocationRequiredModal, setShowLocationRequiredModal] = useState(false); const [showDiscardConfirmation, setShowDiscardConfirmation] = useState(false); @@ -77,7 +78,7 @@ function GPSButtons({navigateToNextStep, setShouldShowStartError, setShouldShowP return; } - initGpsDraft(); + initGpsDraft(reportID); }; const onNext = () => { diff --git a/src/pages/iou/request/step/IOURequestStepDistanceGPS/index.native.tsx b/src/pages/iou/request/step/IOURequestStepDistanceGPS/index.native.tsx index 8e0ceb334118..d94dca891858 100644 --- a/src/pages/iou/request/step/IOURequestStepDistanceGPS/index.native.tsx +++ b/src/pages/iou/request/step/IOURequestStepDistanceGPS/index.native.tsx @@ -20,7 +20,7 @@ import Waypoints from './Waypoints'; function IOURequestStepDistanceGPS({ report, route: { - params: {action, iouType, reportActionID}, + params: {action, reportID, iouType, reportActionID}, }, transaction, }: IOURequestStepDistanceGPSProps) { @@ -71,6 +71,7 @@ function IOURequestStepDistanceGPS({ navigateToNextStep={() => {}} setShouldShowStartError={setShouldShowStartError} setShouldShowPermissionsError={setShouldShowPermissionsError} + reportID={reportID} /> diff --git a/src/pages/workspace/WorkspaceInitialPage.tsx b/src/pages/workspace/WorkspaceInitialPage.tsx index e3065f783d4d..255a8644516e 100644 --- a/src/pages/workspace/WorkspaceInitialPage.tsx +++ b/src/pages/workspace/WorkspaceInitialPage.tsx @@ -504,7 +504,7 @@ function WorkspaceInitialPage({policyDraft, policy: policyProp, route}: Workspac !shouldDisplayLHB && ( ) } diff --git a/src/pages/workspace/WorkspacesListPage.tsx b/src/pages/workspace/WorkspacesListPage.tsx index 70c9d4781672..e312b292dd89 100755 --- a/src/pages/workspace/WorkspacesListPage.tsx +++ b/src/pages/workspace/WorkspacesListPage.tsx @@ -759,7 +759,7 @@ function WorkspacesListPage() { shouldUseNarrowLayout && ( ) } diff --git a/src/styles/index.ts b/src/styles/index.ts index a358910c2a41..ab4b2d314549 100644 --- a/src/styles/index.ts +++ b/src/styles/index.ts @@ -1638,6 +1638,15 @@ const staticStyles = (theme: ThemeColors) => justifyContent: 'center', }, + floatingSecondaryActionButton: { + backgroundColor: theme.buttonDefaultBG, + height: variables.componentSizeLarge, + width: variables.componentSizeLarge, + borderRadius: 999, + alignItems: 'center', + justifyContent: 'center', + }, + floatingActionButtonSmall: { width: variables.componentSizeNormal, height: variables.componentSizeNormal, @@ -1650,6 +1659,15 @@ const staticStyles = (theme: ThemeColors) => zIndex: 10, }, + floatingGpsButton: { + position: 'absolute', + // floatingCameraButton top property value (componentSizeLarge + 16) + + // + floatingGpsButton height (componentSizeLarge) + gap (12) = 2 * componentSizeLarge + 28 + top: 2 * -variables.componentSizeLarge - 28, + right: 16, + zIndex: 10, + }, + topBarLabel: { color: theme.text, fontSize: variables.fontSizeXLarge, diff --git a/src/types/onyx/GpsDraftDetails.ts b/src/types/onyx/GpsDraftDetails.ts index 58becee852af..a2a99c3d8eb1 100644 --- a/src/types/onyx/GpsDraftDetails.ts +++ b/src/types/onyx/GpsDraftDetails.ts @@ -31,6 +31,9 @@ type GpsDraftDetails = { /** Is GPS trip in progress */ isTracking: boolean; + + /** reportID of the ongoing GPS trip */ + reportID: string; }; export default GpsDraftDetails;