diff --git a/app/_layout.tsx b/app/_layout.tsx index 7b993aa7a..5ab9dbb41 100644 --- a/app/_layout.tsx +++ b/app/_layout.tsx @@ -9,11 +9,8 @@ import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; import { reconnect } from "@wagmi/core"; import { type FontSource, useFonts } from "expo-font"; import { Slot, SplashScreen } from "expo-router"; -import Head from "expo-router/head"; import { StatusBar } from "expo-status-bar"; import React, { useEffect } from "react"; -import { Platform } from "react-native"; -import { OneSignal } from "react-native-onesignal"; import * as Sentry from "sentry-expo"; import { TamaguiProvider } from "tamagui"; import { WagmiProvider, createConfig, custom } from "wagmi"; @@ -21,8 +18,9 @@ import { WagmiProvider, createConfig, custom } from "wagmi"; import metadata from "../package.json"; import tamaguiConfig from "../tamagui.config"; import alchemyConnector from "../utils/alchemyConnector"; -import { alchemyAPIKey, chain, oneSignalAPPId } from "../utils/constants"; +import { alchemyAPIKey, chain } from "../utils/constants"; import handleError from "../utils/handleError"; +import useOneSignal from "../utils/onesignal"; export { ErrorBoundary } from "expo-router"; @@ -40,10 +38,6 @@ Sentry.init({ autoSessionTracking: true, }); -if (oneSignalAPPId) { - OneSignal.initialize(oneSignalAPPId); -} - const provider = new AlchemyProvider({ apiKey: alchemyAPIKey, chain }); const wagmiConfig = createConfig({ chains: [chain], @@ -69,31 +63,14 @@ export default function RootLayout() { useEffect(() => { reconnect(wagmiConfig).catch(handleError); - // TODO(jg): use real user id - if (oneSignalAPPId) OneSignal.login("0000000"); }, []); - if (!loaded) return; + const initialized = useOneSignal({}); + + if (!loaded || !initialized) return; return ( <> - {Platform.OS === "web" && ( - -