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

Prevent backup prompt from firing on import #6364

Merged
merged 3 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 4 additions & 6 deletions src/handlers/walletReadyEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ const delay = (ms: number) =>
});

const promptForBackupOnceReadyOrNotAvailable = async (): Promise<boolean> => {
const { status } = backupsStore.getState();
if (LoadingStates.includes(status)) {
let { status } = backupsStore.getState();
while (LoadingStates.includes(status)) {
await delay(1000);
return promptForBackupOnceReadyOrNotAvailable();
status = backupsStore.getState().status;
}

logger.debug(`[walletReadyEvents]: BackupSheet: showing backup now sheet for selected wallet`);
Expand All @@ -47,9 +47,7 @@ export const runWalletBackupStatusChecks = async (): Promise<boolean> => {
const { selected } = store.getState().wallets;
if (!selected || IS_TEST) return false;

const selectedWalletNeedsBackedUp =
!selected.backedUp && !selected.damaged && selected.type !== WalletTypes.readOnly && selected.type !== WalletTypes.bluetooth;
if (selectedWalletNeedsBackedUp) {
if (!selected.backedUp && !selected.damaged && selected.type !== WalletTypes.readOnly && selected.type !== WalletTypes.bluetooth) {
logger.debug('[walletReadyEvents]: Selected wallet is not backed up, prompting backup sheet');
return promptForBackupOnceReadyOrNotAvailable();
}
Expand Down
18 changes: 0 additions & 18 deletions src/hooks/useImportingWallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -339,24 +339,6 @@ export default function useImportingWallet({ showImportModal = true } = {}) {
});
}, 1_000);

setTimeout(() => {
// If it's not read only or hardware, show the backup sheet
if (
!(
isENSAddressFormat(input) ||
isUnstoppableAddressFormat(input) ||
isValidAddress(input) ||
isValidBluetoothDeviceId(input)
)
) {
if (!IS_TEST) {
Navigation.handleAction(Routes.BACKUP_SHEET, {
step: WalletBackupStepTypes.backup_prompt,
});
}
}
}, 1000);

analytics.track('Imported seed phrase', {
isWalletEthZero,
});
Expand Down
Loading