From 9ec5ac5d60626f161f2af799cb6ac272647f9634 Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Thu, 17 Oct 2019 18:19:45 +0100 Subject: [PATCH] remove getSync wait before navigation to main --- src/page/splash/view.js | 46 ++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/src/page/splash/view.js b/src/page/splash/view.js index ac5a58c..dee3f8b 100644 --- a/src/page/splash/view.js +++ b/src/page/splash/view.js @@ -91,10 +91,8 @@ class SplashScreen extends React.PureComponent { // user is authenticated, navigate to the main view if (user.has_verified_email) { NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(walletPassword => { - getSync(walletPassword, () => { - this.getUserSettings(); - this.navigateToMain(); - }); + getSync(walletPassword, () => this.getUserSettings()); + this.navigateToMain(); }); return; } @@ -130,30 +128,30 @@ class SplashScreen extends React.PureComponent { user, } = this.props; - Lbry.resolve({ urls: 'lbry://one' }).then(() => { - // Leave the splash screen - balanceSubscribe(); - blacklistedOutpointsSubscribe(); - filteredOutpointsSubscribe(); - checkSubscriptionsInit(); + Lbry.resolve({ urls: 'lbry://one' }) + .then(() => { + // Leave the splash screen + balanceSubscribe(); + blacklistedOutpointsSubscribe(); + filteredOutpointsSubscribe(); + checkSubscriptionsInit(); - if (user && user.id && user.has_verified_email) { - // user already authenticated - NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(walletPassword => { - getSync(walletPassword, err => { - this.getUserSettings(); + if (user && user.id && user.has_verified_email) { + // user already authenticated + NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(walletPassword => { + getSync(walletPassword, () => this.getUserSettings()); this.navigateToMain(); }); - }); - } else { - NativeModules.VersionInfo.getAppVersion().then(appVersion => { - NativeModules.Firebase.getMessagingToken().then(firebaseToken => { - this.setState({ shouldAuthenticate: true }); - authenticate(appVersion, Platform.OS, firebaseToken); + } else { + NativeModules.VersionInfo.getAppVersion().then(appVersion => { + NativeModules.Firebase.getMessagingToken().then(firebaseToken => { + this.setState({ shouldAuthenticate: true }); + authenticate(appVersion, Platform.OS, firebaseToken); + }); }); - }); - } - }); + } + }) + .catch(err => console.log(err)); }; handleAccountUnlockFailed() {