add some metrics
This commit is contained in:
@@ -287,4 +287,17 @@ export type LogEvents = {
|
||||
|
||||
'progressGuide:hide': {}
|
||||
'progressGuide:followDialog:open': {}
|
||||
|
||||
'moderation:subscribedToLabeler': {}
|
||||
'moderation:unsubscribedFromLabeler': {}
|
||||
'moderation:changeLabelPreference': {
|
||||
preference: string
|
||||
}
|
||||
|
||||
'moderation:subscribedToList': {
|
||||
type: 'mute' | 'block'
|
||||
}
|
||||
'moderation:unsubscribedFromList': {
|
||||
type: 'mute' | 'block'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import {useLingui} from '@lingui/react'
|
||||
import {MAX_LABELERS} from '#/lib/constants'
|
||||
import {useHaptics} from '#/lib/haptics'
|
||||
import {isAppLabeler} from '#/lib/moderation'
|
||||
import {logEvent} from '#/lib/statsig/statsig'
|
||||
import {logger} from '#/logger'
|
||||
import {isIOS, isWeb} from '#/platform/detection'
|
||||
import {useProfileShadow} from '#/state/cache/profile-shadow'
|
||||
@@ -134,6 +135,7 @@ let ProfileHeaderLabeler = ({
|
||||
const onPressSubscribe = React.useCallback(
|
||||
() =>
|
||||
requireAuth(async (): Promise<void> => {
|
||||
const willSubscribe = !isSubscribed
|
||||
try {
|
||||
await toggleSubscription({
|
||||
did: profile.did,
|
||||
@@ -146,6 +148,13 @@ let ProfileHeaderLabeler = ({
|
||||
return
|
||||
}
|
||||
logger.error(`Failed to subscribe to labeler`, {message: e.message})
|
||||
return
|
||||
}
|
||||
|
||||
if (willSubscribe) {
|
||||
logEvent('moderation:subscribedToLabeler', {})
|
||||
} else {
|
||||
logEvent('moderation:unbuscribedFromLabeler', {})
|
||||
}
|
||||
}),
|
||||
[
|
||||
|
||||
@@ -24,6 +24,7 @@ import {makeListLink} from '#/lib/routes/links'
|
||||
import {CommonNavigatorParams, NativeStackScreenProps} from '#/lib/routes/types'
|
||||
import {NavigationProp} from '#/lib/routes/types'
|
||||
import {shareUrl} from '#/lib/sharing'
|
||||
import {logEvent} from '#/lib/statsig/statsig'
|
||||
import {cleanError} from '#/lib/strings/errors'
|
||||
import {toShareUrl} from '#/lib/strings/url-helpers'
|
||||
import {s} from '#/lib/styles'
|
||||
@@ -389,53 +390,61 @@ function Header({
|
||||
const onSubscribeMute = useCallback(async () => {
|
||||
try {
|
||||
await listMuteMutation.mutateAsync({uri: list.uri, mute: true})
|
||||
Toast.show(_(msg`List muted`))
|
||||
} catch {
|
||||
Toast.show(
|
||||
_(
|
||||
msg`There was an issue. Please check your internet connection and try again.`,
|
||||
),
|
||||
)
|
||||
return
|
||||
}
|
||||
Toast.show(_(msg`List muted`))
|
||||
logEvent('moderation:subscribedToList', {type: 'mute'})
|
||||
}, [list, listMuteMutation, _])
|
||||
|
||||
const onUnsubscribeMute = useCallback(async () => {
|
||||
try {
|
||||
await listMuteMutation.mutateAsync({uri: list.uri, mute: false})
|
||||
Toast.show(_(msg`List unmuted`))
|
||||
} catch {
|
||||
Toast.show(
|
||||
_(
|
||||
msg`There was an issue. Please check your internet connection and try again.`,
|
||||
),
|
||||
)
|
||||
return
|
||||
}
|
||||
Toast.show(_(msg`List unmuted`))
|
||||
logEvent('moderation:unsubscribedFromList', {type: 'mute'})
|
||||
}, [list, listMuteMutation, _])
|
||||
|
||||
const onSubscribeBlock = useCallback(async () => {
|
||||
try {
|
||||
await listBlockMutation.mutateAsync({uri: list.uri, block: true})
|
||||
Toast.show(_(msg`List blocked`))
|
||||
} catch {
|
||||
Toast.show(
|
||||
_(
|
||||
msg`There was an issue. Please check your internet connection and try again.`,
|
||||
),
|
||||
)
|
||||
return
|
||||
}
|
||||
Toast.show(_(msg`List blocked`))
|
||||
logEvent('moderation:subscribedToList', {type: 'block'})
|
||||
}, [list, listBlockMutation, _])
|
||||
|
||||
const onUnsubscribeBlock = useCallback(async () => {
|
||||
try {
|
||||
await listBlockMutation.mutateAsync({uri: list.uri, block: false})
|
||||
Toast.show(_(msg`List unblocked`))
|
||||
} catch {
|
||||
Toast.show(
|
||||
_(
|
||||
msg`There was an issue. Please check your internet connection and try again.`,
|
||||
),
|
||||
)
|
||||
return
|
||||
}
|
||||
Toast.show(_(msg`List unblocked`))
|
||||
logEvent('moderation:unsubscribedFromList', {type: 'block'})
|
||||
}, [list, listBlockMutation, _])
|
||||
|
||||
const onPressEdit = useCallback(() => {
|
||||
|
||||
Reference in New Issue
Block a user