diff --git a/src/components/LocationPermissionModal/index.tsx b/src/components/LocationPermissionModal/index.tsx index 2bc4a7393822..53fa6928b90d 100644 --- a/src/components/LocationPermissionModal/index.tsx +++ b/src/components/LocationPermissionModal/index.tsx @@ -5,7 +5,9 @@ import ConfirmModal from '@components/ConfirmModal'; import * as Illustrations from '@components/Icon/Illustrations'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; +import getPlatform from '@libs/getPlatform'; import {getLocationPermission, requestLocationPermission} from '@pages/iou/request/step/IOURequestStepScan/LocationPermission'; +import CONST from '@src/CONST'; import type {LocationPermissionModalProps} from './types'; function LocationPermissionModal({startPermissionFlow, resetPermissionFlow, onDeny, onGrant}: LocationPermissionModalProps) { @@ -15,6 +17,8 @@ function LocationPermissionModal({startPermissionFlow, resetPermissionFlow, onDe const styles = useThemeStyles(); const {translate} = useLocalize(); + const isWeb = getPlatform() === CONST.PLATFORM.WEB; + useEffect(() => { if (!startPermissionFlow) { return; @@ -32,8 +36,10 @@ function LocationPermissionModal({startPermissionFlow, resetPermissionFlow, onDe }, [startPermissionFlow]); const handledBlockedPermission = (cb: () => void) => () => { - if (hasError && Linking.openSettings) { - Linking.openSettings(); + if (hasError) { + if (Linking.openSettings) { + Linking.openSettings(); + } setShowModal(false); setHasError(false); resetPermissionFlow(); @@ -63,12 +69,20 @@ function LocationPermissionModal({startPermissionFlow, resetPermissionFlow, onDe setHasError(false); }; + const getConfirmText = (): string => { + if (!hasError) { + return translate('common.continue'); + } + + return isWeb ? translate('common.buttonConfirm') : translate('common.settings'); + }; + return (