about summary refs log tree commit diff
diff options
context:
space:
mode:
authorhailey <me@haileyok.com>2025-05-30 12:13:44 -0700
committerGitHub <noreply@github.com>2025-05-30 12:13:44 -0700
commit2a453cd9cac811da0eb7c802489c6e4bcfe4bd78 (patch)
treed99037b247dca600dfe7f3d39146d1b046d88742
parent4890648116e255ed28c5ae0522a53278a6c35a39 (diff)
downloadvoidsky-2a453cd9cac811da0eb7c802489c6e4bcfe4bd78.tar.zst
invert flag for sending to statsig (#8431)
-rw-r--r--src/Navigation.tsx12
-rw-r--r--src/components/PostControls/PostMenu/PostMenuItems.tsx14
-rw-r--r--src/components/dialogs/nuxs/InitialVerificationAnnouncement.tsx10
-rw-r--r--src/components/dms/MessageContextMenu.tsx14
-rw-r--r--src/components/live/LiveStatusDialog.tsx12
-rw-r--r--src/components/live/queries.ts14
-rw-r--r--src/components/moderation/ReportDialog/index.tsx36
-rw-r--r--src/components/verification/VerificationCheckButton.tsx2
-rw-r--r--src/components/verification/VerificationsDialog.tsx10
-rw-r--r--src/components/verification/VerifierDialog.tsx10
-rw-r--r--src/lib/hooks/useNotificationHandler.ts6
-rw-r--r--src/logger/index.ts11
-rw-r--r--src/screens/Moderation/VerificationSettings.tsx10
-rw-r--r--src/screens/Profile/Header/Shell.tsx12
-rw-r--r--src/screens/Search/Explore.tsx2
-rw-r--r--src/screens/Search/modules/ExploreTrendingTopics.tsx6
-rw-r--r--src/screens/Signup/StepHandle.tsx2
-rw-r--r--src/state/queries/preferences/index.ts4
-rw-r--r--src/state/queries/verification/useVerificationCreateMutation.tsx2
-rw-r--r--src/state/queries/verification/useVerificationsRemoveMutation.tsx2
-rw-r--r--src/view/com/post-thread/PostThreadItem.tsx14
-rw-r--r--src/view/com/posts/PostFeed.tsx12
-rw-r--r--src/view/com/util/UserAvatar.tsx6
23 files changed, 154 insertions, 69 deletions
diff --git a/src/Navigation.tsx b/src/Navigation.tsx
index c98359387..8b981df7c 100644
--- a/src/Navigation.tsx
+++ b/src/Navigation.tsx
@@ -759,16 +759,20 @@ function RoutesContainer({children}: React.PropsWithChildren<{}>) {
         linking={LINKING}
         theme={theme}
         onStateChange={() => {
-          logger.metric('router:navigate', {
-            from: prevLoggedRouteName.current,
-          })
+          logger.metric(
+            'router:navigate',
+            {
+              from: prevLoggedRouteName.current,
+            },
+            {statsig: false},
+          )
           prevLoggedRouteName.current = getCurrentRouteName()
         }}
         onReady={() => {
           attachRouteToLogEvents(getCurrentRouteName)
           logModuleInitTime()
           onReady()
-          logger.metric('router:navigate', {})
+          logger.metric('router:navigate', {}, {statsig: false})
         }}>
         {children}
       </NavigationContainer>
diff --git a/src/components/PostControls/PostMenu/PostMenuItems.tsx b/src/components/PostControls/PostMenu/PostMenuItems.tsx
index 51991589f..969a3eca6 100644
--- a/src/components/PostControls/PostMenu/PostMenuItems.tsx
+++ b/src/components/PostControls/PostMenu/PostMenuItems.tsx
@@ -242,11 +242,15 @@ let PostMenuItems = ({
         AppBskyFeedPost.isRecord,
       )
     ) {
-      logger.metric('translate', {
-        sourceLanguages: post.record.langs ?? [],
-        targetLanguage: langPrefs.primaryLanguage,
-        textLength: post.record.text.length,
-      })
+      logger.metric(
+        'translate',
+        {
+          sourceLanguages: post.record.langs ?? [],
+          targetLanguage: langPrefs.primaryLanguage,
+          textLength: post.record.text.length,
+        },
+        {statsig: false},
+      )
     }
   }
 
diff --git a/src/components/dialogs/nuxs/InitialVerificationAnnouncement.tsx b/src/components/dialogs/nuxs/InitialVerificationAnnouncement.tsx
index fb7550043..56db5c246 100644
--- a/src/components/dialogs/nuxs/InitialVerificationAnnouncement.tsx
+++ b/src/components/dialogs/nuxs/InitialVerificationAnnouncement.tsx
@@ -161,9 +161,13 @@ export function InitialVerificationAnnouncement() {
               color="primary"
               style={[a.justify_center, a.w_full]}
               onPress={() => {
-                logger.metric('verification:learn-more', {
-                  location: 'initialAnnouncementeNux',
-                })
+                logger.metric(
+                  'verification:learn-more',
+                  {
+                    location: 'initialAnnouncementeNux',
+                  },
+                  {statsig: false},
+                )
               }}>
               <ButtonText>
                 <Trans>Read blog post</Trans>
diff --git a/src/components/dms/MessageContextMenu.tsx b/src/components/dms/MessageContextMenu.tsx
index 709665347..a45ec7a07 100644
--- a/src/components/dms/MessageContextMenu.tsx
+++ b/src/components/dms/MessageContextMenu.tsx
@@ -63,11 +63,15 @@ export let MessageContextMenu = ({
     )
     openLink(translatorUrl, true)
 
-    logger.metric('translate', {
-      sourceLanguages: [],
-      targetLanguage: langPrefs.primaryLanguage,
-      textLength: message.text.length,
-    })
+    logger.metric(
+      'translate',
+      {
+        sourceLanguages: [],
+        targetLanguage: langPrefs.primaryLanguage,
+        textLength: message.text.length,
+      },
+      {statsig: false},
+    )
   }, [langPrefs.primaryLanguage, message.text, openLink])
 
   const onDelete = useCallback(() => {
diff --git a/src/components/live/LiveStatusDialog.tsx b/src/components/live/LiveStatusDialog.tsx
index a79265ad6..8da15bc93 100644
--- a/src/components/live/LiveStatusDialog.tsx
+++ b/src/components/live/LiveStatusDialog.tsx
@@ -158,7 +158,11 @@ export function LiveStatus({
           color="primary"
           variant="solid"
           onPress={() => {
-            logger.metric('live:card:watch', {subject: profile.did})
+            logger.metric(
+              'live:card:watch',
+              {subject: profile.did},
+              {statsig: true},
+            )
             openLink(embed.external.uri, false)
           }}>
           <ButtonText>
@@ -187,7 +191,11 @@ export function LiveStatus({
               color="secondary"
               variant="solid"
               onPress={() => {
-                logger.metric('live:card:openProfile', {subject: profile.did})
+                logger.metric(
+                  'live:card:openProfile',
+                  {subject: profile.did},
+                  {statsig: true},
+                )
                 unstableCacheProfileView(queryClient, profile)
                 onPressOpenProfile()
               }}>
diff --git a/src/components/live/queries.ts b/src/components/live/queries.ts
index 08cb0fc5a..19cb54ebf 100644
--- a/src/components/live/queries.ts
+++ b/src/components/live/queries.ts
@@ -140,9 +140,17 @@ export function useUpsertLiveStatusMutation(
     },
     onSuccess: ({record, image}) => {
       if (createdAt) {
-        logger.metric('live:edit', {duration: record.durationMinutes})
+        logger.metric(
+          'live:edit',
+          {duration: record.durationMinutes},
+          {statsig: true},
+        )
       } else {
-        logger.metric('live:create', {duration: record.durationMinutes})
+        logger.metric(
+          'live:create',
+          {duration: record.durationMinutes},
+          {statsig: true},
+        )
       }
 
       Toast.show(_(msg`You are now live!`))
@@ -199,7 +207,7 @@ export function useRemoveLiveStatusMutation() {
       })
     },
     onSuccess: () => {
-      logger.metric('live:remove', {})
+      logger.metric('live:remove', {}, {statsig: true})
       Toast.show(_(msg`You are no longer live`))
       control.close(() => {
         if (!currentAccount) return
diff --git a/src/components/moderation/ReportDialog/index.tsx b/src/components/moderation/ReportDialog/index.tsx
index c785e8c5e..acab1d21f 100644
--- a/src/components/moderation/ReportDialog/index.tsx
+++ b/src/components/moderation/ReportDialog/index.tsx
@@ -1,7 +1,7 @@
 import React from 'react'
 import {Pressable, View} from 'react-native'
-import {ScrollView} from 'react-native-gesture-handler'
-import {AppBskyLabelerDefs} from '@atproto/api'
+import {type ScrollView} from 'react-native-gesture-handler'
+import {type AppBskyLabelerDefs} from '@atproto/api'
 import {msg, Trans} from '@lingui/macro'
 import {useLingui} from '@lingui/react'
 
@@ -33,9 +33,9 @@ import {useSubmitReportMutation} from './action'
 import {DMCA_LINK} from './const'
 import {useCopyForSubject} from './copy'
 import {initialState, reducer} from './state'
-import {ReportDialogProps, ReportSubject} from './types'
+import {type ReportDialogProps, type ReportSubject} from './types'
 import {parseReportSubject} from './utils/parseReportSubject'
-import {ReportOption, useReportOptions} from './utils/useReportOptions'
+import {type ReportOption, useReportOptions} from './utils/useReportOptions'
 
 export {useDialogControl as useReportDialogControl} from '#/components/Dialog'
 
@@ -51,7 +51,7 @@ export function ReportDialog(
     [props.subject],
   )
   const onClose = React.useCallback(() => {
-    logger.metric('reportDialog:close', {})
+    logger.metric('reportDialog:close', {}, {statsig: false})
   }, [])
   return (
     <Dialog.Outer control={props.control} onClose={onClose}>
@@ -155,17 +155,21 @@ function Inner(props: ReportDialogProps) {
         }),
       )
       setSuccess(true)
-      logger.metric('reportDialog:success', {
-        reason: state.selectedOption?.reason!,
-        labeler: state.selectedLabeler?.creator.handle!,
-        details: !!state.details,
-      })
+      logger.metric(
+        'reportDialog:success',
+        {
+          reason: state.selectedOption?.reason!,
+          labeler: state.selectedLabeler?.creator.handle!,
+          details: !!state.details,
+        },
+        {statsig: false},
+      )
       // give time for user feedback
       setTimeout(() => {
         props.control.close()
       }, 1e3)
     } catch (e: any) {
-      logger.metric('reportDialog:failure', {})
+      logger.metric('reportDialog:failure', {}, {statsig: false})
       logger.error(e, {
         source: 'ReportDialog',
       })
@@ -179,9 +183,13 @@ function Inner(props: ReportDialogProps) {
   }, [_, submitReport, state, dispatch, props, setPending, setSuccess])
 
   React.useEffect(() => {
-    logger.metric('reportDialog:open', {
-      subjectType: props.subject.type,
-    })
+    logger.metric(
+      'reportDialog:open',
+      {
+        subjectType: props.subject.type,
+      },
+      {statsig: false},
+    )
   }, [props.subject])
 
   return (
diff --git a/src/components/verification/VerificationCheckButton.tsx b/src/components/verification/VerificationCheckButton.tsx
index 1b66cd90e..9278a3072 100644
--- a/src/components/verification/VerificationCheckButton.tsx
+++ b/src/components/verification/VerificationCheckButton.tsx
@@ -100,7 +100,7 @@ export function Badge({
         }
         hitSlop={20}
         onPress={() => {
-          logger.metric('verification:badge:click', {})
+          logger.metric('verification:badge:click', {}, {statsig: true})
           if (state.profile.role === 'verifier') {
             verifierDialogControl.open()
           } else {
diff --git a/src/components/verification/VerificationsDialog.tsx b/src/components/verification/VerificationsDialog.tsx
index b1461b08a..665bf3ba3 100644
--- a/src/components/verification/VerificationsDialog.tsx
+++ b/src/components/verification/VerificationsDialog.tsx
@@ -153,9 +153,13 @@ function Inner({
           color="secondary"
           style={[a.justify_center]}
           onPress={() => {
-            logger.metric('verification:learn-more', {
-              location: 'verificationsDialog',
-            })
+            logger.metric(
+              'verification:learn-more',
+              {
+                location: 'verificationsDialog',
+              },
+              {statsig: true},
+            )
           }}>
           <ButtonText>
             <Trans>Learn more</Trans>
diff --git a/src/components/verification/VerifierDialog.tsx b/src/components/verification/VerifierDialog.tsx
index c38ac20b5..c62f01832 100644
--- a/src/components/verification/VerifierDialog.tsx
+++ b/src/components/verification/VerifierDialog.tsx
@@ -120,9 +120,13 @@ function Inner({
             color="primary"
             style={[a.justify_center]}
             onPress={() => {
-              logger.metric('verification:learn-more', {
-                location: 'verifierDialog',
-              })
+              logger.metric(
+                'verification:learn-more',
+                {
+                  location: 'verifierDialog',
+                },
+                {statsig: true},
+              )
             }}>
             <ButtonText>
               <Trans>Learn more</Trans>
diff --git a/src/lib/hooks/useNotificationHandler.ts b/src/lib/hooks/useNotificationHandler.ts
index f7cb6bae6..b1bfe6018 100644
--- a/src/lib/hooks/useNotificationHandler.ts
+++ b/src/lib/hooks/useNotificationHandler.ts
@@ -248,7 +248,11 @@ export function useNotificationsHandler() {
             'User pressed a notification, opening notifications tab',
             {},
           )
-          logger.metric('notifications:openApp', {reason: payload.reason})
+          logger.metric(
+            'notifications:openApp',
+            {reason: payload.reason},
+            {statsig: false},
+          )
 
           invalidateCachedUnreadPage()
           truncateAndInvalidate(queryClient, RQKEY_NOTIFS('all'))
diff --git a/src/logger/index.ts b/src/logger/index.ts
index 0a50a9d21..e7aaf666a 100644
--- a/src/logger/index.ts
+++ b/src/logger/index.ts
@@ -2,11 +2,16 @@ import {nanoid} from 'nanoid/non-secure'
 
 import {logEvent} from '#/lib/statsig/statsig'
 import {add} from '#/logger/logDump'
-import {MetricEvents} from '#/logger/metrics'
+import {type MetricEvents} from '#/logger/metrics'
 import {bitdriftTransport} from '#/logger/transports/bitdrift'
 import {consoleTransport} from '#/logger/transports/console'
 import {sentryTransport} from '#/logger/transports/sentry'
-import {LogContext, LogLevel, Metadata, Transport} from '#/logger/types'
+import {
+  LogContext,
+  LogLevel,
+  type Metadata,
+  type Transport,
+} from '#/logger/types'
 import {enabledLogLevels} from '#/logger/util'
 import {isNative} from '#/platform/detection'
 
@@ -99,7 +104,7 @@ export class Logger {
        * Optionally also send to StatSig
        */
       statsig?: boolean
-    } = {statsig: false},
+    } = {statsig: true},
   ) {
     logEvent(event, metadata, {
       lake: !options.statsig,
diff --git a/src/screens/Moderation/VerificationSettings.tsx b/src/screens/Moderation/VerificationSettings.tsx
index f9665d6d9..cd023ae56 100644
--- a/src/screens/Moderation/VerificationSettings.tsx
+++ b/src/screens/Moderation/VerificationSettings.tsx
@@ -46,9 +46,13 @@ export function Screen() {
                   to={urls.website.blog.initialVerificationAnnouncement}
                   label={_(msg`Learn more`)}
                   onPress={() => {
-                    logger.metric('verification:learn-more', {
-                      location: 'verificationSettings',
-                    })
+                    logger.metric(
+                      'verification:learn-more',
+                      {
+                        location: 'verificationSettings',
+                      },
+                      {statsig: true},
+                    )
                   }}>
                   Learn more here.
                 </InlineLinkText>
diff --git a/src/screens/Profile/Header/Shell.tsx b/src/screens/Profile/Header/Shell.tsx
index 9e868c474..9777c8cc7 100644
--- a/src/screens/Profile/Header/Shell.tsx
+++ b/src/screens/Profile/Header/Shell.tsx
@@ -101,14 +101,22 @@ let ProfileHeaderShell = ({
 
   useEffect(() => {
     if (live.isActive) {
-      logger.metric('live:view:profile', {subject: profile.did})
+      logger.metric(
+        'live:view:profile',
+        {subject: profile.did},
+        {statsig: true},
+      )
     }
   }, [live.isActive, profile.did])
 
   const onPressAvi = React.useCallback(() => {
     if (live.isActive) {
       playHaptic('Light')
-      logger.metric('live:card:open', {subject: profile.did, from: 'profile'})
+      logger.metric(
+        'live:card:open',
+        {subject: profile.did, from: 'profile'},
+        {statsig: true},
+      )
       liveStatusControl.open()
     } else {
       const modui = moderation.ui('avatar')
diff --git a/src/screens/Search/Explore.tsx b/src/screens/Search/Explore.tsx
index 1aac68c43..930bc1762 100644
--- a/src/screens/Search/Explore.tsx
+++ b/src/screens/Search/Explore.tsx
@@ -959,7 +959,7 @@ export function Explore({
     }
     if (!alreadyReportedRef.current.has(module)) {
       alreadyReportedRef.current.set(module, module)
-      logger.metric('explore:module:seen', {module})
+      logger.metric('explore:module:seen', {module}, {statsig: false})
     }
   }, [])
 
diff --git a/src/screens/Search/modules/ExploreTrendingTopics.tsx b/src/screens/Search/modules/ExploreTrendingTopics.tsx
index ee541e385..130eb1e5e 100644
--- a/src/screens/Search/modules/ExploreTrendingTopics.tsx
+++ b/src/screens/Search/modules/ExploreTrendingTopics.tsx
@@ -44,7 +44,11 @@ function Inner() {
           trend={trend}
           rank={index + 1}
           onPress={() => {
-            logger.metric('trendingTopic:click', {context: 'explore'})
+            logger.metric(
+              'trendingTopic:click',
+              {context: 'explore'},
+              {statsig: true},
+            )
           }}
         />
       ))}
diff --git a/src/screens/Signup/StepHandle.tsx b/src/screens/Signup/StepHandle.tsx
index c84679227..8bf0c3364 100644
--- a/src/screens/Signup/StepHandle.tsx
+++ b/src/screens/Signup/StepHandle.tsx
@@ -55,7 +55,7 @@ export function StepHandle() {
           value: _(msg`That handle is already taken.`),
           field: 'handle',
         })
-        logger.metric('signup:handleTaken', {})
+        logger.metric('signup:handleTaken', {}, {statsig: true})
         return
       }
     } catch (e) {
diff --git a/src/state/queries/preferences/index.ts b/src/state/queries/preferences/index.ts
index daab5eca3..e64f117e6 100644
--- a/src/state/queries/preferences/index.ts
+++ b/src/state/queries/preferences/index.ts
@@ -416,9 +416,9 @@ export function useSetVerificationPrefsMutation() {
     mutationFn: async prefs => {
       await agent.setVerificationPrefs(prefs)
       if (prefs.hideBadges) {
-        logger.metric('verification:settings:hideBadges', {})
+        logger.metric('verification:settings:hideBadges', {}, {statsig: true})
       } else {
-        logger.metric('verification:settings:unHideBadges', {})
+        logger.metric('verification:settings:unHideBadges', {}, {statsig: true})
       }
       // triggers a refetch
       await queryClient.invalidateQueries({
diff --git a/src/state/queries/verification/useVerificationCreateMutation.tsx b/src/state/queries/verification/useVerificationCreateMutation.tsx
index 1048eb9d2..ddd2aa0c0 100644
--- a/src/state/queries/verification/useVerificationCreateMutation.tsx
+++ b/src/state/queries/verification/useVerificationCreateMutation.tsx
@@ -46,7 +46,7 @@ export function useVerificationCreateMutation() {
       )
     },
     async onSuccess(_, {profile}) {
-      logger.metric('verification:create', {})
+      logger.metric('verification:create', {}, {statsig: true})
       await updateProfileVerificationCache({profile})
     },
   })
diff --git a/src/state/queries/verification/useVerificationsRemoveMutation.tsx b/src/state/queries/verification/useVerificationsRemoveMutation.tsx
index 936c786c9..1d7d98e4a 100644
--- a/src/state/queries/verification/useVerificationsRemoveMutation.tsx
+++ b/src/state/queries/verification/useVerificationsRemoveMutation.tsx
@@ -56,7 +56,7 @@ export function useVerificationsRemoveMutation() {
       )
     },
     async onSuccess(_, {profile}) {
-      logger.metric('verification:revoke', {})
+      logger.metric('verification:revoke', {}, {statsig: true})
       await updateProfileVerificationCache({profile})
     },
   })
diff --git a/src/view/com/post-thread/PostThreadItem.tsx b/src/view/com/post-thread/PostThreadItem.tsx
index 77adebac9..8b39072ba 100644
--- a/src/view/com/post-thread/PostThreadItem.tsx
+++ b/src/view/com/post-thread/PostThreadItem.tsx
@@ -841,11 +841,15 @@ function ExpandedPostDetails({
           AppBskyFeedPost.isRecord,
         )
       ) {
-        logger.metric('translate', {
-          sourceLanguages: post.record.langs ?? [],
-          targetLanguage: langPrefs.primaryLanguage,
-          textLength: post.record.text.length,
-        })
+        logger.metric(
+          'translate',
+          {
+            sourceLanguages: post.record.langs ?? [],
+            targetLanguage: langPrefs.primaryLanguage,
+            textLength: post.record.text.length,
+          },
+          {statsig: false},
+        )
       }
 
       return false
diff --git a/src/view/com/posts/PostFeed.tsx b/src/view/com/posts/PostFeed.tsx
index 90ad2a522..cbbe4a00f 100644
--- a/src/view/com/posts/PostFeed.tsx
+++ b/src/view/com/posts/PostFeed.tsx
@@ -796,10 +796,14 @@ let PostFeed = ({
         ) {
           if (!seenActorWithStatusRef.current.has(actor.did)) {
             seenActorWithStatusRef.current.add(actor.did)
-            logger.metric('live:view:post', {
-              subject: actor.did,
-              feed,
-            })
+            logger.metric(
+              'live:view:post',
+              {
+                subject: actor.did,
+                feed,
+              },
+              {statsig: false},
+            )
           }
         }
       }
diff --git a/src/view/com/util/UserAvatar.tsx b/src/view/com/util/UserAvatar.tsx
index b3bf144f7..3a7dcca3d 100644
--- a/src/view/com/util/UserAvatar.tsx
+++ b/src/view/com/util/UserAvatar.tsx
@@ -530,7 +530,11 @@ let PreviewableUserAvatar = ({
 
   const onOpenLiveStatus = useCallback(() => {
     playHaptic('Light')
-    logger.metric('live:card:open', {subject: profile.did, from: 'post'})
+    logger.metric(
+      'live:card:open',
+      {subject: profile.did, from: 'post'},
+      {statsig: true},
+    )
     liveControl.open()
   }, [liveControl, playHaptic, profile.did])