From 50cab8722f2d33433b2b99054af0d626cc665639 Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Fri, 11 Oct 2019 14:03:14 +0100 Subject: [PATCH] retrieve FCM token --- src/page/splash/view.js | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/src/page/splash/view.js b/src/page/splash/view.js index 2a2a5c6..458e216 100644 --- a/src/page/splash/view.js +++ b/src/page/splash/view.js @@ -137,24 +137,28 @@ class SplashScreen extends React.PureComponent { filteredOutpointsSubscribe(); checkSubscriptionsInit(); - // get user settings interval - this.getUserSettings(); - setInterval(() => this.getUserSettings(), SETTINGS_GET_INTERVAL); + NativeModules.Firebase.getMessagingToken().then(fcmToken => { + console.log('fcmtoken=' + fcmToken); - if (user && user.id && user.has_verified_email) { - // user already authenticated - NativeModules.UtilityModule.getSecureValue(Constants.KEY_FIRST_RUN_PASSWORD).then(walletPassword => { - if (walletPassword) { - getSync(walletPassword); - } - this.navigateToMain(); - }); - } else { - NativeModules.VersionInfo.getAppVersion().then(appVersion => { - this.setState({ shouldAuthenticate: true }); - authenticate(appVersion, Platform.OS); - }); - } + // get user settings interval + this.getUserSettings(); + setInterval(() => this.getUserSettings(), SETTINGS_GET_INTERVAL); + + if (user && user.id && user.has_verified_email) { + // user already authenticated + NativeModules.UtilityModule.getSecureValue(Constants.KEY_FIRST_RUN_PASSWORD).then(walletPassword => { + if (walletPassword) { + getSync(walletPassword); + } + this.navigateToMain(); + }); + } else { + NativeModules.VersionInfo.getAppVersion().then(appVersion => { + this.setState({ shouldAuthenticate: true }); + authenticate(appVersion, Platform.OS); + }); + } + }); }); };