This commit is contained in:
Zhiyuan Zheng 2022-02-14 22:10:07 +01:00
parent e388ce7626
commit 06db0580cd
6 changed files with 24 additions and 22 deletions

View File

@ -1,3 +1,4 @@
import analytics from '@components/analytics'
import { HeaderLeft } from '@components/Header'
import { displayMessage, Message } from '@components/Message'
import navigationRef from '@helpers/navigationRef'
@ -21,7 +22,6 @@ import { updateFilters } from '@utils/slices/instances/updateFilters'
import { getInstanceActive, getInstances } from '@utils/slices/instancesSlice'
import { useTheme } from '@utils/styles/ThemeManager'
import { themes } from '@utils/styles/themes'
import * as Analytics from 'expo-firebase-analytics'
import * as Linking from 'expo-linking'
import { addScreenshotListener } from 'expo-screen-capture'
import React, { useCallback, useEffect, useRef, useState } from 'react'
@ -118,7 +118,7 @@ const Screens: React.FC<Props> = ({ localCorrupt }) => {
}
if (previousRoute?.name !== currentRoute?.name) {
Analytics.logEvent('screen_view', { screen_name: currentRoute?.name })
analytics('screen_view', { screen_name: currentRoute?.name })
Sentry.Native.setContext('page', {
previous: previousRoute,
current: currentRoute

View File

@ -58,14 +58,14 @@ const apiGeneral = async <T = unknown>({
})
})
.catch(error => {
if (sentry && Math.random() < 0.01) {
Sentry.Native.setExtras({
API: 'general',
...(error.response && { response: error.response }),
...(error.request && { request: error.request })
})
Sentry.Native.captureException(error)
}
// if (sentry && Math.random() < 0.01) {
// Sentry.Native.setExtras({
// API: 'general',
// ...(error.response && { response: error.response }),
// ...(error.request && { request: error.request })
// })
// Sentry.Native.captureException(error)
// }
if (error.response) {
// The request was made and the server responded with a status code

View File

@ -98,14 +98,14 @@ const apiInstance = async <T = unknown>({
})
})
.catch(error => {
if (Math.random() < 0.001) {
Sentry.Native.setExtras({
API: 'instance',
...(error.response && { response: error.response }),
...(error.request && { request: error.request })
})
Sentry.Native.captureException(error)
}
// if (Math.random() < 0.001) {
// Sentry.Native.setExtras({
// API: 'instance',
// ...(error.response && { response: error.response }),
// ...(error.request && { request: error.request })
// })
// Sentry.Native.captureException(error)
// }
if (error.response) {
// The request was made and the server responded with a status code

View File

@ -41,7 +41,7 @@ export const shouldFilter = ({
}) => {
const instance = getInstance(store.getState())
const ownAccount =
getInstanceAccount(store.getState())?.id === status.account.id
getInstanceAccount(store.getState())?.id === status.account?.id
let shouldFilter = false
if (!ownAccount) {

View File

@ -1,7 +1,7 @@
import * as Analytics from 'expo-firebase-analytics'
const analytics = (event: string, params?: { [key: string]: any }) => {
Analytics.logEvent(event, params)
Analytics.logEvent(event, params).catch(() => {})
}
export default analytics

View File

@ -91,8 +91,10 @@ const AccountAttachments = React.memo(
return (
<GracefullyImage
uri={{
original: item.media_attachments[0].preview_url,
remote: item.media_attachments[0].remote_url
original:
item.media_attachments[0]?.preview_url ||
item.media_attachments[0]?.url,
remote: item.media_attachments[0]?.remote_url
}}
blurhash={item.media_attachments[0].blurhash}
dimension={{ width: width, height: width }}