set the default account when restoring sync

This commit is contained in:
Akinwale Ariwodola 2019-05-28 17:47:15 +01:00
parent 67d4e97582
commit 454a9069e5
4 changed files with 8 additions and 2 deletions

View file

@ -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))
});

View file

@ -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();
}

View file

@ -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)),

View file

@ -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();
}