aboutsummaryrefslogtreecommitdiff
path: root/src/routes
diff options
context:
space:
mode:
Diffstat (limited to 'src/routes')
-rw-r--r--src/routes/Routes.tsx12
-rw-r--r--src/routes/main/MainStackScreen.tsx7
2 files changed, 14 insertions, 5 deletions
diff --git a/src/routes/Routes.tsx b/src/routes/Routes.tsx
index 819ca785..173a6a6c 100644
--- a/src/routes/Routes.tsx
+++ b/src/routes/Routes.tsx
@@ -1,15 +1,17 @@
+import AsyncStorage from '@react-native-community/async-storage';
import messaging from '@react-native-firebase/messaging';
-import React, {useEffect, useState} from 'react';
+import React, {useContext, useEffect, useState} from 'react';
import DeviceInfo from 'react-native-device-info';
import SplashScreen from 'react-native-splash-screen';
-import {useDispatch, useSelector} from 'react-redux';
+import {useDispatch, useSelector, useStore} from 'react-redux';
+import {ChatContext} from '../App';
import {fcmService, getCurrentLiveVersions} from '../services';
import {
updateNewNotificationReceived,
updateNewVersionAvailable,
} from '../store/actions';
import {RootState} from '../store/rootReducer';
-import {userLogin} from '../utils';
+import {userLogin, connectChatAccount} from '../utils';
import Onboarding from './onboarding';
import NavigationBar from './tabs';
@@ -17,6 +19,9 @@ const Routes: React.FC = () => {
const {
user: {userId},
} = useSelector((state: RootState) => state.user);
+ const state: RootState = useStore().getState();
+ const loggedInUserId = state.user.user.userId;
+ const {chatClient} = useContext(ChatContext);
const [newVersionAvailable, setNewVersionAvailable] = useState(false);
const dispatch = useDispatch();
@@ -49,6 +54,7 @@ const Routes: React.FC = () => {
if (userId) {
fcmService.setUpPushNotifications();
fcmService.sendFcmTokenToServer();
+ connectChatAccount(loggedInUserId, chatClient, dispatch);
}
}, []);
diff --git a/src/routes/main/MainStackScreen.tsx b/src/routes/main/MainStackScreen.tsx
index 8068b893..48c57920 100644
--- a/src/routes/main/MainStackScreen.tsx
+++ b/src/routes/main/MainStackScreen.tsx
@@ -34,7 +34,7 @@ import {
} from '../../screens';
import MutualBadgeHolders from '../../screens/suggestedPeople/MutualBadgeHolders';
import {ScreenType} from '../../types';
-import {AvatarHeaderHeight, SCREEN_WIDTH} from '../../utils';
+import {AvatarHeaderHeight, ChatHeaderHeight, SCREEN_WIDTH} from '../../utils';
import {MainStack, MainStackParams} from './MainStackNavigator';
/**
@@ -306,7 +306,10 @@ const MainStackScreen: React.FC<MainStackProps> = ({route}) => {
<MainStack.Screen
name="Chat"
component={ChatScreen}
- options={{headerShown: true}}
+ options={{
+ ...headerBarOptions('black', ''),
+ headerStyle: {height: ChatHeaderHeight},
+ }}
/>
</MainStack.Navigator>
);