Use new logger.metric
This commit is contained in:
@@ -14,7 +14,6 @@ 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'
|
||||||
@@ -152,9 +151,13 @@ let ProfileHeaderLabeler = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (willSubscribe) {
|
if (willSubscribe) {
|
||||||
logEvent('moderation:subscribedToLabeler', {})
|
logger.metric('moderation:subscribedToLabeler', {}, {statsig: true})
|
||||||
} else {
|
} else {
|
||||||
logEvent('moderation:unsubscribedFromLabeler', {})
|
logger.metric(
|
||||||
|
'moderation:unsubscribedFromLabeler',
|
||||||
|
{},
|
||||||
|
{statsig: true},
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
[
|
[
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import {useMutation, useQuery, useQueryClient} from '@tanstack/react-query'
|
|||||||
|
|
||||||
import {PROD_DEFAULT_FEED} from '#/lib/constants'
|
import {PROD_DEFAULT_FEED} from '#/lib/constants'
|
||||||
import {replaceEqualDeep} from '#/lib/functions'
|
import {replaceEqualDeep} from '#/lib/functions'
|
||||||
import {logEvent} from '#/lib/statsig/statsig'
|
|
||||||
import {getAge} from '#/lib/strings/time'
|
import {getAge} from '#/lib/strings/time'
|
||||||
|
import {logger} from '#/logger'
|
||||||
import {STALE} from '#/state/queries'
|
import {STALE} from '#/state/queries'
|
||||||
import {
|
import {
|
||||||
DEFAULT_HOME_FEED_PREFS,
|
DEFAULT_HOME_FEED_PREFS,
|
||||||
@@ -97,7 +97,11 @@ export function usePreferencesSetContentLabelMutation() {
|
|||||||
>({
|
>({
|
||||||
mutationFn: async ({label, visibility, labelerDid}) => {
|
mutationFn: async ({label, visibility, labelerDid}) => {
|
||||||
await agent.setContentLabelPref(label, visibility, labelerDid)
|
await agent.setContentLabelPref(label, visibility, labelerDid)
|
||||||
logEvent('moderation:changeLabelPreference', {preference: visibility})
|
logger.metric(
|
||||||
|
'moderation:changeLabelPreference',
|
||||||
|
{preference: visibility},
|
||||||
|
{statsig: true},
|
||||||
|
)
|
||||||
// triggers a refetch
|
// triggers a refetch
|
||||||
await queryClient.invalidateQueries({
|
await queryClient.invalidateQueries({
|
||||||
queryKey: preferencesQueryKey,
|
queryKey: preferencesQueryKey,
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ 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'
|
||||||
@@ -403,7 +402,11 @@ function Header({
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
Toast.show(_(msg`List muted`))
|
Toast.show(_(msg`List muted`))
|
||||||
logEvent('moderation:subscribedToList', {type: 'mute'})
|
logger.metric(
|
||||||
|
'moderation:subscribedToList',
|
||||||
|
{type: 'mute'},
|
||||||
|
{statsig: true},
|
||||||
|
)
|
||||||
}, [list, listMuteMutation, _])
|
}, [list, listMuteMutation, _])
|
||||||
|
|
||||||
const onUnsubscribeMute = useCallback(async () => {
|
const onUnsubscribeMute = useCallback(async () => {
|
||||||
@@ -419,7 +422,11 @@ function Header({
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
Toast.show(_(msg`List unmuted`))
|
Toast.show(_(msg`List unmuted`))
|
||||||
logEvent('moderation:unsubscribedFromList', {type: 'mute'})
|
logger.metric(
|
||||||
|
'moderation:unsubscribedFromList',
|
||||||
|
{type: 'mute'},
|
||||||
|
{statsig: true},
|
||||||
|
)
|
||||||
}, [list, listMuteMutation, _])
|
}, [list, listMuteMutation, _])
|
||||||
|
|
||||||
const onSubscribeBlock = useCallback(async () => {
|
const onSubscribeBlock = useCallback(async () => {
|
||||||
@@ -435,7 +442,11 @@ function Header({
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
Toast.show(_(msg`List blocked`))
|
Toast.show(_(msg`List blocked`))
|
||||||
logEvent('moderation:subscribedToList', {type: 'block'})
|
logger.metric(
|
||||||
|
'moderation:subscribedToList',
|
||||||
|
{type: 'block'},
|
||||||
|
{statsig: true},
|
||||||
|
)
|
||||||
}, [list, listBlockMutation, _])
|
}, [list, listBlockMutation, _])
|
||||||
|
|
||||||
const onUnsubscribeBlock = useCallback(async () => {
|
const onUnsubscribeBlock = useCallback(async () => {
|
||||||
@@ -451,7 +462,11 @@ function Header({
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
Toast.show(_(msg`List unblocked`))
|
Toast.show(_(msg`List unblocked`))
|
||||||
logEvent('moderation:unsubscribedFromList', {type: 'block'})
|
logger.metric(
|
||||||
|
'moderation:unsubscribedFromList',
|
||||||
|
{type: 'block'},
|
||||||
|
{statsig: true},
|
||||||
|
)
|
||||||
}, [list, listBlockMutation, _])
|
}, [list, listBlockMutation, _])
|
||||||
|
|
||||||
const onPressEdit = useCallback(() => {
|
const onPressEdit = useCallback(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user