Skip to content

Commit 4ee216c

Browse files
author
ignaciosantise
committed
fix: use current email if user goes back to initial update email screen
1 parent e4c1099 commit 4ee216c

File tree

5 files changed

+18
-13
lines changed

5 files changed

+18
-13
lines changed

packages/core/src/controllers/RouterController.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export interface RouterControllerState {
2626
wallet?: WcWallet;
2727
network?: CaipNetwork;
2828
email?: string;
29+
newEmail?: string;
2930
};
3031
}
3132

packages/scaffold/src/partials/w3m-otp-code/index.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ interface Props {
1313
email?: string;
1414
timeLeft?: number;
1515
codeExpiry?: number;
16-
retryDisabledLabel?: string;
1716
retryLabel?: string;
17+
retryDisabledButtonLabel?: string;
18+
retryButtonLabel?: string;
1819
}
1920

2021
export function OtpCodeView({
@@ -26,8 +27,9 @@ export function OtpCodeView({
2627
email,
2728
timeLeft = 0,
2829
codeExpiry = 20,
29-
retryDisabledLabel = 'Resend',
30-
retryLabel = 'Resend code'
30+
retryLabel = "Didn't receive it?",
31+
retryDisabledButtonLabel = 'Resend',
32+
retryButtonLabel = 'Resend code'
3133
}: Props) {
3234
const { keyboardShown, keyboardHeight } = useKeyboard();
3335
const paddingBottom = Platform.select({
@@ -67,10 +69,10 @@ export function OtpCodeView({
6769
{!loading && (
6870
<FlexView alignItems="center" flexDirection="row" margin={['s', '0', '0', '0']}>
6971
<Text variant="small-400" color="fg-200">
70-
Didn't receive it?
72+
{retryLabel}
7173
</Text>
7274
<Link onPress={onRetry} disabled={timeLeft > 0 || loading}>
73-
{timeLeft > 0 ? `${retryDisabledLabel} in ${timeLeft}s` : retryLabel}
75+
{timeLeft > 0 ? `${retryDisabledButtonLabel} in ${timeLeft}s` : retryButtonLabel}
7476
</Link>
7577
</FlexView>
7678
)}

packages/scaffold/src/views/w3m-update-email-primary-otp-view/index.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,13 @@ export function UpdateEmailPrimaryOtpView() {
4444
<OtpCodeView
4545
loading={loading}
4646
error={error}
47-
email={emailProvider?.getEmail()}
47+
email={data?.email}
4848
onSubmit={onOtpSubmit}
4949
onRetry={RouterController.goBack}
5050
codeExpiry={10}
51-
retryDisabledLabel="Try again"
52-
retryLabel="Try again"
51+
retryLabel="Something wrong?"
52+
retryDisabledButtonLabel="Try again"
53+
retryButtonLabel="Try again"
5354
/>
5455
);
5556
}

packages/scaffold/src/views/w3m-update-email-secondary-otp-view/index.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,13 @@ export function UpdateEmailSecondaryOtpView() {
4444
<OtpCodeView
4545
loading={loading}
4646
error={error}
47-
email={data?.email}
47+
email={data?.newEmail}
4848
onSubmit={onOtpSubmit}
4949
onRetry={RouterController.goBack}
5050
codeExpiry={10}
51-
retryDisabledLabel="Try again"
52-
retryLabel="Try again"
51+
retryLabel="Something wrong?"
52+
retryDisabledButtonLabel="Try again"
53+
retryButtonLabel="Try again"
5354
/>
5455
);
5556
}

packages/scaffold/src/views/w3m-update-email-wallet-view/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ export function UpdateEmailWalletView() {
4444
const response = await provider.updateEmail({ email: value });
4545
EventsController.sendEvent({ type: 'track', event: 'EMAIL_EDIT' });
4646
if (response.action === 'VERIFY_SECONDARY_OTP') {
47-
RouterController.push('UpdateEmailSecondaryOtp', { email: value });
47+
RouterController.push('UpdateEmailSecondaryOtp', { email: data?.email, newEmail: value });
4848
} else {
49-
RouterController.push('UpdateEmailPrimaryOtp', { email: value });
49+
RouterController.push('UpdateEmailPrimaryOtp', { email: data?.email, newEmail: value });
5050
}
5151
} catch (e) {
5252
const parsedError = CoreHelperUtil.parseError(e);

0 commit comments

Comments
 (0)