Skip to content

Commit b24f15b

Browse files
authored
fix: adds backup button click handler and navigates to backup flow (#20832)
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** This PR adds backup button click handler on the new account details screen. <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: Added a backup button click handler on new account details screen ## **Related issues** Fixes: Jira ticket: https://consensyssoftware.atlassian.net/browse/MUL-877 ## **Manual testing steps** ```gherkin Feature: Backup SRP Scenario: user goes to manual backup SRP screen Given user onboarded without backup SRP When user navigates to account details and clicks "Backup" text on the SRP burron Then user is navigated to backup srp flow (first screen asks for password) ``` ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> https://github.com/user-attachments/assets/deb0e131-a7af-4a75-9876-0b85e86fb7df ### **After** https://github.com/user-attachments/assets/b6ab9788-38ad-4caa-b7b3-0440ade7fe61 <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [x] I’ve followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Make the SRP backup label clickable to launch the manual backup flow and add a test to verify navigation. > > - **UI/Navigation** > - In `SecretRecoveryPhrase.tsx`, wrap backup label in a `TouchableOpacity` with `handleBackupPressed` to navigate to `Routes.SET_PASSWORD_FLOW.MANUAL_BACKUP_STEP_1` with `{ backupFlow: true }`. > - Preserve existing SRP reveal navigation via `onExportMnemonic`. > - **Tests** > - In `SecretRecoveryPhrase.test.tsx`, add test asserting backup label press navigates to `SetPasswordFlow` → `ManualBackupStep1` with `{ backupFlow: true }`. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 62d2290. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent 7c18fb0 commit b24f15b

File tree

2 files changed

+32
-6
lines changed

2 files changed

+32
-6
lines changed

app/components/Views/MultichainAccounts/AccountGroupDetails/components/SecretRecoveryPhrase.test.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,21 @@ describe('SecretRecoveryPhrase', () => {
8383
keyringId: 'mock-entropy-source',
8484
});
8585
});
86+
87+
it('navigates to manual backup flow when backup button is pressed', () => {
88+
const { getByText } = renderWithProvider(
89+
<SecretRecoveryPhrase account={mockAccount} />,
90+
{ state: mockInitialState },
91+
);
92+
93+
const backupButton = getByText(
94+
strings('multichain_accounts.export_credentials.backup'),
95+
);
96+
fireEvent.press(backupButton);
97+
98+
expect(mockNavigate).toHaveBeenCalledWith('SetPasswordFlow', {
99+
screen: 'ManualBackupStep1',
100+
params: { backupFlow: true },
101+
});
102+
});
86103
});

app/components/Views/MultichainAccounts/AccountGroupDetails/components/SecretRecoveryPhrase.tsx

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@ export const SecretRecoveryPhrase = ({
5858
}
5959
}, [navigation, account?.options.entropySource]);
6060

61+
const handleBackupPressed = useCallback(() => {
62+
navigation.navigate(Routes.SET_PASSWORD_FLOW.ROOT, {
63+
screen: Routes.SET_PASSWORD_FLOW.MANUAL_BACKUP_STEP_1,
64+
params: { backupFlow: true },
65+
});
66+
}, [navigation]);
67+
6168
return (
6269
<TouchableOpacity
6370
style={styles.secretRecoveryPhrase}
@@ -73,12 +80,14 @@ export const SecretRecoveryPhrase = ({
7380
gap={8}
7481
>
7582
{showSeedphraseBackReminder && (
76-
<Text
77-
variant={TextVariant.BodyMDMedium}
78-
color={TextColor.Alternative}
79-
>
80-
{strings('multichain_accounts.export_credentials.backup')}
81-
</Text>
83+
<TouchableOpacity onPress={handleBackupPressed}>
84+
<Text
85+
variant={TextVariant.BodyMDMedium}
86+
color={TextColor.Alternative}
87+
>
88+
{strings('multichain_accounts.export_credentials.backup')}
89+
</Text>
90+
</TouchableOpacity>
8291
)}
8392
<Icon
8493
name={IconName.ArrowRight}

0 commit comments

Comments
 (0)