sdk calls: account_* -> wallet_*

This commit is contained in:
Akinwale Ariwodola 2019-10-15 23:13:41 +01:00
parent d18ac68e2c
commit eb12a361b7
5 changed files with 37 additions and 35 deletions

4
package-lock.json generated
View file

@ -5640,8 +5640,8 @@
}
},
"lbry-redux": {
"version": "github:lbryio/lbry-redux#4c4f926ee2cd77d750df0a95fad669257aa31ae7",
"from": "github:lbryio/lbry-redux#4c4f926ee2cd77d750df0a95fad669257aa31ae7",
"version": "github:lbryio/lbry-redux#98723e0c3cc48340d5a1c7100700fcae69298a2e",
"from": "github:lbryio/lbry-redux#98723e0c3cc48340d5a1c7100700fcae69298a2e",
"requires": {
"proxy-polyfill": "0.1.6",
"reselect": "^3.0.0",

View file

@ -12,7 +12,7 @@
"base-64": "^0.1.0",
"@expo/vector-icons": "^8.1.0",
"gfycat-style-urls": "^1.0.3",
"lbry-redux": "lbryio/lbry-redux#4c4f926ee2cd77d750df0a95fad669257aa31ae7",
"lbry-redux": "lbryio/lbry-redux#98723e0c3cc48340d5a1c7100700fcae69298a2e",
"lbryinc": "lbryio/lbryinc#aebad10a9c5d725c3fedae4236d56f239a0bc1de",
"lodash": ">=4.17.11",
"merge": ">=1.2.1",

View file

@ -91,10 +91,10 @@ class FirstRunScreen extends React.PureComponent {
);
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
Lbry.status().then(status => {
Lbry.wallet_status().then(status => {
// unlock the wallet
if (status.wallet.is_locked) {
Lbry.account_unlock({ password: this.state.walletPassword ? this.state.walletPassword : '' })
if (status.is_locked) {
Lbry.wallet_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.' })
@ -296,7 +296,7 @@ class FirstRunScreen extends React.PureComponent {
if (NativeModules.UtilityModule) {
const newPassword = this.state.walletPassword ? this.state.walletPassword : '';
NativeModules.UtilityModule.setSecureValue(Constants.KEY_WALLET_PASSWORD, newPassword);
Lbry.account_encrypt({ new_password: newPassword }).then(() => {
Lbry.wallet_encrypt({ new_password: newPassword }).then(() => {
// fresh account, new password set
getSync(newPassword);
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);

View file

@ -178,31 +178,33 @@ class SplashScreen extends React.PureComponent {
isRunning: true,
});
// For now, automatically unlock the wallet if a password is set so that downloads work
NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(password => {
if (walletStatus.is_locked) {
this.setState({
message: 'Unlocking account',
details: 'Decrypting wallet',
});
Lbry.wallet_status().then(secureWalletStatus => {
// For now, automatically unlock the wallet if a password is set so that downloads work
NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(password => {
if (secureWalletStatus.is_locked) {
this.setState({
message: 'Unlocking account',
details: 'Decrypting wallet',
});
// unlock the wallet and then finish the splash screen
Lbry.account_unlock({ password: password || '' })
.then(() => {
this.setState({
message: testingNetwork,
details: waitingForResolution,
});
this.finishSplashScreen();
})
.catch(() => this.handleAccountUnlockFailed());
} else {
this.setState({
message: testingNetwork,
details: waitingForResolution,
});
this.finishSplashScreen();
}
// unlock the wallet and then finish the splash screen
Lbry.wallet_unlock({ password: password || '' })
.then(() => {
this.setState({
message: testingNetwork,
details: waitingForResolution,
});
this.finishSplashScreen();
})
.catch(() => this.handleAccountUnlockFailed());
} else {
this.setState({
message: testingNetwork,
details: waitingForResolution,
});
this.finishSplashScreen();
}
});
});
return;

View file

@ -37,7 +37,7 @@ class SyncVerifyPage extends React.PureComponent {
if (!hasSyncedWallet) {
// fresh account with no sync
const newPassword = this.state.password ? this.state.password : '';
Lbry.account_encrypt({ new_password: newPassword }).then(() => {
Lbry.wallet_encrypt({ new_password: newPassword }).then(() => {
getSync(newPassword);
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
navigation.goBack();
@ -79,9 +79,9 @@ class SyncVerifyPage extends React.PureComponent {
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
// unlock the wallet (if locked)
Lbry.status().then(status => {
if (status.wallet.is_locked) {
Lbry.account_unlock({ password: this.state.password ? this.state.password : '' })
Lbry.wallet_status().then(status => {
if (status.is_locked) {
Lbry.wallet_unlock({ password: this.state.password ? this.state.password : '' })
.then(() => navigation.goBack())
.catch(err => {
if (notifyUnlockFailed) {