TP-80461 | moved firestore updates to tracking component

This commit is contained in:
Aman Chaturvedi
2024-09-11 14:09:53 +05:30
parent 81929a38bc
commit a671437273
3 changed files with 24 additions and 25 deletions

View File

@@ -71,6 +71,7 @@ import { handleCheckAndUpdatePullToRefreshStateForNearbyCases } from '@screens/a
import { initialize } from 'react-native-clarity';
import { updateImageUploadComponent } from '@components/form/services/formComponents';
import { getWifiDetailsSyncUrl } from '@components/utlis/WifiDetails';
import useFirestoreUpdates from '@hooks/useFirestoreUpdates';
export enum FOREGROUND_TASKS {
GEOLOCATION = 'GEOLOCATION',
@@ -453,6 +454,9 @@ const TrackingComponent: React.FC<ITrackingComponent> = ({ children }) => {
useIsLocationEnabled();
// Firestore listener hook
useFirestoreUpdates();
return <>{children}</>;
};

View File

@@ -163,11 +163,13 @@ function AuthRouter() {
return isLoggedIn ? (
<TrackingComponent>
<BlockerScreen>
<ProtectedRouter />
<ModalWrapperForAlfredV2 animationType="slide" visible={showApprovedModal}>
<IdCardApproved />
</ModalWrapperForAlfredV2>
<CallingFeedbackNudgeBottomSheet />
</BlockerScreen>
</TrackingComponent>
) : (
<BlockerScreen>

View File

@@ -8,7 +8,6 @@ import { getNotifications, notificationAction } from '../../action/notificationA
import { SCREEN_ANIMATION_DURATION } from '../../common/Constants';
import { getScreenFocusListenerObj } from '../../components/utlis/commonFunctions';
import { useAppDispatch, useAppSelector } from '../../hooks';
import useFirestoreUpdates from '../../hooks/useFirestoreUpdates';
import useIsOnline from '../../hooks/useIsOnline';
import AllCasesMain from '../allCases';
import interactionsHandler from '../caseDetails/interactionsHandler';
@@ -30,7 +29,6 @@ import getLitmusExperimentResult, {
} from '@services/litmusExperiments.service';
import { GLOBAL } from '@constants/Global';
import { updateImageUploadComponent } from '@components/form/services/formComponents';
import BlockerScreen from '@common/BlockerScreen';
const Stack = createNativeStackNavigator();
@@ -92,9 +90,6 @@ const ProtectedRouter = () => {
// This checks for unsubmitted feedbacks in case of offline and retry submitting them
interactionsHandler();
// Firestore listener hook
useFirestoreUpdates();
const resyncFirebase = useResyncFirebase();
const stopLocationPolling = usePolling(() => {
@@ -115,26 +110,24 @@ const ProtectedRouter = () => {
}, []);
return (
<BlockerScreen>
<Stack.Navigator
screenOptions={DEFAULT_SCREEN_OPTIONS}
screenListeners={getScreenFocusListenerObj}
>
<Stack.Screen name={PageRouteEnum.HOME} component={AllCasesMain} />
<Stack.Screen name={PageRouteEnum.CASE_DETAIL_STACK} component={CaseDetailStack} />
<Stack.Screen
name={PageRouteEnum.NEARBY_CASES}
component={NearbyCases}
options={{
...DEFAULT_SCREEN_OPTIONS,
animation: 'slide_from_right',
}}
/>
<Stack.Screen name={PageRouteEnum.TODO_LIST} component={TodoList} />
<Stack.Screen name={PageRouteEnum.NOTIFICATIONS} component={Notifications} />
<Stack.Screen name={PageRouteEnum.IMPERSONATED_LOGIN} component={ImpersonatedUser} />
</Stack.Navigator>
</BlockerScreen>
<Stack.Navigator
screenOptions={DEFAULT_SCREEN_OPTIONS}
screenListeners={getScreenFocusListenerObj}
>
<Stack.Screen name={PageRouteEnum.HOME} component={AllCasesMain} />
<Stack.Screen name={PageRouteEnum.CASE_DETAIL_STACK} component={CaseDetailStack} />
<Stack.Screen
name={PageRouteEnum.NEARBY_CASES}
component={NearbyCases}
options={{
...DEFAULT_SCREEN_OPTIONS,
animation: 'slide_from_right',
}}
/>
<Stack.Screen name={PageRouteEnum.TODO_LIST} component={TodoList} />
<Stack.Screen name={PageRouteEnum.NOTIFICATIONS} component={Notifications} />
<Stack.Screen name={PageRouteEnum.IMPERSONATED_LOGIN} component={ImpersonatedUser} />
</Stack.Navigator>
);
};