From 9aabad56a22f876f1e0269c5a0e72213f56d0961 Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Wed, 25 Sep 2019 16:37:16 +0100 Subject: [PATCH] eliminate final blank password headache --- src/page/firstRun/view.js | 5 ++++- src/page/splash/view.js | 10 +++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/page/firstRun/view.js b/src/page/firstRun/view.js index b2995f4..82065d6 100644 --- a/src/page/firstRun/view.js +++ b/src/page/firstRun/view.js @@ -86,7 +86,10 @@ class FirstRunScreen extends React.PureComponent { this.setState({ showBottomContainer: true }); } else { // password successfully verified - NativeModules.UtilityModule.setSecureValue(Constants.KEY_FIRST_RUN_PASSWORD, this.state.walletPassword); + NativeModules.UtilityModule.setSecureValue( + Constants.KEY_FIRST_RUN_PASSWORD, + this.state.walletPassword ? this.state.walletPassword : '' + ); setDefaultAccount( () => { setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true); diff --git a/src/page/splash/view.js b/src/page/splash/view.js index 0355a83..2a2a5c6 100644 --- a/src/page/splash/view.js +++ b/src/page/splash/view.js @@ -98,7 +98,7 @@ class SplashScreen extends React.PureComponent { // user is authenticated, navigate to the main view if (user.has_verified_email) { NativeModules.UtilityModule.getSecureValue(Constants.KEY_FIRST_RUN_PASSWORD).then(walletPassword => { - if (walletPassword && walletPassword.trim().length > 0) { + if (walletPassword) { getSync(walletPassword); } this.navigateToMain(); @@ -164,7 +164,10 @@ class SplashScreen extends React.PureComponent { _updateStatusCallback(status) { const { fetchSubscriptions, getSync, setClientSetting } = this.props; + const blockchainHeaders = status.blockchain_headers; const startupStatus = status.startup_status; + const walletStatus = status.wallet; + // At the minimum, wallet should be started and blocks_behind equal to 0 before calling resolve const hasStarted = startupStatus.stream_manager && startupStatus.wallet && status.wallet.blocks_behind <= 0; if (hasStarted) { @@ -180,7 +183,7 @@ class SplashScreen extends React.PureComponent { // For now, automatically unlock the wallet if a password is set so that downloads work NativeModules.UtilityModule.getSecureValue(Constants.KEY_FIRST_RUN_PASSWORD).then(password => { - if (password) { + if (walletStatus.is_locked) { this.setState({ message: 'Unlocking account', details: 'Decrypting wallet', @@ -208,9 +211,6 @@ class SplashScreen extends React.PureComponent { return; } - const blockchainHeaders = status.blockchain_headers; - const walletStatus = status.wallet; - if (blockchainHeaders) { this.setState({ isDownloadingHeaders: blockchainHeaders.downloading_headers,