mirror of https://github.com/tooot-app/app
Provide more debugging information through Sentry
This commit is contained in:
parent
2825e76dad
commit
dd345871f8
|
@ -45,7 +45,7 @@ const Screens: React.FC<Props> = ({ localCorrupt }) => {
|
||||||
dark = 'light-content'
|
dark = 'light-content'
|
||||||
}
|
}
|
||||||
|
|
||||||
const routeNameRef = useRef<string | undefined>()
|
const routeRef = useRef<{ name?: string; params?: {} }>()
|
||||||
|
|
||||||
const isConnected = useNetInfo().isConnected
|
const isConnected = useNetInfo().isConnected
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -114,30 +114,32 @@ const Screens: React.FC<Props> = ({ localCorrupt }) => {
|
||||||
}, [instanceActive])
|
}, [instanceActive])
|
||||||
|
|
||||||
// Callbacks
|
// Callbacks
|
||||||
const navigationContainerOnReady = useCallback(
|
const navigationContainerOnReady = useCallback(() => {
|
||||||
() =>
|
const currentRoute = navigationRef.current?.getCurrentRoute()
|
||||||
(routeNameRef.current = navigationRef.current?.getCurrentRoute()?.name),
|
routeRef.current = {
|
||||||
[]
|
name: currentRoute?.name,
|
||||||
)
|
params: currentRoute?.params
|
||||||
|
}
|
||||||
|
}, [])
|
||||||
const navigationContainerOnStateChange = useCallback(() => {
|
const navigationContainerOnStateChange = useCallback(() => {
|
||||||
const previousRouteName = routeNameRef.current
|
const previousRoute = routeRef.current
|
||||||
const currentRouteName = navigationRef.current?.getCurrentRoute()?.name
|
const currentRoute = navigationRef.current?.getCurrentRoute()
|
||||||
|
|
||||||
const matchTabName = currentRouteName?.match(/(Tab-.*)-Root/)
|
const matchTabName = currentRoute?.name?.match(/(Tab-.*)-Root/)
|
||||||
if (matchTabName) {
|
if (matchTabName) {
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
dispatch(updatePreviousTab(matchTabName[1]))
|
dispatch(updatePreviousTab(matchTabName[1]))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (previousRouteName !== currentRouteName) {
|
if (previousRoute?.name !== currentRoute?.name) {
|
||||||
Analytics.setCurrentScreen(currentRouteName)
|
Analytics.setCurrentScreen(currentRoute?.name)
|
||||||
Sentry.Native.setContext('page', {
|
Sentry.Native.setContext('page', {
|
||||||
previous: previousRouteName,
|
previous: previousRoute,
|
||||||
current: currentRouteName
|
current: currentRoute
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
routeNameRef.current = currentRouteName
|
routeRef.current = currentRoute
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
Loading…
Reference in New Issue