From 454a9069e5988597bb06c3742a6227968e7d327b Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Tue, 28 May 2019 17:47:15 +0100 Subject: [PATCH 1/3] set the default account when restoring sync --- app/src/page/firstRun/index.js | 2 ++ app/src/page/firstRun/view.js | 3 ++- app/src/page/verification/index.js | 2 ++ app/src/page/verification/internal/sync-verify-page.js | 3 ++- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/src/page/firstRun/index.js b/app/src/page/firstRun/index.js index 924ab56d..3c9cad84 100644 --- a/app/src/page/firstRun/index.js +++ b/app/src/page/firstRun/index.js @@ -4,6 +4,7 @@ import { doAuthenticate, doCheckSync, doGetSync, + doSetDefaultAccount, doSyncApply, doUserEmailNew, doUserResendVerificationEmail, @@ -45,6 +46,7 @@ const perform = dispatch => ({ syncApply: (hash, data, password) => dispatch(doSyncApply(hash, data, password)), getSync: password => dispatch(doGetSync(password)), checkSync: () => dispatch(doCheckSync()), + setDefaultAccount: () => dispatch(doSetDefaultAccount()), notify: data => dispatch(doToast(data)), resendVerificationEmail: email => dispatch(doUserResendVerificationEmail(email)) }); diff --git a/app/src/page/firstRun/view.js b/app/src/page/firstRun/view.js index b5a0e62f..58313f34 100644 --- a/app/src/page/firstRun/view.js +++ b/app/src/page/firstRun/view.js @@ -67,7 +67,7 @@ class FirstRunScreen extends React.PureComponent { componentWillReceiveProps(nextProps) { const { emailNewErrorMessage, emailNewPending, syncApplyErrorMessage, syncApplyIsPending, user } = nextProps; - const { notify, isApplyingSync, setClientSetting } = this.props; + const { notify, isApplyingSync, setClientSetting, setDefaultAccount } = this.props; if (this.state.emailSubmitted && !emailNewPending) { this.setState({ emailSubmitted: false }); @@ -89,6 +89,7 @@ class FirstRunScreen extends React.PureComponent { if (NativeModules.UtilityModule) { NativeModules.UtilityModule.setSecureValue(Constants.KEY_FIRST_RUN_PASSWORD, this.state.walletPassword); } + setDefaultAccount(); setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true); this.closeFinalPage(); } diff --git a/app/src/page/verification/index.js b/app/src/page/verification/index.js index ac82aceb..9795f649 100644 --- a/app/src/page/verification/index.js +++ b/app/src/page/verification/index.js @@ -3,6 +3,7 @@ import { doToast } from 'lbry-redux'; import { doCheckSync, doGetSync, + doSetDefaultAccount, doSyncApply, doUserEmailNew, doUserEmailToVerify, @@ -59,6 +60,7 @@ const perform = dispatch => ({ verifyPhone: (verificationCode) => dispatch(doUserPhoneVerify(verificationCode)), notify: data => dispatch(doToast(data)), setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)), + setDefaultAccount: () => dispatch(doSetDefaultAccount()), setEmailToVerify: email => dispatch(doUserEmailToVerify(email)), syncApply: (hash, data, password) => dispatch(doSyncApply(hash, data, password)), resendVerificationEmail: email => dispatch(doUserResendVerificationEmail(email)), diff --git a/app/src/page/verification/internal/sync-verify-page.js b/app/src/page/verification/internal/sync-verify-page.js index db2fb0c2..1de5de1c 100644 --- a/app/src/page/verification/internal/sync-verify-page.js +++ b/app/src/page/verification/internal/sync-verify-page.js @@ -68,7 +68,7 @@ class SyncVerifyPage extends React.PureComponent { componentWillReceiveProps(nextProps) { const { getSyncIsPending, syncApplyIsPending, syncApplyErrorMessage } = nextProps; - const { getSync, setClientSetting, navigation, notify, hasSyncedWallet } = this.props; + const { getSync, hasSyncedWallet, navigation, notify, setClientSetting, setDefaultAccount } = this.props; if (this.state.checkSyncStarted && !getSyncIsPending) { this.setState({ syncChecked: true }); } @@ -82,6 +82,7 @@ class SyncVerifyPage extends React.PureComponent { if (NativeModules.UtilityModule) { NativeModules.UtilityModule.setSecureValue(Constants.KEY_FIRST_RUN_PASSWORD, this.state.password); } + setDefaultAccount(); setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true); navigation.goBack(); } -- 2.45.2 From 51db5ba692d730b9a03246d9ed88fd662ee90e8e Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Tue, 28 May 2019 18:31:24 +0100 Subject: [PATCH 2/3] fix error in sync verify page during enroll --- app/src/page/verification/view.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/src/page/verification/view.js b/app/src/page/verification/view.js index 96300f92..b74a4990 100644 --- a/app/src/page/verification/view.js +++ b/app/src/page/verification/view.js @@ -104,6 +104,7 @@ class VerificationScreen extends React.PureComponent { notify, addUserPhone, getSyncIsPending, + setDefaultAccount, hasSyncedWallet, setSyncIsPending, syncApplyIsPending, @@ -164,6 +165,7 @@ class VerificationScreen extends React.PureComponent { notify={notify} setEmailVerificationPhase={this.setEmailVerificationPhase} setClientSetting={setClientSetting} + setDefaultAccount={setDefaultAccount} setSyncIsPending={setSyncIsPending} syncApplyIsPending={syncApplyIsPending} syncApplyErrorMessage={syncApplyErrorMessage} -- 2.45.2 From 872b0605159018afade4975e871d4319a852c44c Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Tue, 28 May 2019 19:05:14 +0100 Subject: [PATCH 3/3] fix enroll sync flow --- app/src/page/verification/view.js | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/app/src/page/verification/view.js b/app/src/page/verification/view.js index b74a4990..89fe42ae 100644 --- a/app/src/page/verification/view.js +++ b/app/src/page/verification/view.js @@ -60,6 +60,10 @@ class VerificationScreen extends React.PureComponent { if (this.state.isEmailVerified && !deviceWalletSynced) { this.setState({ currentPage: 'syncVerify' }); } + + if (this.state.isEmailVerified && syncFlow && deviceWalletSynced) { + navigation.goBack(); + } } else { if (this.state.isEmailVerified && !this.state.isIdentityVerified && !this.state.isRewardApproved) { this.setState({ currentPage: 'phoneVerify' }); @@ -67,17 +71,11 @@ class VerificationScreen extends React.PureComponent { if (this.state.isEmailVerified && this.state.isIdentityVerified && !this.state.isRewardApproved) { this.setState({ currentPage: 'manualVerify' }); } - } - - if (this.state.isEmailVerified && syncFlow && deviceWalletSynced) { - navigation.goBack(); - return; - } - - if (this.state.isEmailVerified && this.state.isRewardApproved) { - // verification steps already completed - // simply navigate back to the rewards page - navigation.goBack(); + if (this.state.isEmailVerified && this.state.isRewardApproved) { + // verification steps already completed + // simply navigate back to the rewards page + navigation.goBack(); + } } }); } -- 2.45.2