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