Skip to content

Commit a65cb3c

Browse files
committed
Merge remote-tracking branch 'origin/main' into develop
2 parents a25360d + 0c67744 commit a65cb3c

File tree

6 files changed

+282
-28
lines changed

6 files changed

+282
-28
lines changed

apps/app/app.config.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ConfigContext, ExpoConfig } from "expo/config"
22

3-
const VERSION = "1.0.9"
4-
const BUILD = 28
3+
const VERSION = "1.0.10"
4+
const BUILD = 29
55

66
const IS_DEV = process.env.APP_VARIANT === "development"
77

@@ -66,16 +66,21 @@ const defineConfig = (_ctx: ConfigContext): ExpoConfig => ({
6666
},
6767
},
6868
plugins: [
69+
"sentry-expo",
6970
"./expo-plugins/with-modify-gradle.js",
70-
[
71-
"expo-build-properties",
71+
["expo-build-properties", { android: { kotlinVersion: "1.7.22" } }],
72+
],
73+
hooks: {
74+
postPublish: [
7275
{
73-
android: {
74-
kotlinVersion: "1.7.22", // <-- add a version here for resolution, version can be newer depending on the Expo SDK version used in the project
76+
file: "sentry-expo/upload-sourcemaps",
77+
config: {
78+
organization: "noquarter",
79+
project: "element-app",
7580
},
7681
},
7782
],
78-
],
83+
},
7984
})
8085

8186
export default defineConfig

apps/app/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"@react-native-async-storage/async-storage": "1.18.2",
2727
"@react-native-community/datetimepicker": "7.2.0",
2828
"@react-native-picker/picker": "2.4.10",
29+
"@sentry/react-native": "5.10.0",
2930
"@tanstack/react-query": "4.36.1",
3031
"@trpc/client": "10.45.0",
3132
"@trpc/react-query": "10.45.0",
@@ -53,6 +54,7 @@
5354
"match-sorter": "6.3.3",
5455
"nativewind": "2.0.11",
5556
"polished": "4.2.2",
57+
"posthog-react-native": "^2.10.1",
5658
"react": "18.2.0",
5759
"react-dom": "18.2.0",
5860
"react-native": "0.72.6",
@@ -66,6 +68,7 @@
6668
"react-native-svg": "13.9.0",
6769
"react-native-toast-message": "2.2.0",
6870
"reanimated-color-picker": "2.4.2",
71+
"sentry-expo": "~7.1.0",
6972
"superjson": "1.13.3",
7073
"uuid": "3.4.0",
7174
"zustand": "4.4.7"

apps/app/src/app/_layout.tsx

Lines changed: 46 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,24 @@ import dayjs from "dayjs"
88
import { SplashScreen, Stack } from "expo-router"
99
import { StatusBar } from "expo-status-bar"
1010
import { useColorScheme as useNWColorScheme } from "nativewind"
11+
import { PostHogProvider, usePostHog } from "posthog-react-native"
12+
import * as Sentry from "sentry-expo"
1113

1214
import { Toast } from "../components/Toast"
15+
import { IS_PRODUCTION } from "../lib/config"
1316
import { useCheckExpoUpdates } from "../lib/hooks/useCheckExpoUpdates"
1417
import { useFeatures } from "../lib/hooks/useFeatures"
1518
import { useMe } from "../lib/hooks/useMe"
1619
import { useNotificationObserver } from "../lib/hooks/useNotificationObserver"
1720
import { useBackgroundColor } from "../lib/tailwind"
1821
import { api, TRPCProvider } from "../lib/utils/api"
1922

23+
Sentry.init({
24+
dsn: "https://2e39a63a183c7a7fab0f691b638da957@o204549.ingest.sentry.io/4506592060309504",
25+
enableInExpoDevelopment: false,
26+
debug: true,
27+
})
28+
2029
SplashScreen.preventAutoHideAsync()
2130

2231
// This is the main layout of the app
@@ -45,25 +54,32 @@ export default function RootLayout() {
4554
if (!fontsLoaded) return null
4655

4756
return (
48-
<ActionSheetProvider>
49-
<TRPCProvider>
50-
<PrefetchTabs>
51-
<GestureHandlerRootView style={{ flex: 1 }} onLayout={onLayoutRootView}>
52-
<SafeAreaProvider>
53-
<View className="flex-1 bg-white dark:bg-black">
54-
<Stack initialRouteName="(home)" screenOptions={{ headerShown: false, contentStyle: { backgroundColor } }}>
55-
<Stack.Screen name="(home)" />
56-
<Stack.Screen name="(auth)" options={{ presentation: "modal" }} />
57-
<Stack.Screen name="onboarding" options={{ presentation: "modal" }} />
58-
</Stack>
59-
</View>
60-
<Toast />
61-
<StatusBar />
62-
</SafeAreaProvider>
63-
</GestureHandlerRootView>
64-
</PrefetchTabs>
65-
</TRPCProvider>
66-
</ActionSheetProvider>
57+
<TRPCProvider>
58+
<PostHogProvider
59+
autocapture
60+
apiKey="phc_2W9bqjQCsJjOLxyO5wcxb4m5aQrNRjUWmKA9mvu9lcF"
61+
options={{ host: "https://eu.posthog.com", enable: IS_PRODUCTION }}
62+
>
63+
<ActionSheetProvider>
64+
<PrefetchTabs>
65+
<IdentifyUser />
66+
<GestureHandlerRootView style={{ flex: 1 }} onLayout={onLayoutRootView}>
67+
<SafeAreaProvider>
68+
<View className="flex-1 bg-white dark:bg-black">
69+
<Stack initialRouteName="(home)" screenOptions={{ headerShown: false, contentStyle: { backgroundColor } }}>
70+
<Stack.Screen name="(home)" />
71+
<Stack.Screen name="(auth)" options={{ presentation: "modal" }} />
72+
<Stack.Screen name="onboarding" options={{ presentation: "modal" }} />
73+
</Stack>
74+
</View>
75+
<Toast />
76+
<StatusBar />
77+
</SafeAreaProvider>
78+
</GestureHandlerRootView>
79+
</PrefetchTabs>
80+
</ActionSheetProvider>
81+
</PostHogProvider>
82+
</TRPCProvider>
6783
)
6884
}
6985

@@ -87,3 +103,14 @@ function PrefetchTabs(props: { children: React.ReactNode }) {
87103
if (!isDoneChecking) return null
88104
return <>{props.children}</>
89105
}
106+
107+
function IdentifyUser() {
108+
const { me, isLoading } = useMe()
109+
const posthog = usePostHog()
110+
React.useEffect(() => {
111+
if (isLoading || !me) return
112+
if (posthog) posthog.identify(me.id, { email: me.email, name: me.firstName + " " + me.lastName })
113+
Sentry.React.setUser({ id: me.id, email: me.email })
114+
}, [me, isLoading, posthog])
115+
return null
116+
}

apps/app/src/lib/hooks/useCheckExpoUpdates.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import * as React from "react"
22
import { AppState, type AppStateStatus } from "react-native"
33
import * as Updates from "expo-updates"
4+
import * as Sentry from "sentry-expo"
45

5-
// import * as Sentry from "sentry-expo"
66
import { IS_DEV } from "../config"
77

88
export function useCheckExpoUpdates() {
@@ -22,7 +22,7 @@ export function useCheckExpoUpdates() {
2222
}
2323
} catch (error) {
2424
console.log("expo update timeout reached")
25-
// Sentry.Native.captureException(error)
25+
Sentry.Native.captureException(error)
2626
} finally {
2727
return setIsDoneChecking(true)
2828
}

0 commit comments

Comments
 (0)