1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00

Remove sentry-expo

Too many dependencies it needs, especially the unused expo-updates
This commit is contained in:
xmflsct
2022-09-24 13:42:15 +02:00
parent 08cd1d2c51
commit 398f37d599
17 changed files with 103 additions and 298 deletions

View File

@ -10,11 +10,9 @@ import push from '@root/startup/push'
import sentry from '@root/startup/sentry'
import timezone from '@root/startup/timezone'
import { persistor, store } from '@root/store'
import * as Sentry from '@sentry/react-native'
import AccessibilityManager from '@utils/accessibility/AccessibilityManager'
import {
changeLanguage,
getSettingsLanguage
} from '@utils/slices/settingsSlice'
import { changeLanguage, getSettingsLanguage } from '@utils/slices/settingsSlice'
import ThemeManager from '@utils/styles/ThemeManager'
import * as SplashScreen from 'expo-splash-screen'
import React, { useCallback, useEffect, useState } from 'react'
@ -24,7 +22,6 @@ import { enableFreeze } from 'react-native-screens'
import { QueryClientProvider } from 'react-query'
import { Provider } from 'react-redux'
import { PersistGate } from 'redux-persist/integration/react'
import * as Sentry from 'sentry-expo'
Platform.select({
android: LogBox.ignoreLogs(['Setting a timer for a long period of time'])
@ -93,15 +90,13 @@ const App: React.FC = () => {
}
return (
<Sentry.Native.TouchEventBoundary>
<ActionSheetProvider>
<AccessibilityManager>
<ThemeManager>
<Screens localCorrupt={localCorrupt} />
</ThemeManager>
</AccessibilityManager>
</ActionSheetProvider>
</Sentry.Native.TouchEventBoundary>
<ActionSheetProvider>
<AccessibilityManager>
<ThemeManager>
<Screens localCorrupt={localCorrupt} />
</ThemeManager>
</AccessibilityManager>
</ActionSheetProvider>
)
} else {
return null
@ -114,4 +109,4 @@ const App: React.FC = () => {
)
}
export default React.memo(App, () => true)
export default Sentry.wrap(App)

View File

@ -10,6 +10,7 @@ import ScreenAnnouncements from '@screens/Announcements'
import ScreenCompose from '@screens/Compose'
import ScreenImagesViewer from '@screens/ImagesViewer'
import ScreenTabs from '@screens/Tabs'
import * as Sentry from '@sentry/react-native'
import initQuery from '@utils/initQuery'
import { RootStackParamList } from '@utils/navigation/navigators'
import pushUseConnect from '@utils/push/useConnect'
@ -31,7 +32,6 @@ import { IntlProvider } from 'react-intl'
import { Alert, Platform, StatusBar } from 'react-native'
import ShareMenu from 'react-native-share-menu'
import { useSelector } from 'react-redux'
import * as Sentry from 'sentry-expo'
import { useAppDispatch } from './store'
const Stack = createNativeStackNavigator<RootStackParamList>()
@ -49,10 +49,7 @@ const Screens: React.FC<Props> = ({ localCorrupt }) => {
const routeRef = useRef<{ name?: string; params?: {} }>()
// Push hooks
const instances = useSelector(
getInstances,
(prev, next) => prev.length === next.length
)
const instances = useSelector(getInstances, (prev, next) => prev.length === next.length)
pushUseConnect({ t, instances })
pushUseReceive({ instances })
pushUseRespond({ instances })
@ -102,9 +99,7 @@ const Screens: React.FC<Props> = ({ localCorrupt }) => {
const currentRoute = navigationRef.getCurrentRoute()
routeRef.current = {
name: currentRoute?.name,
params: currentRoute?.params
? JSON.stringify(currentRoute.params)
: undefined
params: currentRoute?.params ? JSON.stringify(currentRoute.params) : undefined
}
}, [])
const navigationContainerOnStateChange = useCallback(() => {
@ -119,7 +114,7 @@ const Screens: React.FC<Props> = ({ localCorrupt }) => {
if (previousRoute?.name !== currentRoute?.name) {
analytics('screen_view', { screen_name: currentRoute?.name })
Sentry.Native.setContext('page', {
Sentry.setContext('page', {
previous: previousRoute,
current: currentRoute
})
@ -316,9 +311,7 @@ const Screens: React.FC<Props> = ({ localCorrupt }) => {
headerShadowVisible: false,
headerTransparent: true,
headerStyle: { backgroundColor: 'transparent' },
headerLeft: () => (
<HeaderLeft content='X' onPress={() => navigation.goBack()} />
),
headerLeft: () => <HeaderLeft content='X' onPress={() => navigation.goBack()} />,
title: t('screenAnnouncements:heading')
})}
/>

View File

@ -1,7 +1,7 @@
import * as Sentry from '@sentry/react-native'
import { mapEnvironment } from '@utils/checkEnvironment'
import axios from 'axios'
import Constants from 'expo-constants'
import * as Sentry from 'sentry-expo'
import handleError, { ctx } from './handleError'
export type Params = {
@ -31,11 +31,11 @@ const apiTooot = async <T = unknown>({
}: Params): Promise<{ body: T }> => {
console.log(
ctx.bgGreen.bold(' API tooot ') +
' ' +
method +
ctx.green(' -> ') +
`/${url}` +
(params ? ctx.green(' -> ') : ''),
' ' +
method +
ctx.green(' -> ') +
`/${url}` +
(params ? ctx.green(' -> ') : ''),
params ? params : ''
)
@ -65,12 +65,12 @@ const apiTooot = async <T = unknown>({
})
.catch(error => {
if (sentry) {
Sentry.Native.setExtras({
Sentry.setExtras({
API: 'tooot',
...(error?.response && { response: error.response }),
...(error?.request && { request: error.request })
})
Sentry.Native.captureException(error)
Sentry.captureException(error)
}
return handleError(error)

View File

@ -7,6 +7,7 @@ import haptics from '@root/components/haptics'
import { useAppDispatch } from '@root/store'
import formatText from '@screens/Compose/formatText'
import ComposeRoot from '@screens/Compose/Root'
import * as Sentry from '@sentry/react-native'
import { RootStackScreenProps } from '@utils/navigation/navigators'
import { QueryKeyTimeline, useTimelineMutation } from '@utils/queryHooks/timeline'
import { updateStoreReview } from '@utils/slices/contextsSlice'
@ -24,7 +25,6 @@ import { useTranslation } from 'react-i18next'
import { Alert, Keyboard, Platform } from 'react-native'
import { useQueryClient } from 'react-query'
import { useSelector } from 'react-redux'
import * as Sentry from 'sentry-expo'
import ComposeDraftsList from './Compose/DraftsList'
import ComposeEditAttachment from './Compose/EditAttachment'
import { uploadAttachment } from './Compose/Root/Footer/addAttachment'
@ -326,7 +326,7 @@ const ScreenCompose: React.FC<RootStackScreenProps<'Screen-Compose'>> = ({
]
)
} else {
Sentry.Native.captureMessage('Compose posting', {
Sentry.captureMessage('Compose posting', {
contexts: { errorObject: error }
})
haptics('Error')

View File

@ -1,12 +1,18 @@
import * as Sentry from 'sentry-expo'
import * as Sentry from "@sentry/react-native";
import { isDevelopment } from "@utils/checkEnvironment";
import log from './log'
const sentry = () => {
log('log', 'Sentry', 'initializing')
Sentry.init({
// @ts-ignore
enabled: !isDevelopment,
dsn: 'https://53348b60ff844d52886e90251b3a5f41@o917354.ingest.sentry.io/6410576',
enableInExpoDevelopment: false,
tracesSampleRate: 0.35,
integrations: [
new Sentry.ReactNativeTracing({
tracingOrigins: ["tooot.app"],
}),
],
autoSessionTracking: true
})
}