diff --git a/desktop/main.ts b/desktop/main.ts index 4fb3bfa24c0ba..222db07ea8dc6 100644 --- a/desktop/main.ts +++ b/desktop/main.ts @@ -7,6 +7,7 @@ import log from 'electron-log'; import {autoUpdater} from 'electron-updater'; import type {AuthType, PermissionType} from 'node-mac-permissions'; import {machineId} from 'node-machine-id'; +import type {ValueOf} from 'type-fest'; import checkForUpdates from '@libs/checkForUpdates'; import {translate} from '@libs/Localize'; import Log from '@libs/Log'; @@ -14,14 +15,20 @@ import CONFIG from '@src/CONFIG'; import CONST from '@src/CONST'; import IntlStore from '@src/languages/IntlStore'; import type {TranslationPaths} from '@src/languages/types'; -import type {LocationPermissionState} from '@src/libs/getCurrentPosition/locationPermission'; -import {LOCATION_PERMISSION_STATES} from '@src/libs/getCurrentPosition/locationPermission'; import type PlatformSpecificUpdater from '@src/setup/platformSetup/types'; import type {Locale} from '@src/types/onyx'; import type {CreateDownloadQueueModule, DownloadItem} from './createDownloadQueue'; import serve from './electron-serve'; import ELECTRON_EVENTS from './ELECTRON_EVENTS'; +const LOCATION_PERMISSION_STATES = { + GRANTED: 'granted', + DENIED: 'denied', + PROMPT: 'prompt', +} as const; + +type LocationPermissionState = ValueOf; + const createDownloadQueue = require('./createDownloadQueue').default; const port = process.env.PORT ?? 8082; diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 11150e8d5d80e..7ecb49d341812 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -140,6 +140,8 @@ PODS: - EXImageLoader - ExpoModulesCore - SDWebImageWebPCoder + - ExpoLocation (19.0.7): + - ExpoModulesCore - ExpoModulesCore (3.0.18): - boost - DoubleConversion @@ -2421,34 +2423,6 @@ PODS: - ReactCommon/turbomodule/core - SocketRocket - Yoga - - react-native-geolocation (3.3.0): - - boost - - DoubleConversion - - fast_float - - fmt - - glog - - hermes-engine - - RCT-Folly - - RCT-Folly/Fabric - - RCTRequired - - RCTTypeSafety - - React-Core - - React-debug - - React-Fabric - - React-featureflags - - React-graphics - - React-ImageManager - - React-jsi - - React-NativeModulesApple - - React-RCTFabric - - React-renderercss - - React-rendererdebug - - React-utils - - ReactCodegen - - ReactCommon/turbomodule/bridging - - ReactCommon/turbomodule/core - - SocketRocket - - Yoga - react-native-get-random-values (1.11.0): - React-Core - react-native-image-picker (7.1.2): @@ -4172,6 +4146,7 @@ DEPENDENCIES: - ExpoFont (from `../node_modules/expo-font/ios`) - ExpoImage (from `../node_modules/expo-image/ios`) - ExpoImageManipulator (from `../node_modules/expo-image-manipulator/ios`) + - ExpoLocation (from `../node_modules/expo-location/ios`) - ExpoModulesCore (from `../node_modules/expo-modules-core`) - ExpoSecureStore (from `../node_modules/expo-secure-store/ios`) - ExpoStoreReview (from `../node_modules/expo-store-review/ios`) @@ -4229,7 +4204,6 @@ DEPENDENCIES: - "react-native-cameraroll (from `../node_modules/@react-native-camera-roll/camera-roll`)" - react-native-config (from `../node_modules/react-native-config`) - "react-native-document-picker (from `../node_modules/@react-native-documents/picker`)" - - "react-native-geolocation (from `../node_modules/@react-native-community/geolocation`)" - react-native-get-random-values (from `../node_modules/react-native-get-random-values`) - react-native-image-picker (from `../node_modules/react-native-image-picker`) - react-native-key-command (from `../node_modules/react-native-key-command`) @@ -4383,6 +4357,8 @@ EXTERNAL SOURCES: :path: "../node_modules/expo-image/ios" ExpoImageManipulator: :path: "../node_modules/expo-image-manipulator/ios" + ExpoLocation: + :path: "../node_modules/expo-location/ios" ExpoModulesCore: :path: "../node_modules/expo-modules-core" ExpoSecureStore: @@ -4494,8 +4470,6 @@ EXTERNAL SOURCES: :path: "../node_modules/react-native-config" react-native-document-picker: :path: "../node_modules/@react-native-documents/picker" - react-native-geolocation: - :path: "../node_modules/@react-native-community/geolocation" react-native-get-random-values: :path: "../node_modules/react-native-get-random-values" react-native-image-picker: @@ -4663,6 +4637,7 @@ SPEC CHECKSUMS: ExpoFont: 86ceec09ffed1c99cfee36ceb79ba149074901b5 ExpoImage: e88f500585913969b930e13a4be47277eb7c6de8 ExpoImageManipulator: 7cb78b082bcc767b97867d833ce614ace424cd97 + ExpoLocation: 1dc9e4c06ef66ed081348a11eb637d1dfecc7d61 ExpoModulesCore: e1b5401a7af4c7dbf4fe26b535918a72c6ed8a7b ExpoSecureStore: 3f1b632d6d40bcc62b4983ef9199cd079592a50a ExpoStoreReview: 15f19e0d6cb6e00330ba1b356485bf47ef19c39a @@ -4755,7 +4730,6 @@ SPEC CHECKSUMS: react-native-cameraroll: 8e83b1a4f8abb386b37599918a412add4a87c5e7 react-native-config: 62c1dce61201623334f751c71c7b12c4accbdff8 react-native-document-picker: 18a9d68e6117d37ac5facd87619cbc3ff17575a7 - react-native-geolocation: e7b502b85361b43c94d4270c7f6ff67af44f9aae react-native-get-random-values: d16467cf726c618e9c7a8c3c39c31faa2244bbba react-native-image-picker: 1722f5d3dc5de5039d423e290dc31a717ba9605e react-native-key-command: 7538df85ed26502b2a929c0584235459b26c7a91 diff --git a/package-lock.json b/package-lock.json index e54c068a4c74f..75186271ac257 100644 --- a/package-lock.json +++ b/package-lock.json @@ -37,7 +37,6 @@ "@pusher/pusher-websocket-react-native": "^1.3.1", "@react-native-camera-roll/camera-roll": "7.4.0", "@react-native-clipboard/clipboard": "^1.15.0", - "@react-native-community/geolocation": "3.3.0", "@react-native-community/netinfo": "11.2.1", "@react-native-documents/picker": "^10.1.3", "@react-native-firebase/analytics": "^22.2.1", @@ -71,6 +70,7 @@ "expo-font": "14.0.8", "expo-image": "3.0.8", "expo-image-manipulator": "^13.1.5", + "expo-location": "^19.0.7", "expo-modules-core": "3.0.18", "expo-secure-store": "~14.2.4", "expo-store-review": "~9.0.8", @@ -99,7 +99,6 @@ "react-map-gl": "^7.1.3", "react-native": "0.81.4", "react-native-advanced-input-mask": "1.4.6", - "react-native-android-location-enabler": "^3.0.1", "react-native-app-logs": "0.3.1", "react-native-blob-util": "0.22.2", "react-native-collapsible": "^1.6.2", @@ -11706,17 +11705,6 @@ "node": ">= 4.0.0" } }, - "node_modules/@react-native-community/geolocation": { - "version": "3.3.0", - "license": "MIT", - "engines": { - "node": ">=18.0.0" - }, - "peerDependencies": { - "react": "*", - "react-native": "*" - } - }, "node_modules/@react-native-community/netinfo": { "version": "11.2.1", "license": "MIT", @@ -24699,6 +24687,15 @@ "react": "*" } }, + "node_modules/expo-location": { + "version": "19.0.7", + "resolved": "https://registry.npmjs.org/expo-location/-/expo-location-19.0.7.tgz", + "integrity": "sha512-YNkh4r9E6ECbPkBCAMG5A5yHDgS0pw+Rzyd0l2ZQlCtjkhlODB55nMCKr5CZnUI0mXTkaSm8CwfoCO8n2MpYfg==", + "license": "MIT", + "peerDependencies": { + "expo": "*" + } + }, "node_modules/expo-modules-autolinking": { "version": "3.0.13", "resolved": "https://registry.npmjs.org/expo-modules-autolinking/-/expo-modules-autolinking-3.0.13.tgz", @@ -35119,19 +35116,6 @@ "react-native": "*" } }, - "node_modules/react-native-android-location-enabler": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/react-native-android-location-enabler/-/react-native-android-location-enabler-3.0.1.tgz", - "integrity": "sha512-X4gHdEFf/dqSNhVDQ2cQUibnNRd6xIG34UGDMnwoCKIPLC2wYzALs/gPrDnjrAWsuxjaleZXwUIrX3o9nbtsgw==", - "license": "MIT", - "workspaces": [ - "example" - ], - "peerDependencies": { - "react": "*", - "react-native": "*" - } - }, "node_modules/react-native-app-logs": { "version": "0.3.1", "license": "MIT", diff --git a/package.json b/package.json index 923a9aade84dc..4e574f5a60d4b 100644 --- a/package.json +++ b/package.json @@ -108,7 +108,6 @@ "@pusher/pusher-websocket-react-native": "^1.3.1", "@react-native-camera-roll/camera-roll": "7.4.0", "@react-native-clipboard/clipboard": "^1.15.0", - "@react-native-community/geolocation": "3.3.0", "@react-native-community/netinfo": "11.2.1", "@react-native-documents/picker": "^10.1.3", "@react-native-firebase/analytics": "^22.2.1", @@ -142,6 +141,7 @@ "expo-font": "14.0.8", "expo-image": "3.0.8", "expo-image-manipulator": "^13.1.5", + "expo-location": "^19.0.7", "expo-modules-core": "3.0.18", "expo-secure-store": "~14.2.4", "expo-store-review": "~9.0.8", @@ -170,7 +170,6 @@ "react-map-gl": "^7.1.3", "react-native": "0.81.4", "react-native-advanced-input-mask": "1.4.6", - "react-native-android-location-enabler": "^3.0.1", "react-native-app-logs": "0.3.1", "react-native-blob-util": "0.22.2", "react-native-collapsible": "^1.6.2", diff --git a/src/components/AddressSearch/index.tsx b/src/components/AddressSearch/index.tsx index b116d02be8c88..ce6dc086bcf06 100644 --- a/src/components/AddressSearch/index.tsx +++ b/src/components/AddressSearch/index.tsx @@ -286,10 +286,6 @@ function AddressSearch({ setIsFetchingCurrentLocation(false); setLocationErrorCode(errorData?.code ?? null); }, - { - maximumAge: 0, // No cache, always get fresh location info - timeout: 30000, - }, ); }; diff --git a/src/libs/getCurrentPosition/getCurrentPosition.types.ts b/src/libs/getCurrentPosition/getCurrentPosition.types.ts index a84dc2f0c7815..a6be3362dde1b 100644 --- a/src/libs/getCurrentPosition/getCurrentPosition.types.ts +++ b/src/libs/getCurrentPosition/getCurrentPosition.types.ts @@ -1,3 +1,4 @@ +import type {LocationOptions} from 'expo-location'; import type {ValueOf} from 'type-fest'; type GeolocationSuccessCallback = (position: { @@ -5,7 +6,7 @@ type GeolocationSuccessCallback = (position: { latitude: number; longitude: number; altitude: number | null; - accuracy: number; + accuracy: number | null; altitudeAccuracy: number | null; heading: number | null; speed: number | null; @@ -15,16 +16,7 @@ type GeolocationSuccessCallback = (position: { type GeolocationErrorCodeType = ValueOf | null; -type GeolocationErrorCallback = (error?: { - code: GeolocationErrorCodeType; - message: string; - PERMISSION_DENIED: typeof GeolocationErrorCode.PERMISSION_DENIED; - POSITION_UNAVAILABLE: typeof GeolocationErrorCode.POSITION_UNAVAILABLE; - TIMEOUT: typeof GeolocationErrorCode.TIMEOUT; - - /* Web only */ - NOT_SUPPORTED?: typeof GeolocationErrorCode.NOT_SUPPORTED; -}) => void; +type GeolocationErrorCallback = (error?: {code: GeolocationErrorCodeType; message: string}) => void; const GeolocationErrorCode = { PERMISSION_DENIED: 1, @@ -33,25 +25,7 @@ const GeolocationErrorCode = { NOT_SUPPORTED: -1, }; -type GeolocationOptions = { - timeout?: number; - maximumAge?: number; - enableHighAccuracy?: boolean; - - /** Native only */ - distanceFilter?: number; - - /** Native only */ - useSignificantChanges?: boolean; - - /** Native only */ - interval?: number; - - /** Native only */ - fastestInterval?: number; -}; - -type GetCurrentPosition = (success: GeolocationSuccessCallback, error: GeolocationErrorCallback, options?: GeolocationOptions) => void; +type GetCurrentPosition = (success: GeolocationSuccessCallback, error: GeolocationErrorCallback, options?: LocationOptions) => Promise; export {GeolocationErrorCode}; diff --git a/src/libs/getCurrentPosition/index.android.ts b/src/libs/getCurrentPosition/index.android.ts deleted file mode 100644 index 8b0d1c76d25fe..0000000000000 --- a/src/libs/getCurrentPosition/index.android.ts +++ /dev/null @@ -1,55 +0,0 @@ -// https://github.com/Richou/react-native-android-location-enabler/issues/40 -// If we update our react native version, we need to test this file again -import Geolocation from '@react-native-community/geolocation'; -import {promptForEnableLocationIfNeeded} from 'react-native-android-location-enabler'; -import type {GetCurrentPosition} from './getCurrentPosition.types'; -import {GeolocationErrorCode} from './getCurrentPosition.types'; - -Geolocation.setRNConfiguration({ - skipPermissionRequests: false, - authorizationLevel: 'whenInUse', - locationProvider: 'auto', -}); - -const getCurrentPosition: GetCurrentPosition = (success, error, config) => { - // Prompt's the user to enable geolocation permission with yes/no options - // If the user selects yes, then this module would enable the native system location - // Otherwise if user selects no, or we have an issue displaying the prompt, it will return an error - promptForEnableLocationIfNeeded({ - interval: 2000, // This updates location after every 2 seconds (required prop). We don't depend on this as we only use the location once. - }) - .then((permissionState) => { - if (permissionState === 'enabled') { - // If the user just enabled the permission by clicking 'Ok', sometimes we need to wait before - // the native system location/gps is setup, this is usually device specific, but a wait of a few - // milliseconds will be enough. Currently its using 500ms, it seemed enough for Android 12 test - // device. In rare cases when the device takes longer than 500ms, then Geolocation.getCurrentPosition - // will throw an error in which case the user can always call the action again to retry (but its rare). - setTimeout(() => { - Geolocation.getCurrentPosition(success, error, config); - }, 500); - return; - } - - // if location permission is 'already-enabled', then directly get the updated location. - Geolocation.getCurrentPosition(success, error, config); - }) - .catch(() => { - // An error here can be because of these reasons - // 1. User denied location permission - // 2. Failure to open the permission dialog - // 3. Device location settings can't be changed or the device doesn't support some location settings - // 4. Any internal error - // For all of these we will return a permission denied error. - error({ - code: GeolocationErrorCode.PERMISSION_DENIED, - message: 'Geolocation is not supported by this environment.', - PERMISSION_DENIED: GeolocationErrorCode.PERMISSION_DENIED, - POSITION_UNAVAILABLE: GeolocationErrorCode.POSITION_UNAVAILABLE, - TIMEOUT: GeolocationErrorCode.TIMEOUT, - NOT_SUPPORTED: GeolocationErrorCode.NOT_SUPPORTED, - }); - }); -}; - -export default getCurrentPosition; diff --git a/src/libs/getCurrentPosition/index.desktop.ts b/src/libs/getCurrentPosition/index.desktop.ts deleted file mode 100644 index 1a2d8b1fb73c0..0000000000000 --- a/src/libs/getCurrentPosition/index.desktop.ts +++ /dev/null @@ -1,62 +0,0 @@ -import type {ValueOf} from 'type-fest'; -import type {GetCurrentPosition} from './getCurrentPosition.types'; -import {GeolocationErrorCode} from './getCurrentPosition.types'; -import type {LocationPermissionState} from './locationPermission'; -import {LOCATION_PERMISSION_STATES} from './locationPermission'; - -const makeError = (code: ValueOf, message: string) => ({ - code, - message, - PERMISSION_DENIED: GeolocationErrorCode.PERMISSION_DENIED, - POSITION_UNAVAILABLE: GeolocationErrorCode.POSITION_UNAVAILABLE, - TIMEOUT: GeolocationErrorCode.TIMEOUT, - NOT_SUPPORTED: GeolocationErrorCode.NOT_SUPPORTED, -}); - -const isLocationPermissionState = (status: unknown): status is LocationPermissionState => - typeof status === 'string' && Object.values(LOCATION_PERMISSION_STATES).includes(status as LocationPermissionState); - -const getCurrentPosition: GetCurrentPosition = (success, error, options) => { - const doGeoRequest = () => { - try { - navigator.geolocation.getCurrentPosition(success, error, options); - } catch (caughtError) { - let reason = 'Geolocation call failed'; - if (caughtError instanceof Error) { - reason = caughtError.message; - } else if (typeof caughtError === 'string') { - reason = caughtError; - } - - error(makeError(GeolocationErrorCode.POSITION_UNAVAILABLE, reason)); - } - }; - - // IPC-based permission checking - if (typeof window !== 'undefined' && window.electron?.invoke) { - window.electron - .invoke('check-location-permission') - .then((permissionStatus: unknown) => { - if (!isLocationPermissionState(permissionStatus)) { - error(makeError(GeolocationErrorCode.PERMISSION_DENIED, 'Unable to verify location permissions. Enable location access and try again.')); - return; - } - - if (permissionStatus === LOCATION_PERMISSION_STATES.DENIED) { - error(makeError(GeolocationErrorCode.PERMISSION_DENIED, 'Location access denied. Enable location permissions in system settings.')); - return; - } - - doGeoRequest(); - }) - .catch(() => { - error(makeError(GeolocationErrorCode.PERMISSION_DENIED, 'Unable to verify location permissions. Enable location access and try again.')); - }); - - return; // handled via IPC - } - - doGeoRequest(); // Fallback to direct geolocation -}; - -export default getCurrentPosition; diff --git a/src/libs/getCurrentPosition/index.ios.ts b/src/libs/getCurrentPosition/index.ios.ts deleted file mode 100644 index e64abb0d4329e..0000000000000 --- a/src/libs/getCurrentPosition/index.ios.ts +++ /dev/null @@ -1,14 +0,0 @@ -import Geolocation from '@react-native-community/geolocation'; -import type {GetCurrentPosition} from './getCurrentPosition.types'; - -Geolocation.setRNConfiguration({ - skipPermissionRequests: false, - authorizationLevel: 'whenInUse', - locationProvider: 'auto', -}); - -const getCurrentPosition: GetCurrentPosition = (success, error, config) => { - Geolocation.getCurrentPosition(success, error, config); -}; - -export default getCurrentPosition; diff --git a/src/libs/getCurrentPosition/index.ts b/src/libs/getCurrentPosition/index.ts index 318d4f64ed344..e64a8e9b0f5ce 100644 --- a/src/libs/getCurrentPosition/index.ts +++ b/src/libs/getCurrentPosition/index.ts @@ -1,20 +1,34 @@ -import type {GetCurrentPosition} from './getCurrentPosition.types'; +import {getCurrentPositionAsync, PermissionStatus, requestForegroundPermissionsAsync} from 'expo-location'; +import type {PermissionResponse} from 'expo-location'; import {GeolocationErrorCode} from './getCurrentPosition.types'; +import type {GetCurrentPosition} from './getCurrentPosition.types'; + +const getCurrentPosition: GetCurrentPosition = async (success, error, options) => { + const foregroundPermissionResponse: PermissionResponse = await requestForegroundPermissionsAsync(); -const getCurrentPosition: GetCurrentPosition = (success, error, options) => { - if (navigator === undefined || !('geolocation' in navigator)) { - error({ - code: GeolocationErrorCode.NOT_SUPPORTED, - message: 'Geolocation is not supported by this environment.', - PERMISSION_DENIED: GeolocationErrorCode.PERMISSION_DENIED, - POSITION_UNAVAILABLE: GeolocationErrorCode.POSITION_UNAVAILABLE, - TIMEOUT: GeolocationErrorCode.TIMEOUT, - NOT_SUPPORTED: GeolocationErrorCode.NOT_SUPPORTED, - }); + if (foregroundPermissionResponse.status !== PermissionStatus.GRANTED) { + error({code: GeolocationErrorCode.PERMISSION_DENIED, message: 'User denied access to location.'}); return; } - navigator.geolocation.getCurrentPosition(success, error, options); + try { + const currentPosition = await getCurrentPositionAsync(options); + success(currentPosition); + } catch (caughtError) { + let message = 'Geolocation call failed'; + let code = GeolocationErrorCode.POSITION_UNAVAILABLE; + + if (caughtError instanceof GeolocationPositionError) { + code = caughtError.code; + message = caughtError.message; + } else if (caughtError instanceof Error) { + message = caughtError.message; + } else if (typeof caughtError === 'string') { + message = caughtError; + } + + error({code, message}); + } }; export default getCurrentPosition; diff --git a/src/libs/getCurrentPosition/locationPermission.ts b/src/libs/getCurrentPosition/locationPermission.ts deleted file mode 100644 index 00bb8d67e53ad..0000000000000 --- a/src/libs/getCurrentPosition/locationPermission.ts +++ /dev/null @@ -1,12 +0,0 @@ -import type {ValueOf} from 'type-fest'; - -const LOCATION_PERMISSION_STATES = { - GRANTED: 'granted', - DENIED: 'denied', - PROMPT: 'prompt', -} as const; - -type LocationPermissionState = ValueOf; - -export type {LocationPermissionState}; -export {LOCATION_PERMISSION_STATES}; diff --git a/src/pages/Share/SubmitDetailsPage.tsx b/src/pages/Share/SubmitDetailsPage.tsx index ca885037a80a5..1f74f283b5ca3 100644 --- a/src/pages/Share/SubmitDetailsPage.tsx +++ b/src/pages/Share/SubmitDetailsPage.tsx @@ -196,10 +196,6 @@ function SubmitDetailsPage({ Log.info('[SubmitDetailsPage] getCurrentPosition failed', false, errorData); finishRequestAndNavigate(participant, receipt); }, - { - maximumAge: CONST.GPS.MAX_AGE, - timeout: CONST.GPS.TIMEOUT, - }, ); return; } diff --git a/src/pages/iou/request/step/IOURequestStepConfirmation.tsx b/src/pages/iou/request/step/IOURequestStepConfirmation.tsx index 25564bdf6dde8..21fead678f197 100644 --- a/src/pages/iou/request/step/IOURequestStepConfirmation.tsx +++ b/src/pages/iou/request/step/IOURequestStepConfirmation.tsx @@ -1005,10 +1005,6 @@ function IOURequestStepConfirmation({ // When there is an error, the money can still be requested, it just won't include the GPS coordinates trackExpense(selectedParticipants); }, - { - maximumAge: CONST.GPS.MAX_AGE, - timeout: CONST.GPS.TIMEOUT, - }, ); return; } @@ -1055,10 +1051,6 @@ function IOURequestStepConfirmation({ // When there is an error, the money can still be requested, it just won't include the GPS coordinates requestMoney(selectedParticipants); }, - { - maximumAge: CONST.GPS.MAX_AGE, - timeout: CONST.GPS.TIMEOUT, - }, ); return; } diff --git a/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx b/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx index 6b819c6ad191f..e1feec32b4107 100644 --- a/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx +++ b/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx @@ -463,10 +463,6 @@ function IOURequestStepScan({ // When there is an error, the money can still be requested, it just won't include the GPS coordinates createTransaction(files, participant); }, - { - maximumAge: CONST.GPS.MAX_AGE, - timeout: CONST.GPS.TIMEOUT, - }, ); return; } diff --git a/src/pages/iou/request/step/IOURequestStepScan/index.tsx b/src/pages/iou/request/step/IOURequestStepScan/index.tsx index 75dfae3c90270..3e336505cf954 100644 --- a/src/pages/iou/request/step/IOURequestStepScan/index.tsx +++ b/src/pages/iou/request/step/IOURequestStepScan/index.tsx @@ -315,10 +315,6 @@ function IOURequestStepScan({ setUserLocation({longitude: successData.coords.longitude, latitude: successData.coords.latitude}); }, () => {}, - { - maximumAge: CONST.GPS.MAX_AGE, - timeout: CONST.GPS.TIMEOUT, - }, ); }); }, [initialTransaction?.amount, iouType]); @@ -523,10 +519,6 @@ function IOURequestStepScan({ // When there is an error, the money can still be requested, it just won't include the GPS coordinates createTransaction(files, participant); }, - { - maximumAge: CONST.GPS.MAX_AGE, - timeout: CONST.GPS.TIMEOUT, - }, ); return; } diff --git a/tests/ui/AddressPageTest.tsx b/tests/ui/AddressPageTest.tsx index c607d354988cb..b10f1ebd181fa 100644 --- a/tests/ui/AddressPageTest.tsx +++ b/tests/ui/AddressPageTest.tsx @@ -24,10 +24,6 @@ jest.mock('@rnmapbox/maps', () => { }; }); -jest.mock('@react-native-community/geolocation', () => ({ - setRNConfiguration: jest.fn(), -})); - const Stack = createPlatformStackNavigator(); const renderPage = (initialRouteName: typeof SCREENS.SETTINGS.PROFILE.ADDRESS) => { diff --git a/tests/ui/AssignCardFeedPage.tsx b/tests/ui/AssignCardFeedPage.tsx index c7f8134874e8d..83bbb8f152782 100644 --- a/tests/ui/AssignCardFeedPage.tsx +++ b/tests/ui/AssignCardFeedPage.tsx @@ -58,10 +58,6 @@ jest.mock('@rnmapbox/maps', () => { }; }); -jest.mock('@react-native-community/geolocation', () => ({ - setRNConfiguration: jest.fn(), -})); - jest.mock('react-native-plaid-link-sdk', () => ({ dismissLink: jest.fn(), openLink: jest.fn(), diff --git a/tests/ui/IOURequestStartPageTest.tsx b/tests/ui/IOURequestStartPageTest.tsx index e6dec5ce08617..31d9d2aa104fa 100644 --- a/tests/ui/IOURequestStartPageTest.tsx +++ b/tests/ui/IOURequestStartPageTest.tsx @@ -27,10 +27,6 @@ jest.mock('react-native-tab-view', () => ({ TabBar: 'TabBar', })); -jest.mock('@react-native-community/geolocation', () => ({ - setRNConfiguration: jest.fn(), -})); - jest.mock('react-native-vision-camera', () => ({ useCameraDevice: jest.fn(), })); diff --git a/tests/ui/MoneyRequestReportPreview.test.tsx b/tests/ui/MoneyRequestReportPreview.test.tsx index 8361e6699868a..e2c9624fc5a8a 100644 --- a/tests/ui/MoneyRequestReportPreview.test.tsx +++ b/tests/ui/MoneyRequestReportPreview.test.tsx @@ -37,10 +37,6 @@ jest.mock('@rnmapbox/maps', () => { }; }); -jest.mock('@react-native-community/geolocation', () => ({ - setRNConfiguration: jest.fn(), -})); - jest.mock('@src/hooks/useReportWithTransactionsAndViolations', () => jest.fn((): [OnyxEntry, Transaction[], OnyxCollection] => { return [mockChatReport, [mockTransaction, {...mockTransaction, transactionID: mockSecondTransactionID}], {violations: mockViolations}]; diff --git a/tests/ui/OnboardingEmployees.tsx b/tests/ui/OnboardingEmployees.tsx index 7075167a43c62..7a844676551c6 100644 --- a/tests/ui/OnboardingEmployees.tsx +++ b/tests/ui/OnboardingEmployees.tsx @@ -30,10 +30,6 @@ jest.mock('@rnmapbox/maps', () => { }; }); -jest.mock('@react-native-community/geolocation', () => ({ - setRNConfiguration: jest.fn(), -})); - TestHelper.setupGlobalFetchMock(); const Stack = createPlatformStackNavigator(); diff --git a/tests/ui/ReportAttachments.tsx b/tests/ui/ReportAttachments.tsx index b420334dc81ae..7aae70f2e69c8 100644 --- a/tests/ui/ReportAttachments.tsx +++ b/tests/ui/ReportAttachments.tsx @@ -32,10 +32,6 @@ jest.mock('@rnmapbox/maps', () => { setAccessToken: jest.fn(), }; }); - -jest.mock('@react-native-community/geolocation', () => ({ - setRNConfiguration: jest.fn(), -})); jest.mock('@src/components/Attachments/AttachmentCarousel/Pager/usePageScrollHandler', () => jest.fn()); const renderPage = (initialRouteName: typeof SCREENS.REPORT_ATTACHMENTS, initialParams: AuthScreensParamList[typeof SCREENS.REPORT_ATTACHMENTS]) => { diff --git a/tests/ui/WorkEmailOnboarding.tsx b/tests/ui/WorkEmailOnboarding.tsx index 0ad303118ca89..65e39f4985a8d 100644 --- a/tests/ui/WorkEmailOnboarding.tsx +++ b/tests/ui/WorkEmailOnboarding.tsx @@ -42,10 +42,6 @@ jest.mock('@rnmapbox/maps', () => { }; }); -jest.mock('@react-native-community/geolocation', () => ({ - setRNConfiguration: jest.fn(), -})); - TestHelper.setupGlobalFetchMock(); const Stack = createPlatformStackNavigator(); diff --git a/tests/ui/components/IOURequestStepConfirmationPageTest.tsx b/tests/ui/components/IOURequestStepConfirmationPageTest.tsx index b3067708d2372..b41b162ec59da 100644 --- a/tests/ui/components/IOURequestStepConfirmationPageTest.tsx +++ b/tests/ui/components/IOURequestStepConfirmationPageTest.tsx @@ -24,9 +24,6 @@ jest.mock('@rnmapbox/maps', () => { setAccessToken: jest.fn(), }; }); -jest.mock('@react-native-community/geolocation', () => ({ - setRNConfiguration: jest.fn(), -})); jest.mock('@libs/actions/IOU', () => { const actualNav = jest.requireActual('@libs/actions/IOU'); return { diff --git a/tests/unit/OptionsListUtilsTest.tsx b/tests/unit/OptionsListUtilsTest.tsx index a5c19aea15613..77aac5e365e01 100644 --- a/tests/unit/OptionsListUtilsTest.tsx +++ b/tests/unit/OptionsListUtilsTest.tsx @@ -68,10 +68,6 @@ jest.mock('@rnmapbox/maps', () => { }; }); -jest.mock('@react-native-community/geolocation', () => ({ - setRNConfiguration: jest.fn(), -})); - jest.mock('@src/libs/Navigation/Navigation', () => ({ navigate: jest.fn(), dismissModal: jest.fn(), diff --git a/tests/unit/PaymentCardFormTest.tsx b/tests/unit/PaymentCardFormTest.tsx index 13e2ccea75894..d5c8dfc80175e 100644 --- a/tests/unit/PaymentCardFormTest.tsx +++ b/tests/unit/PaymentCardFormTest.tsx @@ -25,10 +25,6 @@ jest.mock('@components/RenderHTML', () => { }; }); -jest.mock('@react-native-community/geolocation', () => ({ - setRNConfiguration: jest.fn(), -})); - jest.mock('@libs/ReportUtils', () => ({ getReportIDFromLink: jest.fn(() => ''), parseReportRouteParams: jest.fn(() => ({reportID: ''})), diff --git a/tests/unit/useSearchHighlightAndScrollTest.ts b/tests/unit/useSearchHighlightAndScrollTest.ts index 5ae78e22e86c1..8bf7650b979fe 100644 --- a/tests/unit/useSearchHighlightAndScrollTest.ts +++ b/tests/unit/useSearchHighlightAndScrollTest.ts @@ -16,12 +16,6 @@ jest.mock('@rnmapbox/maps', () => ({ MarkerView: {}, setAccessToken: jest.fn(), })); -jest.mock('@react-native-community/geolocation', () => ({ - setRNConfiguration: jest.fn(), - getCurrentPosition: jest.fn(), - watchPosition: jest.fn(), - clearWatch: jest.fn(), -})); const mockUseIsFocused = jest.fn().mockReturnValue(true);