Update error tracing

This commit is contained in:
Zhiyuan Zheng 2022-05-18 00:11:31 +02:00
parent 051dc7be8c
commit 4dcc561cbf
5 changed files with 23 additions and 13 deletions

View File

@ -54,6 +54,7 @@ import { enableFreeze } from 'react-native-screens'
import { QueryClientProvider } from 'react-query' import { QueryClientProvider } from 'react-query'
import { Provider } from 'react-redux' import { Provider } from 'react-redux'
import { PersistGate } from 'redux-persist/integration/react' import { PersistGate } from 'redux-persist/integration/react'
import * as Sentry from 'sentry-expo'
Platform.select({ Platform.select({
android: LogBox.ignoreLogs(['Setting a timer for a long period of time']) android: LogBox.ignoreLogs(['Setting a timer for a long period of time'])
@ -128,13 +129,15 @@ const App: React.FC = () => {
} }
return ( return (
<ActionSheetProvider> <Sentry.Native.TouchEventBoundary>
<AccessibilityManager> <ActionSheetProvider>
<ThemeManager> <AccessibilityManager>
<Screens localCorrupt={localCorrupt} /> <ThemeManager>
</ThemeManager> <Screens localCorrupt={localCorrupt} />
</AccessibilityManager> </ThemeManager>
</ActionSheetProvider> </AccessibilityManager>
</ActionSheetProvider>
</Sentry.Native.TouchEventBoundary>
) )
} else { } else {
return null return null

View File

@ -22,7 +22,7 @@ const TimelineActioned = React.memo(
const { colors } = useTheme() const { colors } = useTheme()
const navigation = const navigation =
useNavigation<StackNavigationProp<TabLocalStackParamList>>() useNavigation<StackNavigationProp<TabLocalStackParamList>>()
const name = account.display_name || account.username const name = account?.display_name || account.username
const iconColor = colors.primaryDefault const iconColor = colors.primaryDefault
const content = (content: string) => ( const content = (content: string) => (

View File

@ -377,7 +377,12 @@ const ScreenCompose: React.FC<RootStackScreenProps<'Screen-Compose'>> = ({
] ]
) )
} else { } else {
Sentry.Native.captureMessage('Compose posting', error) Sentry.Native.captureMessage('Compose posting', {
contexts: {
errorObject: error,
errorString: error.toString()
}
})
haptics('Error') haptics('Error')
composeDispatch({ type: 'posting', payload: false }) composeDispatch({ type: 'posting', payload: false })
Alert.alert(t('heading.right.alert.default.title'), undefined, [ Alert.alert(t('heading.right.alert.default.title'), undefined, [

View File

@ -35,7 +35,7 @@ const TabSharedToot: React.FC<TabSharedStackScreenProps<'Tab-Shared-Toot'>> = ({
result.data.pages.flatMap(d => [...d.body]) result.data.pages.flatMap(d => [...d.body])
: [] : []
// Auto go back when toot page is empty // Auto go back when toot page is empty
if (flattenData.length === 0) { if (flattenData.length < 1) {
navigation.goBack() navigation.goBack()
return return
} }
@ -46,13 +46,14 @@ const TabSharedToot: React.FC<TabSharedStackScreenProps<'Tab-Shared-Toot'>> = ({
if (pointer < 1) return if (pointer < 1) return
try { try {
setTimeout(() => { setTimeout(() => {
console.log('scrolling')
flRef.current?.scrollToIndex({ flRef.current?.scrollToIndex({
index: pointer, index: pointer,
viewOffset: 100 viewOffset: 100
}) })
}, 500) }, 500)
} catch {} } catch (error) {
return
}
} }
} }
}) })

View File

@ -7,7 +7,8 @@ const sentry = () => {
Sentry.init({ Sentry.init({
dsn: 'https://53348b60ff844d52886e90251b3a5f41@o917354.ingest.sentry.io/6410576', dsn: 'https://53348b60ff844d52886e90251b3a5f41@o917354.ingest.sentry.io/6410576',
enableInExpoDevelopment: false, enableInExpoDevelopment: false,
debug: !isRelease debug: !isRelease,
autoSessionTracking: true
}) })
} }