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,
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),

View file

@ -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));
});
});
}
// });