Move analytics out of init (#2115)

* Remove listenSessionLoaded from analytics

* Move analytics init call to navigation ready

* Remove zod dependency from analytics

* Mirror changes on the web

* Delete listenSessionLoaded

* Only set up listeners once
This commit is contained in:
dan 2023-12-06 20:04:05 +00:00 committed by GitHub
parent 748212e000
commit 6335be14e1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 35 additions and 48 deletions

View file

@ -16,7 +16,7 @@ import {ThemeProvider} from 'lib/ThemeContext'
import {s} from 'lib/styles'
import {Shell} from 'view/shell'
import * as notifications from 'lib/notifications/notifications'
import * as analytics from 'lib/analytics/analytics'
import {Provider as AnalyticsProvider} from 'lib/analytics/analytics'
import * as Toast from 'view/com/util/Toast'
import {queryClient} from 'lib/react-query'
import {TestCtrls} from 'view/com/testing/TestCtrls'
@ -45,7 +45,6 @@ function InnerApp() {
// init
useEffect(() => {
analytics.init()
notifications.init(queryClient)
listenSessionDropped(() => {
Toast.show('Sorry! Your session expired. Please log in again.')
@ -72,7 +71,7 @@ function InnerApp() {
<LoggedOutViewProvider>
<UnreadNotifsProvider>
<ThemeProvider theme={colorMode}>
<analytics.Provider>
<AnalyticsProvider>
{/* All components should be within this provider */}
<RootSiblingParent>
<GestureHandlerRootView style={s.h100pct}>
@ -80,7 +79,7 @@ function InnerApp() {
<Shell />
</GestureHandlerRootView>
</RootSiblingParent>
</analytics.Provider>
</AnalyticsProvider>
</ThemeProvider>
</UnreadNotifsProvider>
</LoggedOutViewProvider>