From a6714372732f313cb3f0814cf4fe129723b3c2c1 Mon Sep 17 00:00:00 2001 From: Aman Chaturvedi Date: Wed, 11 Sep 2024 14:09:53 +0530 Subject: [PATCH] TP-80461 | moved firestore updates to tracking component --- src/common/TrackingComponent.tsx | 4 +++ src/screens/auth/AuthRouter.tsx | 2 ++ src/screens/auth/ProtectedRouter.tsx | 43 ++++++++++++---------------- 3 files changed, 24 insertions(+), 25 deletions(-) diff --git a/src/common/TrackingComponent.tsx b/src/common/TrackingComponent.tsx index 3f750870..f823940b 100644 --- a/src/common/TrackingComponent.tsx +++ b/src/common/TrackingComponent.tsx @@ -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 = ({ children }) => { useIsLocationEnabled(); + // Firestore listener hook + useFirestoreUpdates(); + return <>{children}; }; diff --git a/src/screens/auth/AuthRouter.tsx b/src/screens/auth/AuthRouter.tsx index 5483ba8d..f62ebc8f 100644 --- a/src/screens/auth/AuthRouter.tsx +++ b/src/screens/auth/AuthRouter.tsx @@ -163,11 +163,13 @@ function AuthRouter() { return isLoggedIn ? ( + + ) : ( diff --git a/src/screens/auth/ProtectedRouter.tsx b/src/screens/auth/ProtectedRouter.tsx index 123f616a..18eab8e2 100644 --- a/src/screens/auth/ProtectedRouter.tsx +++ b/src/screens/auth/ProtectedRouter.tsx @@ -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 ( - - - - - - - - - - + + + + + + + + ); };