Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix send code validation #47772

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
cc76bed
send code on navigation from contact method page
teneeto Aug 21, 2024
5a6f82b
fix lint
teneeto Aug 21, 2024
e526129
extract to function
teneeto Aug 21, 2024
9280c86
show link has been re-sent only when resend button is pressed
teneeto Aug 21, 2024
06d4979
fix lint
teneeto Aug 21, 2024
7f002bf
Merge branch 'main' of github.com:teneeto/Expensify into fix/41330/se…
teneeto Aug 21, 2024
a0212b3
fix lint
teneeto Aug 22, 2024
1d80914
Merge branch 'main' of github.com:teneeto/Expensify into fix/41330/se…
teneeto Aug 22, 2024
82f095d
Merge branch 'main' of github.com:teneeto/Expensify into fix/41330/se…
teneeto Aug 28, 2024
2cc1c20
Merge branch 'main' of github.com:teneeto/Expensify into fix/41330/se…
teneeto Aug 28, 2024
b1263d7
Merge branch 'main' of github.com:teneeto/Expensify into fix/41330/se…
teneeto Aug 29, 2024
bf2a654
Merge branch 'main' of github.com:teneeto/Expensify into fix/41330/se…
teneeto Sep 3, 2024
9503dba
update navigation for add new contact method
teneeto Sep 3, 2024
a84cbb5
fix conflict
teneeto Sep 3, 2024
fd9235b
remove add new contact method navigation
teneeto Sep 3, 2024
56d5937
Merge branch 'main' of github.com:teneeto/Expensify into fix/41330/se…
teneeto Sep 4, 2024
d137dc5
re: add new contact method navigation
teneeto Sep 10, 2024
4ed31ee
Merge branch 'main' of github.com:teneeto/Expensify into fix/41330/se…
teneeto Sep 11, 2024
52949cf
redirect user to contact list
teneeto Sep 13, 2024
aae2f6e
Merge branch 'main' of github.com:teneeto/Expensify into fix/41330/se…
teneeto Sep 17, 2024
8a7666e
navigate to contact method details
teneeto Sep 17, 2024
9ce5700
Merge branch 'main' of github.com:teneeto/Expensify into fix/41330/se…
teneeto Sep 26, 2024
14dab40
Merge branch 'main' of github.com:teneeto/Expensify into fix/41330/se…
teneeto Oct 1, 2024
85a4e9c
use useOnyx
teneeto Oct 1, 2024
4cac86e
remove unused prop types
teneeto Oct 1, 2024
7922dbd
remove unused imports
teneeto Oct 1, 2024
910c01e
Merge branch 'main' of github.com:teneeto/Expensify into fix/41330/se…
teneeto Oct 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/pages/settings/Profile/Contacts/ContactMethodsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import useLocalize from '@hooks/useLocalize';
import useThemeStyles from '@hooks/useThemeStyles';
import Navigation from '@libs/Navigation/Navigation';
import type {SettingsNavigatorParamList} from '@libs/Navigation/types';
import * as User from '@userActions/User';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
Expand Down Expand Up @@ -72,6 +73,13 @@ function ContactMethodsPage({loginList, session, route}: ContactMethodsPageProps
const partnerUserID = login?.partnerUserID || loginName;
const menuItemTitle = Str.isSMSLogin(partnerUserID) ? formatPhoneNumber(partnerUserID) : partnerUserID;

const NavigateToContactMethodDetails = () => {
Navigation.navigate(ROUTES.SETTINGS_CONTACT_METHOD_DETAILS.getRoute(partnerUserID, navigateBackTo));
if (!login?.validatedDate) {
User.requestContactMethodValidateCode(loginName);
}
};

return (
<OfflineWithFeedback
pendingAction={pendingAction}
Expand All @@ -80,7 +88,7 @@ function ContactMethodsPage({loginList, session, route}: ContactMethodsPageProps
<MenuItem
title={menuItemTitle}
description={description}
onPress={() => Navigation.navigate(ROUTES.SETTINGS_CONTACT_METHOD_DETAILS.getRoute(partnerUserID, navigateBackTo))}
onPress={NavigateToContactMethodDetails}
brickRoadIndicator={indicator}
shouldShowBasicTitle
shouldShowRightIcon
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ function BaseValidateCodeForm({account = {}, contactMethod, hasMagicCodeBeenSent
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- nullish coalescing doesn't achieve the same result in this case
const shouldDisableResendValidateCode = !!isOffline || account?.isLoading;
const focusTimeoutRef = useRef<NodeJS.Timeout | null>(null);
const isInitialCodeSent = useRef<boolean>(false);

useImperativeHandle(innerRef, () => ({
focus() {
Expand Down Expand Up @@ -134,6 +135,7 @@ function BaseValidateCodeForm({account = {}, contactMethod, hasMagicCodeBeenSent
const resendValidateCode = () => {
User.requestContactMethodValidateCode(contactMethod);
inputValidateCodeRef.current?.clear();
isInitialCodeSent.current = true;
};

/**
Expand Down Expand Up @@ -201,7 +203,7 @@ function BaseValidateCodeForm({account = {}, contactMethod, hasMagicCodeBeenSent
>
<Text style={[StyleUtils.getDisabledLinkStyles(shouldDisableResendValidateCode)]}>{translate('validateCodeForm.magicCodeNotReceived')}</Text>
</PressableWithFeedback>
{hasMagicCodeBeenSent && (
{hasMagicCodeBeenSent && isInitialCodeSent.current && (
<DotIndicatorMessage
type="success"
style={[styles.mt6, styles.flex0]}
Expand Down
Loading