-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathApp.tsx
108 lines (101 loc) · 4.71 KB
/
App.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
import { BottomSheetModalProvider } from "@design-system/BottomSheet/BottomSheetModalProvider"
import { useReactQueryDevTools } from "@dev-plugins/react-query"
import { ActionSheetProvider } from "@expo/react-native-action-sheet"
import { Chain, PrivyProvider } from "@privy-io/expo"
import { SmartWalletsProvider } from "@privy-io/expo/smart-wallets"
import { ActionSheet } from "@/components/action-sheet"
import { DebugProvider } from "@/components/debug-provider"
import { Snackbars } from "@/components/snackbar/snackbars"
import { useSetupStreamingSubscriptions } from "@/features/streams/streams"
import { useCoinbaseWalletListener } from "@/features/wallets/utils/coinbase-wallet"
import { $globalStyles } from "@/theme/styles"
import { useThemeProvider } from "@/theme/use-app-theme"
import { useCachedResources } from "@/utils/cache-resources"
import { reactQueryClient } from "@/utils/react-query/react-query.client"
import "expo-dev-client"
import React from "react"
import { GestureHandlerRootView } from "react-native-gesture-handler"
import { KeyboardProvider } from "react-native-keyboard-controller"
import { SafeAreaProvider } from "react-native-safe-area-context"
// import { useSyncQueries } from "tanstack-query-dev-tools-expo-plugin"
import { ThirdwebProvider } from "thirdweb/react"
import { base } from "viem/chains"
// import { DevToolsBubble } from "react-native-react-query-devtools"
import { ConditionalWrapper } from "@/components/conditional-wrapper"
import { captureError } from "@/utils/capture-error"
import { setupConvosApi } from "@/utils/convos-api/convos-api-init"
import { ReactQueryPersistProvider } from "@/utils/react-query/react-query-persist-provider"
import { config } from "./config"
import { useMonitorNetworkConnectivity } from "./dependencies/NetworkMonitor/use-monitor-network-connectivity"
import { registerBackgroundNotificationTask } from "./features/notifications/background-notifications-handler"
import { setupConversationsNotificationsSubscriptions } from "./features/notifications/notifications-conversations-subscriptions"
import { configureForegroundNotificationBehavior } from "./features/notifications/notifications-init"
import { AppNavigator } from "./navigation/app-navigator"
import "./utils/ignore-logs"
import { sentryInit } from "./utils/sentry/sentry-init"
import { preventSplashScreenAutoHide } from "./utils/splash/splash"
preventSplashScreenAutoHide()
sentryInit()
setupConvosApi()
configureForegroundNotificationBehavior()
setupConversationsNotificationsSubscriptions()
registerBackgroundNotificationTask().catch(captureError)
const baseMainnetOverride: Chain = {
...base,
rpcUrls: {
...base.rpcUrls,
default: {
http: [config.evm.rpcEndpoint],
},
},
}
// For now let's just be on mainnet. Easier to debug
const supportedChains = [baseMainnetOverride] as [Chain, ...Chain[]]
export function App() {
useMonitorNetworkConnectivity()
useReactQueryDevTools(reactQueryClient)
useSetupStreamingSubscriptions()
useCachedResources()
useCoinbaseWalletListener()
// Seems to be slowing the app. Need to investigate
// useSyncQueries({ queryClient: reactQueryClient })
const { themeScheme, setThemeContextOverride, ThemeProvider } = useThemeProvider()
return (
<ReactQueryPersistProvider>
{/* <QueryClientProvider client={reactQueryClient}> */}
<PrivyProvider
appId={config.privy.appId}
clientId={config.privy.clientId}
supportedChains={supportedChains}
>
<SmartWalletsProvider>
<ThirdwebProvider>
<SafeAreaProvider>
<KeyboardProvider>
<ActionSheetProvider>
<ThemeProvider value={{ themeScheme, setThemeContextOverride }}>
<GestureHandlerRootView style={$globalStyles.flex1}>
<ConditionalWrapper
condition={config.debugMenu}
wrapper={(children) => <DebugProvider>{children}</DebugProvider>}
>
<BottomSheetModalProvider>
{/* <AuthenticateWithPasskeyProvider> */}
<AppNavigator />
{/* </AuthenticateWithPasskeyProvider> */}
{/* {__DEV__ && <DevToolsBubble />} */}
<Snackbars />
<ActionSheet />
</BottomSheetModalProvider>
</ConditionalWrapper>
</GestureHandlerRootView>
</ThemeProvider>
</ActionSheetProvider>
</KeyboardProvider>
</SafeAreaProvider>
</ThirdwebProvider>
</SmartWalletsProvider>
</PrivyProvider>
</ReactQueryPersistProvider>
)
}