From 372a572ee644be5aafb983e665f02f956487dc78 Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Fri, 6 Dec 2019 16:53:55 +0100 Subject: [PATCH] fix error for auto-login and remove password warning --- src/page/firstRun/internal/wallet-page.js | 9 --------- src/page/firstRun/view.js | 14 +++++++++++--- src/page/splash/view.js | 3 +-- .../verification/internal/sync-verify-page.js | 17 +++++------------ 4 files changed, 17 insertions(+), 26 deletions(-) diff --git a/src/page/firstRun/internal/wallet-page.js b/src/page/firstRun/internal/wallet-page.js index ed83d89..699bc38 100644 --- a/src/page/firstRun/internal/wallet-page.js +++ b/src/page/firstRun/internal/wallet-page.js @@ -146,15 +146,6 @@ class WalletPage extends React.PureComponent { - {(!this.state.password || this.state.password.trim().length === 0) && ( - - - {hasSyncedWallet - ? __('If you did not provide a password, please press Use LBRY to continue.') - : __('You can proceed without a password, but this is not recommended.')} - - - )} {(!hasSyncedWallet && this.state.password && this.state.password.trim().length) > 0 && ( diff --git a/src/page/firstRun/view.js b/src/page/firstRun/view.js index d29f05e..1fda3ac 100644 --- a/src/page/firstRun/view.js +++ b/src/page/firstRun/view.js @@ -28,6 +28,7 @@ class FirstRunScreen extends React.PureComponent { emailCollectTracked: false, emailSubmitted: false, enterPasswordTracked: false, + autoLoginTried: false, isFirstRun: false, launchUrl: null, languageLoaded: false, @@ -38,7 +39,6 @@ class FirstRunScreen extends React.PureComponent { walletPassword: '', syncApplyStarted: false, syncApplyCompleted: false, - language: null, }; componentDidMount() { @@ -126,8 +126,16 @@ class FirstRunScreen extends React.PureComponent { if (this.state.syncApplyStarted && !syncApplyIsPending) { if (syncApplyErrorMessage && syncApplyErrorMessage.trim().length > 0) { - notify({ message: __(syncApplyErrorMessage), isError: true }); - this.setState({ showBottomContainer: true, syncApplyStarted: false, syncApplyCompleted: false }); + if (this.state.autoLoginTried) { + // don't show the error message for auto-login if it fails + notify({ message: __(syncApplyErrorMessage), isError: true }); + } + this.setState({ + autoLoginTried: true, + showBottomContainer: true, + syncApplyStarted: false, + syncApplyCompleted: false, + }); } else { this.setState({ syncApplyCompleted: true }); // password successfully verified diff --git a/src/page/splash/view.js b/src/page/splash/view.js index 1808247..b70d38c 100644 --- a/src/page/splash/view.js +++ b/src/page/splash/view.js @@ -170,7 +170,6 @@ class SplashScreen extends React.PureComponent { } _updateStatusCallback(status) { - console.log(status); const { fetchSubscriptions, getSync, setClientSetting } = this.props; const startupStatus = status.startup_status; const walletStatus = status.wallet; @@ -222,7 +221,7 @@ class SplashScreen extends React.PureComponent { return; } - const headerSyncProgress = walletStatus.headers_synchronization_progress; + const headerSyncProgress = walletStatus ? walletStatus.headers_synchronization_progress : null; if (headerSyncProgress && headerSyncProgress < 100) { this.setState({ isDownloadingHeaders: true, diff --git a/src/page/verification/internal/sync-verify-page.js b/src/page/verification/internal/sync-verify-page.js index 5fc4364..da92430 100644 --- a/src/page/verification/internal/sync-verify-page.js +++ b/src/page/verification/internal/sync-verify-page.js @@ -21,6 +21,7 @@ class SyncVerifyPage extends React.PureComponent { revealPassword: false, autoPassword: false, autoLoginAttempted: false, + autoLoginTried: false, autoLoginFlow: true, }; @@ -67,8 +68,10 @@ class SyncVerifyPage extends React.PureComponent { if (this.state.syncApplyStarted && !syncApplyIsPending) { if (syncApplyErrorMessage && syncApplyErrorMessage.trim().length > 0) { - notify({ message: __(syncApplyErrorMessage), isError: true }); - this.setState({ syncApplyStarted: false, autoLoginFlow: false }); + if (this.state.autoLoginTried) { + notify({ message: __(syncApplyErrorMessage), isError: true }); + } + this.setState({ autoLoginTried: true, syncApplyStarted: false, autoLoginFlow: false }); } else { // password successfully verified this.setState({ syncApplyCompleted: true }); @@ -194,16 +197,6 @@ class SyncVerifyPage extends React.PureComponent { - {(!this.state.password || this.state.password.trim().length === 0) && ( - - - {hasSyncedWallet - ? __('If you did not provide a password, please press Use LBRY to continue.') - : __('You can proceed without a password, but this is not recommended.')} - - - )} - {(!hasSyncedWallet && this.state.password && this.state.password.trim().length) > 0 && (