From b23a042c68dbcf2affaed6a0cca8147270cb0ac2 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Thu, 6 Mar 2025 14:01:49 -0600 Subject: [PATCH] Use new logger.metric --- .../Profile/Header/ProfileHeaderLabeler.tsx | 9 ++++--- src/state/queries/preferences/index.ts | 8 ++++-- src/view/screens/ProfileList.tsx | 25 +++++++++++++++---- 3 files changed, 32 insertions(+), 10 deletions(-) diff --git a/src/screens/Profile/Header/ProfileHeaderLabeler.tsx b/src/screens/Profile/Header/ProfileHeaderLabeler.tsx index 8498e87b51..1e890951fd 100644 --- a/src/screens/Profile/Header/ProfileHeaderLabeler.tsx +++ b/src/screens/Profile/Header/ProfileHeaderLabeler.tsx @@ -14,7 +14,6 @@ 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' @@ -152,9 +151,13 @@ let ProfileHeaderLabeler = ({ } if (willSubscribe) { - logEvent('moderation:subscribedToLabeler', {}) + logger.metric('moderation:subscribedToLabeler', {}, {statsig: true}) } else { - logEvent('moderation:unsubscribedFromLabeler', {}) + logger.metric( + 'moderation:unsubscribedFromLabeler', + {}, + {statsig: true}, + ) } }), [ diff --git a/src/state/queries/preferences/index.ts b/src/state/queries/preferences/index.ts index 27f896921f..81b3dd086b 100644 --- a/src/state/queries/preferences/index.ts +++ b/src/state/queries/preferences/index.ts @@ -7,8 +7,8 @@ import {useMutation, useQuery, useQueryClient} from '@tanstack/react-query' import {PROD_DEFAULT_FEED} from '#/lib/constants' import {replaceEqualDeep} from '#/lib/functions' -import {logEvent} from '#/lib/statsig/statsig' import {getAge} from '#/lib/strings/time' +import {logger} from '#/logger' import {STALE} from '#/state/queries' import { DEFAULT_HOME_FEED_PREFS, @@ -97,7 +97,11 @@ export function usePreferencesSetContentLabelMutation() { >({ mutationFn: async ({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 await queryClient.invalidateQueries({ queryKey: preferencesQueryKey, diff --git a/src/view/screens/ProfileList.tsx b/src/view/screens/ProfileList.tsx index b944c9cbae..ab313771de 100644 --- a/src/view/screens/ProfileList.tsx +++ b/src/view/screens/ProfileList.tsx @@ -24,7 +24,6 @@ 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' @@ -403,7 +402,11 @@ function Header({ return } Toast.show(_(msg`List muted`)) - logEvent('moderation:subscribedToList', {type: 'mute'}) + logger.metric( + 'moderation:subscribedToList', + {type: 'mute'}, + {statsig: true}, + ) }, [list, listMuteMutation, _]) const onUnsubscribeMute = useCallback(async () => { @@ -419,7 +422,11 @@ function Header({ return } Toast.show(_(msg`List unmuted`)) - logEvent('moderation:unsubscribedFromList', {type: 'mute'}) + logger.metric( + 'moderation:unsubscribedFromList', + {type: 'mute'}, + {statsig: true}, + ) }, [list, listMuteMutation, _]) const onSubscribeBlock = useCallback(async () => { @@ -435,7 +442,11 @@ function Header({ return } Toast.show(_(msg`List blocked`)) - logEvent('moderation:subscribedToList', {type: 'block'}) + logger.metric( + 'moderation:subscribedToList', + {type: 'block'}, + {statsig: true}, + ) }, [list, listBlockMutation, _]) const onUnsubscribeBlock = useCallback(async () => { @@ -451,7 +462,11 @@ function Header({ return } Toast.show(_(msg`List unblocked`)) - logEvent('moderation:unsubscribedFromList', {type: 'block'}) + logger.metric( + 'moderation:unsubscribedFromList', + {type: 'block'}, + {statsig: true}, + ) }, [list, listBlockMutation, _]) const onPressEdit = useCallback(() => {