From eb12a361b7ae847b8f965f2e1a00df0cc92c19ea Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Tue, 15 Oct 2019 23:13:41 +0100 Subject: [PATCH] sdk calls: account_* -> wallet_* --- package-lock.json | 4 +- package.json | 2 +- src/page/firstRun/view.js | 8 +-- src/page/splash/view.js | 50 ++++++++++--------- .../verification/internal/sync-verify-page.js | 8 +-- 5 files changed, 37 insertions(+), 35 deletions(-) diff --git a/package-lock.json b/package-lock.json index f5b08db..5acec84 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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", diff --git a/package.json b/package.json index 74f8ff3..cea8d96 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/page/firstRun/view.js b/src/page/firstRun/view.js index 5c6d25e..edeadcf 100644 --- a/src/page/firstRun/view.js +++ b/src/page/firstRun/view.js @@ -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); diff --git a/src/page/splash/view.js b/src/page/splash/view.js index d467753..36f84ed 100644 --- a/src/page/splash/view.js +++ b/src/page/splash/view.js @@ -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; diff --git a/src/page/verification/internal/sync-verify-page.js b/src/page/verification/internal/sync-verify-page.js index 41e0104..e75f282 100644 --- a/src/page/verification/internal/sync-verify-page.js +++ b/src/page/verification/internal/sync-verify-page.js @@ -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) {