From 601c589f6903a1c33b073b7d72fb4618ecf4a0ef Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Mon, 3 Feb 2020 09:20:48 +0100 Subject: [PATCH] fix weird case where splash screen gets stuck on authenticating --- src/page/splash/index.js | 2 ++ src/page/splash/view.js | 13 +++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/page/splash/index.js b/src/page/splash/index.js index 0f632e5..b764d5c 100644 --- a/src/page/splash/index.js +++ b/src/page/splash/index.js @@ -10,6 +10,7 @@ import { doUserEmailToVerify, doUserEmailVerify, doUserEmailVerifyFailure, + selectAuthenticationIsPending, selectUser, selectEmailToVerify, } from 'lbryinc'; @@ -18,6 +19,7 @@ import { selectLastRouteInStack } from 'redux/selectors/drawer'; import SplashScreen from './view'; const select = state => ({ + authIsPending: selectAuthenticationIsPending(state), user: selectUser(state), emailToVerify: selectEmailToVerify(state), lastRouteInStack: selectLastRouteInStack(state), diff --git a/src/page/splash/view.js b/src/page/splash/view.js index 4bf8a59..2f3580a 100644 --- a/src/page/splash/view.js +++ b/src/page/splash/view.js @@ -139,12 +139,13 @@ class SplashScreen extends React.PureComponent { this.navigateToMain(); } else { NativeModules.VersionInfo.getAppVersion().then(appVersion => { - this.setState({ shouldAuthenticate: true }); - NativeModules.Firebase.getMessagingToken() - .then(firebaseToken => { - authenticate(appVersion, Platform.OS, firebaseToken); - }) - .catch(() => authenticate(appVersion, Platform.OS)); + this.setState({ shouldAuthenticate: true }, () => { + NativeModules.Firebase.getMessagingToken() + .then(firebaseToken => { + authenticate(appVersion, Platform.OS, firebaseToken); + }) + .catch(() => authenticate(appVersion, Platform.OS)); + }); }); } // });