1- import React , { useEffect } from 'react' ;
2- import { Provider } from 'react-redux' ;
3- import { PersistGate } from 'redux-persist/integration/react' ;
4- import { persistor , store } from './src/Redux/Store' ;
5- import { GestureHandlerRootView } from 'react-native-gesture-handler' ;
6- import { RootNavigation } from './src/Navigation' ;
1+ import React , { useEffect } from 'react' ;
2+ import { Provider } from 'react-redux' ;
3+ import { PersistGate } from 'redux-persist/integration/react' ;
4+ import { persistor , store } from './src/Redux/Store' ;
5+ import { GestureHandlerRootView } from 'react-native-gesture-handler' ;
6+ import { RootNavigation } from './src/Navigation' ;
77import Loading from './src/Components/UIComp/Loading' ;
88import Toast from 'react-native-toast-message' ;
9- import { PaperProvider } from 'react-native-paper' ;
9+ import { PaperProvider } from 'react-native-paper' ;
1010import ForceUpdate from './src/Components/ForceUpdate' ;
11- import { ConfigCatProvider } from 'configcat-react' ;
12- import { CONFIGCAT_SDK_KEY_TEST , CONFIGCAT_SDK_KEY_PROD } from '@env' ;
13- import { BannerProvider } from './src/Components/UIComp/AnimeAdBanner/BannerContext' ;
11+ import { ConfigCatProvider } from 'configcat-react' ;
12+ import { CONFIGCAT_SDK_KEY_TEST , CONFIGCAT_SDK_KEY_PROD } from '@env' ;
13+ import { BannerProvider } from './src/Components/UIComp/AnimeAdBanner/BannerContext' ;
1414import crashlytics from '@react-native-firebase/crashlytics' ;
1515import analytics from '@react-native-firebase/analytics' ;
16+ import {
17+ configureGoogleSignIn ,
18+ listenToAuthChanges ,
19+ } from './src/InkNest-Externals/Community/Logic/CommunityActions' ;
20+ import NotificationSubscriptionBootstrapper from './src/InkNest-Externals/Notifications/components/NotificationSubscriptionBootstrapper' ;
1621
1722/**
1823 * The main App component that sets up the root of the application.
@@ -24,6 +29,12 @@ import analytics from '@react-native-firebase/analytics';
2429 */
2530const App = ( ) => {
2631 useEffect ( ( ) => {
32+ // Configure Google Sign-In
33+ configureGoogleSignIn ( ) ;
34+
35+ // Listen to auth state changes
36+ const unsubscribeAuth = store . dispatch ( listenToAuthChanges ( ) ) ;
37+
2738 if ( ! __DEV__ ) {
2839 // Initialize Firebase Crashlytics
2940 crashlytics ( ) . log ( 'App mounted.' ) ;
@@ -43,19 +54,26 @@ const App = () => {
4354 ErrorUtils . setGlobalHandler ( errorHandler ) ;
4455
4556 return ( ) => {
46- // Clean up if needed
57+ // Clean up auth listener
58+ if ( unsubscribeAuth ) unsubscribeAuth ( ) ;
4759 } ;
4860 }
61+
62+ return ( ) => {
63+ // Clean up auth listener
64+ if ( unsubscribeAuth ) unsubscribeAuth ( ) ;
65+ } ;
4966 } , [ ] ) ;
5067
5168 return (
52- < GestureHandlerRootView style = { { flex : 1 } } >
69+ < GestureHandlerRootView style = { { flex : 1 } } >
5370 < ConfigCatProvider
5471 sdkKey = { __DEV__ ? CONFIGCAT_SDK_KEY_TEST : CONFIGCAT_SDK_KEY_PROD } >
5572 < Provider store = { store } >
5673 < PersistGate loading = { < Loading /> } persistor = { persistor } >
5774 < PaperProvider >
5875 < BannerProvider >
76+ < NotificationSubscriptionBootstrapper />
5977 < RootNavigation />
6078 < Toast />
6179 < ForceUpdate />
0 commit comments