fix weird case where splash screen gets stuck on authenticating

This commit is contained in:
Akinwale Ariwodola 2020-02-03 09:20:48 +01:00
parent f5ae1f34f7
commit 601c589f69
2 changed files with 9 additions and 6 deletions

View file

@ -10,6 +10,7 @@ import {
doUserEmailToVerify, doUserEmailToVerify,
doUserEmailVerify, doUserEmailVerify,
doUserEmailVerifyFailure, doUserEmailVerifyFailure,
selectAuthenticationIsPending,
selectUser, selectUser,
selectEmailToVerify, selectEmailToVerify,
} from 'lbryinc'; } from 'lbryinc';
@ -18,6 +19,7 @@ import { selectLastRouteInStack } from 'redux/selectors/drawer';
import SplashScreen from './view'; import SplashScreen from './view';
const select = state => ({ const select = state => ({
authIsPending: selectAuthenticationIsPending(state),
user: selectUser(state), user: selectUser(state),
emailToVerify: selectEmailToVerify(state), emailToVerify: selectEmailToVerify(state),
lastRouteInStack: selectLastRouteInStack(state), lastRouteInStack: selectLastRouteInStack(state),

View file

@ -139,12 +139,13 @@ class SplashScreen extends React.PureComponent {
this.navigateToMain(); this.navigateToMain();
} else { } else {
NativeModules.VersionInfo.getAppVersion().then(appVersion => { NativeModules.VersionInfo.getAppVersion().then(appVersion => {
this.setState({ shouldAuthenticate: true }); this.setState({ shouldAuthenticate: true }, () => {
NativeModules.Firebase.getMessagingToken() NativeModules.Firebase.getMessagingToken()
.then(firebaseToken => { .then(firebaseToken => {
authenticate(appVersion, Platform.OS, firebaseToken); authenticate(appVersion, Platform.OS, firebaseToken);
}) })
.catch(() => authenticate(appVersion, Platform.OS)); .catch(() => authenticate(appVersion, Platform.OS));
});
}); });
} }
// }); // });