From 6335be14e17c7bf1a36e9103148277717e3a7a90 Mon Sep 17 00:00:00 2001
From: dan <dan.abramov@gmail.com>
Date: Wed, 6 Dec 2023 20:04:05 +0000
Subject: 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
---
 src/App.native.tsx | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

(limited to 'src/App.native.tsx')

diff --git a/src/App.native.tsx b/src/App.native.tsx
index 5ffbb6a82..442d7fe58 100644
--- a/src/App.native.tsx
+++ b/src/App.native.tsx
@@ -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>
-- 
cgit 1.4.1

