unlock after sync apply
This commit is contained in:
parent
ced1056596
commit
894b34fd57
4 changed files with 39 additions and 19 deletions
|
@ -46,7 +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()),
|
||||
setDefaultAccount: (success, failure) => dispatch(doSetDefaultAccount(success, failure)),
|
||||
notify: data => dispatch(doToast(data)),
|
||||
resendVerificationEmail: email => dispatch(doUserResendVerificationEmail(email)),
|
||||
});
|
||||
|
|
|
@ -86,16 +86,25 @@ class FirstRunScreen extends React.PureComponent {
|
|||
this.setState({ showBottomContainer: true });
|
||||
} else {
|
||||
// password successfully verified
|
||||
if (NativeModules.UtilityModule) {
|
||||
NativeModules.UtilityModule.setSecureValue(Constants.KEY_FIRST_RUN_PASSWORD, this.state.walletPassword);
|
||||
}
|
||||
setDefaultAccount();
|
||||
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
|
||||
NativeModules.UtilityModule.setSecureValue(Constants.KEY_FIRST_RUN_PASSWORD, this.state.walletPassword);
|
||||
setDefaultAccount(
|
||||
() => {
|
||||
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
|
||||
|
||||
// unlock the wallet
|
||||
Lbry.account_unlock({ password: this.state.walletPassword || '' })
|
||||
.then(() => this.closeFinalPage())
|
||||
.catch(err => notify({ message: 'The wallet could not be unlocked at this time. Please restart the app.' }));
|
||||
// unlock the wallet
|
||||
Lbry.account_unlock({ password: this.state.walletPassword ? this.state.walletPassword : '' })
|
||||
.then(() => this.closeFinalPage())
|
||||
.catch(err =>
|
||||
notify({ message: 'The wallet could not be unlocked at this time. Please restart the app.' })
|
||||
);
|
||||
},
|
||||
err => {
|
||||
notify({
|
||||
message:
|
||||
'The account restore operation could not be completed successfully. Please restart the app and try again.',
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ import {
|
|||
} from 'lbryinc';
|
||||
import { doSetClientSetting } from 'redux/actions/settings';
|
||||
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||
import Constants from 'constants';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
import Verification from './view';
|
||||
|
||||
const select = state => ({
|
||||
|
@ -54,13 +54,13 @@ const select = state => ({
|
|||
|
||||
const perform = dispatch => ({
|
||||
addUserEmail: email => dispatch(doUserEmailNew(email)),
|
||||
addUserPhone: (phone, country_code) => dispatch(doUserPhoneNew(phone, country_code)),
|
||||
addUserPhone: (phone, countryCode) => dispatch(doUserPhoneNew(phone, countryCode)),
|
||||
getSync: password => dispatch(doGetSync(password)),
|
||||
checkSync: () => dispatch(doCheckSync()),
|
||||
verifyPhone: verificationCode => dispatch(doUserPhoneVerify(verificationCode)),
|
||||
notify: data => dispatch(doToast(data)),
|
||||
setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)),
|
||||
setDefaultAccount: () => dispatch(doSetDefaultAccount()),
|
||||
setDefaultAccount: (success, failure) => dispatch(doSetDefaultAccount(success, failure)),
|
||||
setEmailToVerify: email => dispatch(doUserEmailToVerify(email)),
|
||||
syncApply: (hash, data, password) => dispatch(doSyncApply(hash, data, password)),
|
||||
resendVerificationEmail: email => dispatch(doUserResendVerificationEmail(email)),
|
||||
|
|
|
@ -67,13 +67,24 @@ class SyncVerifyPage extends React.PureComponent {
|
|||
this.state.password ? this.state.password : ''
|
||||
);
|
||||
}
|
||||
setDefaultAccount();
|
||||
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
|
||||
setDefaultAccount(
|
||||
() => {
|
||||
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
|
||||
|
||||
// unlock the wallet
|
||||
Lbry.account_unlock({ password: this.state.password ? this.state.password : '' })
|
||||
.then(() => navigation.goBack())
|
||||
.catch(err => notify({ message: 'The wallet could not be unlocked at this time. Please restart the app.' }));
|
||||
// unlock the wallet
|
||||
Lbry.account_unlock({ password: this.state.password ? this.state.password : '' })
|
||||
.then(() => navigation.goBack())
|
||||
.catch(err =>
|
||||
notify({ message: 'The wallet could not be unlocked at this time. Please restart the app.' })
|
||||
);
|
||||
},
|
||||
err => {
|
||||
notify({
|
||||
message:
|
||||
'The account restore operation could not be completed successfully. Please restart the app and try again.',
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue