Skip to content

Commit

Permalink
Make error alert to show and refocus on input (#974)
Browse files Browse the repository at this point in the history
* make error alert to show and refocus on input

* revert state when import fails

* clean up
  • Loading branch information
brunobar79 committed Aug 1, 2020
1 parent d751b5e commit ef6fe4b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/model/wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,14 @@ export const createWallet = async (
alreadyExistingWallet &&
(type === WalletTypes.readOnly || isPrivateKeyOverwritingSeedMnemonic)
) {
Alert.alert('Oops!', 'Looks like you already imported this wallet!');
setTimeout(
() =>
Alert.alert(
'Oops!',
'Looks like you already imported this wallet!'
),
1
);
logger.sentry('[createWallet] - already imported this wallet');
return null;
}
Expand Down
10 changes: 10 additions & 0 deletions src/screens/ImportSeedPhraseSheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,11 +260,21 @@ export default function ImportSeedPhraseSheet() {
analytics.track('Imported seed phrase', {
hadPreviousAddressWithValue,
});
} else {
// Wait for error messages then refocus
setTimeout(() => {
inputRef.current?.focus();
initializeWallet();
}, 100);
}
})
.catch(error => {
handleSetImporting(false);
logger.error('error importing seed phrase: ', error);
setTimeout(() => {
inputRef.current?.focus();
initializeWallet();
}, 100);
});
}, 50);
}
Expand Down

0 comments on commit ef6fe4b

Please sign in to comment.