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": { "lbry-redux": {
"version": "github:lbryio/lbry-redux#4c4f926ee2cd77d750df0a95fad669257aa31ae7", "version": "github:lbryio/lbry-redux#98723e0c3cc48340d5a1c7100700fcae69298a2e",
"from": "github:lbryio/lbry-redux#4c4f926ee2cd77d750df0a95fad669257aa31ae7", "from": "github:lbryio/lbry-redux#98723e0c3cc48340d5a1c7100700fcae69298a2e",
"requires": { "requires": {
"proxy-polyfill": "0.1.6", "proxy-polyfill": "0.1.6",
"reselect": "^3.0.0", "reselect": "^3.0.0",

View file

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

View file

@ -91,10 +91,10 @@ class FirstRunScreen extends React.PureComponent {
); );
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true); setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
Lbry.status().then(status => { Lbry.wallet_status().then(status => {
// unlock the wallet // unlock the wallet
if (status.wallet.is_locked) { if (status.is_locked) {
Lbry.account_unlock({ password: this.state.walletPassword ? this.state.walletPassword : '' }) Lbry.wallet_unlock({ password: this.state.walletPassword ? this.state.walletPassword : '' })
.then(() => this.closeFinalPage()) .then(() => this.closeFinalPage())
.catch(err => .catch(err =>
notify({ message: 'The wallet could not be unlocked at this time. Please restart the app.' }) 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) { if (NativeModules.UtilityModule) {
const newPassword = this.state.walletPassword ? this.state.walletPassword : ''; const newPassword = this.state.walletPassword ? this.state.walletPassword : '';
NativeModules.UtilityModule.setSecureValue(Constants.KEY_WALLET_PASSWORD, newPassword); 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 // fresh account, new password set
getSync(newPassword); getSync(newPassword);
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true); setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);

View file

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

View file

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