|
@@ -90,6 +90,7 @@ import NotificationsListScreen from 'src/screens/NotificationsScreen/Notificatio
|
|
|
import FriendsNotificationsScreen from 'src/screens/NotificationsScreen/FriendsNotificactionsScreen';
|
|
|
import MessagesNotificationsScreen from 'src/screens/NotificationsScreen/MessagesNotificationsScreen';
|
|
|
import SystemNotificationsScreen from 'src/screens/NotificationsScreen/SystemNotificationsScreen';
|
|
|
+import { Splash } from 'src/components/SplashSpinner';
|
|
|
|
|
|
enableScreens();
|
|
|
|
|
@@ -160,8 +161,9 @@ const Route = () => {
|
|
|
const prepareApp = async () => {
|
|
|
await checkNmToken();
|
|
|
await checkTokenAndUpdate();
|
|
|
- setDbLoaded(true);
|
|
|
+ await openDatabases();
|
|
|
await findFastestServer();
|
|
|
+ setDbLoaded(true);
|
|
|
};
|
|
|
|
|
|
const findFastestServer = async () => {
|
|
@@ -178,16 +180,15 @@ const Route = () => {
|
|
|
|
|
|
useEffect(() => {
|
|
|
const hideSplashScreen = async () => {
|
|
|
- if (fontsLoaded && dbLoaded) {
|
|
|
+ if (fontsLoaded) {
|
|
|
await SplashScreen.hideAsync();
|
|
|
- await openDatabases();
|
|
|
await fetchAndSaveUserInfo();
|
|
|
await setupDatabaseAndSync();
|
|
|
}
|
|
|
};
|
|
|
|
|
|
hideSplashScreen();
|
|
|
- }, [fontsLoaded, dbLoaded]);
|
|
|
+ }, [fontsLoaded]);
|
|
|
|
|
|
const checkTokenAndUpdate = async () => {
|
|
|
const storedToken = storage.get('deviceToken', StoreType.STRING);
|
|
@@ -203,7 +204,7 @@ const Route = () => {
|
|
|
};
|
|
|
|
|
|
if (!fontsLoaded || !dbLoaded) {
|
|
|
- return null;
|
|
|
+ return <Splash />;
|
|
|
}
|
|
|
|
|
|
const screenOptions = ({
|