diff --git a/apps/mobile/app.config.ts b/apps/mobile/app.config.ts index b10ed58..1cc21cd 100644 --- a/apps/mobile/app.config.ts +++ b/apps/mobile/app.config.ts @@ -39,7 +39,10 @@ export default ({ config }: ConfigContext): ExpoConfig => ({ "expo-secure-store", "expo-web-browser", "@maplibre/maplibre-react-native", - "@sentry/react-native", + ["@sentry/react-native", { + organization: "trails-qq", + project: "mobile", + }], "expo-sqlite", ], extra: { diff --git a/apps/mobile/app/_layout.tsx b/apps/mobile/app/_layout.tsx index 17e13ad..251a51d 100644 --- a/apps/mobile/app/_layout.tsx +++ b/apps/mobile/app/_layout.tsx @@ -1,9 +1,12 @@ import { useEffect, useState } from "react"; import { Stack, router } from "expo-router"; +import { Sentry, initSentry } from "../lib/sentry"; import { isAuthenticated } from "../lib/auth"; import { startVersionCheck } from "../lib/version-check"; -export default function RootLayout() { +initSentry(); + +function RootLayout() { const [checked, setChecked] = useState(false); useEffect(() => { @@ -21,3 +24,5 @@ export default function RootLayout() { return ; } + +export default Sentry.wrap(RootLayout); diff --git a/apps/mobile/eas.json b/apps/mobile/eas.json index d6af290..e146e9e 100644 --- a/apps/mobile/eas.json +++ b/apps/mobile/eas.json @@ -9,10 +9,16 @@ "distribution": "internal", "ios": { "simulator": true + }, + "env": { + "SENTRY_DISABLE_AUTO_UPLOAD": "true" } }, "preview": { - "distribution": "internal" + "distribution": "internal", + "env": { + "SENTRY_DISABLE_AUTO_UPLOAD": "true" + } }, "production": { "autoIncrement": true @@ -23,7 +29,10 @@ "ios": { "simulator": true }, - "environment": "development" + "environment": "development", + "env": { + "SENTRY_DISABLE_AUTO_UPLOAD": "true" + } } }, "submit": { diff --git a/apps/mobile/lib/sentry.ts b/apps/mobile/lib/sentry.ts new file mode 100644 index 0000000..7dc01b5 --- /dev/null +++ b/apps/mobile/lib/sentry.ts @@ -0,0 +1,13 @@ +import * as Sentry from "@sentry/react-native"; + +const SENTRY_DSN = "https://af50ac7aea803216adbe21e9dd4b896b@o4509530546634752.ingest.de.sentry.io/4511209742532688"; + +export function initSentry() { + Sentry.init({ + dsn: SENTRY_DSN, + tracesSampleRate: __DEV__ ? 0 : 1.0, + enabled: !__DEV__, + }); +} + +export { Sentry };