Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add sentry for error tracking #81

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/pull_requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ jobs:
run: yarn install

- name: 🚀 Build app
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
run: eas build --non-interactive --platform android --local --profile preview --output=./app-release.apk

- name: 🧪 Run tests
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Release tag
on:
push:
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10

jobs:
draft_release:
Expand All @@ -22,7 +22,7 @@ jobs:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: true
# prerelease: true
# prerelease: true

build_android:
needs: [draft_release]
Expand Down Expand Up @@ -53,6 +53,9 @@ jobs:
run: yarn install

- name: 🚀 Build app
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
run: eas build --non-interactive --platform android --local --profile production_apk --output=./app-release.apk

- name: Upload Artifact
Expand All @@ -71,7 +74,6 @@ jobs:
asset_path: ./app-release.apk
asset_name: alby-go-${{ github.ref_name }}-android.apk
asset_content_type: application/vnd.android.package-archive

# publish-release:
# needs: [release, build_android]
# runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ yarn-error.*

# local env files
.env*.local
.env

# typescript
*.tsbuildinfo

.env.local
52 changes: 51 additions & 1 deletion app.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,63 @@
}
],
"expo-router",
"expo-secure-store"
"expo-secure-store",
[
"@sentry/react-native/expo",
{
"url": "https://sentry.io/",
"project": "alby-go",
"organization": "getalby"
}
]
],
"ios": {
"supportsTablet": true,
"bundleIdentifier": "com.getalby.mobile",
"config": {
"usesNonExemptEncryption": false
},
"privacyManifests": {
"NSPrivacyCollectedDataTypes": [
{
"NSPrivacyCollectedDataType": "NSPrivacyCollectedDataTypeCrashData",
"NSPrivacyCollectedDataTypeLinked": false,
"NSPrivacyCollectedDataTypeTracking": false,
"NSPrivacyCollectedDataTypePurposes": [
"NSPrivacyCollectedDataTypePurposeAppFunctionality"
]
},
{
"NSPrivacyCollectedDataType": "NSPrivacyCollectedDataTypePerformanceData",
"NSPrivacyCollectedDataTypeLinked": false,
"NSPrivacyCollectedDataTypeTracking": false,
"NSPrivacyCollectedDataTypePurposes": [
"NSPrivacyCollectedDataTypePurposeAppFunctionality"
]
},
{
"NSPrivacyCollectedDataType": "NSPrivacyCollectedDataTypeOtherDiagnosticData",
"NSPrivacyCollectedDataTypeLinked": false,
"NSPrivacyCollectedDataTypeTracking": false,
"NSPrivacyCollectedDataTypePurposes": [
"NSPrivacyCollectedDataTypePurposeAppFunctionality"
]
}
],
"NSPrivacyAccessedAPITypes": [
{
"NSPrivacyAccessedAPIType": "NSPrivacyAccessedAPICategoryUserDefaults",
"NSPrivacyAccessedAPITypeReasons": ["CA92.1"]
},
{
"NSPrivacyAccessedAPIType": "NSPrivacyAccessedAPICategorySystemBootTime",
"NSPrivacyAccessedAPITypeReasons": ["35F9.1"]
},
{
"NSPrivacyAccessedAPIType": "NSPrivacyAccessedAPICategoryFileTimestamp",
"NSPrivacyAccessedAPITypeReasons": ["C617.1"]
}
]
}
},
"android": {
Expand Down
9 changes: 8 additions & 1 deletion app/_layout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Theme, ThemeProvider } from "@react-navigation/native";
import { PortalHost } from "@rn-primitives/portal";
import * as Sentry from "@sentry/react-native";
import * as Font from "expo-font";
import { Slot, SplashScreen } from "expo-router";
import { StatusBar } from "expo-status-bar";
Expand All @@ -19,6 +20,10 @@ import { isBiometricSupported } from "~/lib/isBiometricSupported";
import { useAppStore } from "~/lib/state/appStore";
import { useColorScheme } from "~/lib/useColorScheme";

Sentry.init({
dsn: process.env.SENTRY_DSN,
});

const LIGHT_THEME: Theme = {
dark: false,
colors: NAV_THEME.light,
Expand All @@ -40,7 +45,7 @@ export const unstable_settings = {
initialRouteName: "(app)/index",
};

export default function RootLayout() {
function RootLayout() {
const { isDarkColorScheme, setColorScheme } = useColorScheme();
const [resourcesLoaded, setResourcesLoaded] = React.useState(false);

Expand Down Expand Up @@ -122,3 +127,5 @@ function useConnectionChecker() {
}
}, [error?.message]);
}

export default Sentry.wrap(RootLayout);
4 changes: 2 additions & 2 deletions metro.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const { getDefaultConfig } = require("expo/metro-config");
const { withNativeWind } = require("nativewind/metro");
const { getSentryExpoConfig } = require("@sentry/react-native/metro");

// eslint-disable-next-line no-undef
const config = getDefaultConfig(__dirname);
const config = getSentryExpoConfig(__dirname);

module.exports = withNativeWind(config, { input: "./global.css" });
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"@rn-primitives/dialog": "^1.0.3",
"@rn-primitives/portal": "^1.0.3",
"@rn-primitives/switch": "^1.0.3",
"@sentry/react-native": "~5.24.3",
"bech32": "^2.0.0",
"buffer": "^6.0.3",
"class-variance-authority": "^0.7.0",
Expand Down Expand Up @@ -82,9 +83,9 @@
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.2.1",
"husky": "^9.1.6",
"lint-staged": "^15.2.10",
"jest": "^29.7.0",
"jest-expo": "^51.0.4",
"lint-staged": "^15.2.10",
"prettier": "^3.3.3",
"tailwindcss": "^3.4.3",
"typescript": "~5.3.3"
Expand Down
Loading
Loading