From 496110e0406d1b46ef39c17f8397d2e5c997bf91 Mon Sep 17 00:00:00 2001 From: tienifr Date: Fri, 26 Jul 2024 16:18:14 +0700 Subject: [PATCH 1/2] fix update settings button title in web --- src/components/LocationPermissionModal/index.tsx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/components/LocationPermissionModal/index.tsx b/src/components/LocationPermissionModal/index.tsx index 2bc4a739382..49dfb812116 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(); @@ -68,7 +74,7 @@ function LocationPermissionModal({startPermissionFlow, resetPermissionFlow, onDe isVisible={showModal} onConfirm={grantLocationPermission} onCancel={skipLocationPermission} - confirmText={hasError ? translate('common.settings') : translate('common.continue')} + confirmText={hasError ? (isWeb ? translate('common.buttonConfirm') : translate('common.settings')) : translate('common.continue')} cancelText={translate('common.notNow')} prompt={translate(hasError ? 'receipt.locationErrorMessage' : 'receipt.locationAccessMessage')} promptStyles={[styles.textLabelSupportingEmptyValue, styles.mb4]} From b251c17a1af9824032d06ae3dbcfeac655d9f9af Mon Sep 17 00:00:00 2001 From: tienifr Date: Fri, 26 Jul 2024 16:42:09 +0700 Subject: [PATCH 2/2] fix lint --- src/components/LocationPermissionModal/index.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/components/LocationPermissionModal/index.tsx b/src/components/LocationPermissionModal/index.tsx index 49dfb812116..53fa6928b90 100644 --- a/src/components/LocationPermissionModal/index.tsx +++ b/src/components/LocationPermissionModal/index.tsx @@ -69,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 (