From 4085511643e345b341576a611bd8b774ba638674 Mon Sep 17 00:00:00 2001 From: c3024 Date: Tue, 5 Sep 2023 19:27:17 +0530 Subject: [PATCH 1/4] disable didnt receive magic code while loading --- .../Profile/Contacts/ValidateCodeForm/BaseValidateCodeForm.js | 4 ++-- src/pages/signin/ValidateCodeForm/BaseValidateCodeForm.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pages/settings/Profile/Contacts/ValidateCodeForm/BaseValidateCodeForm.js b/src/pages/settings/Profile/Contacts/ValidateCodeForm/BaseValidateCodeForm.js index 973a0475846d..21c7f17c126c 100644 --- a/src/pages/settings/Profile/Contacts/ValidateCodeForm/BaseValidateCodeForm.js +++ b/src/pages/settings/Profile/Contacts/ValidateCodeForm/BaseValidateCodeForm.js @@ -170,7 +170,7 @@ function BaseValidateCodeForm(props) { > - {props.translate('validateCodeForm.magicCodeNotReceived')} + {props.translate('validateCodeForm.magicCodeNotReceived')} {props.hasMagicCodeBeenSent && ( - + {hasError ? props.translate('validateCodeForm.requestNewCodeAfterErrorOccurred') : props.translate('validateCodeForm.magicCodeNotReceived')} From d67d9f9fb74cbed14950b88131fedcecb126cd05 Mon Sep 17 00:00:00 2001 From: c3024 Date: Tue, 5 Sep 2023 20:27:05 +0530 Subject: [PATCH 2/4] extract shouldDisableMagicCodeNotReceived for DRY --- .../Contacts/ValidateCodeForm/BaseValidateCodeForm.js | 5 +++-- src/pages/signin/ValidateCodeForm/BaseValidateCodeForm.js | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/pages/settings/Profile/Contacts/ValidateCodeForm/BaseValidateCodeForm.js b/src/pages/settings/Profile/Contacts/ValidateCodeForm/BaseValidateCodeForm.js index 21c7f17c126c..d29738cc57c6 100644 --- a/src/pages/settings/Profile/Contacts/ValidateCodeForm/BaseValidateCodeForm.js +++ b/src/pages/settings/Profile/Contacts/ValidateCodeForm/BaseValidateCodeForm.js @@ -76,6 +76,7 @@ function BaseValidateCodeForm(props) { const loginData = props.loginList[props.contactMethod]; const inputValidateCodeRef = useRef(); const validateLoginError = ErrorUtils.getEarliestErrorField(loginData, 'validateLogin'); + const shouldDisableMagicCodeNotReceived = props.network.isOffline || props.account.isLoading; useImperativeHandle(props.innerRef, () => ({ focus() { @@ -170,7 +171,7 @@ function BaseValidateCodeForm(props) { > - {props.translate('validateCodeForm.magicCodeNotReceived')} + {props.translate('validateCodeForm.magicCodeNotReceived')} {props.hasMagicCodeBeenSent && ( { if (!(inputValidateCodeRef.current && hasError && (props.session.autoAuthState === CONST.AUTO_AUTH_STATE.FAILED || props.account.isLoading))) { @@ -279,13 +280,13 @@ function BaseValidateCodeForm(props) { style={[styles.mt2]} onPress={resendValidateCode} underlayColor={themeColors.componentBG} - disabled={props.network.isOffline || props.account.isLoading} + disabled={shouldDisableMagicCodeNotReceived} hoverDimmingValue={1} pressDimmingValue={0.2} accessibilityRole={CONST.ACCESSIBILITY_ROLE.BUTTON} accessibilityLabel={props.translate('validateCodeForm.magicCodeNotReceived')} > - + {hasError ? props.translate('validateCodeForm.requestNewCodeAfterErrorOccurred') : props.translate('validateCodeForm.magicCodeNotReceived')} From 1d4eb8e63bbe56578f961ea450e89f905d19d1ce Mon Sep 17 00:00:00 2001 From: c3024 Date: Tue, 5 Sep 2023 20:57:03 +0530 Subject: [PATCH 3/4] rename for lint fix --- .../Contacts/ValidateCodeForm/BaseValidateCodeForm.js | 6 +++--- src/pages/signin/ValidateCodeForm/BaseValidateCodeForm.js | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/pages/settings/Profile/Contacts/ValidateCodeForm/BaseValidateCodeForm.js b/src/pages/settings/Profile/Contacts/ValidateCodeForm/BaseValidateCodeForm.js index d29738cc57c6..1a316eaf66f7 100644 --- a/src/pages/settings/Profile/Contacts/ValidateCodeForm/BaseValidateCodeForm.js +++ b/src/pages/settings/Profile/Contacts/ValidateCodeForm/BaseValidateCodeForm.js @@ -76,7 +76,7 @@ function BaseValidateCodeForm(props) { const loginData = props.loginList[props.contactMethod]; const inputValidateCodeRef = useRef(); const validateLoginError = ErrorUtils.getEarliestErrorField(loginData, 'validateLogin'); - const shouldDisableMagicCodeNotReceived = props.network.isOffline || props.account.isLoading; + const shouldDisableDidntReceiveMagicCode = props.network.isOffline || props.account.isLoading; useImperativeHandle(props.innerRef, () => ({ focus() { @@ -171,7 +171,7 @@ function BaseValidateCodeForm(props) { > - {props.translate('validateCodeForm.magicCodeNotReceived')} + {props.translate('validateCodeForm.magicCodeNotReceived')} {props.hasMagicCodeBeenSent && ( { if (!(inputValidateCodeRef.current && hasError && (props.session.autoAuthState === CONST.AUTO_AUTH_STATE.FAILED || props.account.isLoading))) { @@ -280,13 +280,13 @@ function BaseValidateCodeForm(props) { style={[styles.mt2]} onPress={resendValidateCode} underlayColor={themeColors.componentBG} - disabled={shouldDisableMagicCodeNotReceived} + disabled={shouldDisableDidntReceiveMagicCode} hoverDimmingValue={1} pressDimmingValue={0.2} accessibilityRole={CONST.ACCESSIBILITY_ROLE.BUTTON} accessibilityLabel={props.translate('validateCodeForm.magicCodeNotReceived')} > - + {hasError ? props.translate('validateCodeForm.requestNewCodeAfterErrorOccurred') : props.translate('validateCodeForm.magicCodeNotReceived')} From 606e939a165c03cbbe38ed82d8505fffc1a0e458 Mon Sep 17 00:00:00 2001 From: c3024 Date: Mon, 11 Sep 2023 19:28:47 +0530 Subject: [PATCH 4/4] rename to shouldDisableResendValidateCode --- .../Contacts/ValidateCodeForm/BaseValidateCodeForm.js | 6 +++--- src/pages/signin/ValidateCodeForm/BaseValidateCodeForm.js | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/pages/settings/Profile/Contacts/ValidateCodeForm/BaseValidateCodeForm.js b/src/pages/settings/Profile/Contacts/ValidateCodeForm/BaseValidateCodeForm.js index 1a316eaf66f7..bcea33d9c366 100644 --- a/src/pages/settings/Profile/Contacts/ValidateCodeForm/BaseValidateCodeForm.js +++ b/src/pages/settings/Profile/Contacts/ValidateCodeForm/BaseValidateCodeForm.js @@ -76,7 +76,7 @@ function BaseValidateCodeForm(props) { const loginData = props.loginList[props.contactMethod]; const inputValidateCodeRef = useRef(); const validateLoginError = ErrorUtils.getEarliestErrorField(loginData, 'validateLogin'); - const shouldDisableDidntReceiveMagicCode = props.network.isOffline || props.account.isLoading; + const shouldDisableResendValidateCode = props.network.isOffline || props.account.isLoading; useImperativeHandle(props.innerRef, () => ({ focus() { @@ -171,7 +171,7 @@ function BaseValidateCodeForm(props) { > - {props.translate('validateCodeForm.magicCodeNotReceived')} + {props.translate('validateCodeForm.magicCodeNotReceived')} {props.hasMagicCodeBeenSent && ( { if (!(inputValidateCodeRef.current && hasError && (props.session.autoAuthState === CONST.AUTO_AUTH_STATE.FAILED || props.account.isLoading))) { @@ -280,13 +280,13 @@ function BaseValidateCodeForm(props) { style={[styles.mt2]} onPress={resendValidateCode} underlayColor={themeColors.componentBG} - disabled={shouldDisableDidntReceiveMagicCode} + disabled={shouldDisableResendValidateCode} hoverDimmingValue={1} pressDimmingValue={0.2} accessibilityRole={CONST.ACCESSIBILITY_ROLE.BUTTON} accessibilityLabel={props.translate('validateCodeForm.magicCodeNotReceived')} > - + {hasError ? props.translate('validateCodeForm.requestNewCodeAfterErrorOccurred') : props.translate('validateCodeForm.magicCodeNotReceived')}