Add new metrics for post menu interactions (#10022)
Co-authored-by: Eric Bailey <git@esb.lol>
This commit is contained in:
@@ -470,6 +470,10 @@ export type Events = {
|
|||||||
profileDid: string
|
profileDid: string
|
||||||
position?: number
|
position?: number
|
||||||
}
|
}
|
||||||
|
'profile:mute': {}
|
||||||
|
'profile:unmute': {}
|
||||||
|
'profile:block': {}
|
||||||
|
'profile:unblock': {}
|
||||||
'suggestedUser:follow': {
|
'suggestedUser:follow': {
|
||||||
logContext:
|
logContext:
|
||||||
| 'Explore'
|
| 'Explore'
|
||||||
@@ -719,6 +723,37 @@ export type Events = {
|
|||||||
targetLanguage: string
|
targetLanguage: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
'postMenu:openMuteWordsDialog': {
|
||||||
|
uri: string
|
||||||
|
authorDid: string
|
||||||
|
logContext: 'FeedItem' | 'PostThreadItem' | 'Post' | 'ImmersiveVideo'
|
||||||
|
feedDescriptor?: string
|
||||||
|
}
|
||||||
|
'postMenu:muteAccount': {
|
||||||
|
uri: string
|
||||||
|
authorDid: string
|
||||||
|
logContext: 'FeedItem' | 'PostThreadItem' | 'Post' | 'ImmersiveVideo'
|
||||||
|
feedDescriptor?: string
|
||||||
|
}
|
||||||
|
'postMenu:unmuteAccount': {
|
||||||
|
uri: string
|
||||||
|
authorDid: string
|
||||||
|
logContext: 'FeedItem' | 'PostThreadItem' | 'Post' | 'ImmersiveVideo'
|
||||||
|
feedDescriptor?: string
|
||||||
|
}
|
||||||
|
'postMenu:blockAccount': {
|
||||||
|
uri: string
|
||||||
|
authorDid: string
|
||||||
|
logContext: 'FeedItem' | 'PostThreadItem' | 'Post' | 'ImmersiveVideo'
|
||||||
|
feedDescriptor?: string
|
||||||
|
}
|
||||||
|
'postMenu:reportPost': {
|
||||||
|
uri: string
|
||||||
|
authorDid: string
|
||||||
|
logContext: 'FeedItem' | 'PostThreadItem' | 'Post' | 'ImmersiveVideo'
|
||||||
|
feedDescriptor?: string
|
||||||
|
}
|
||||||
|
|
||||||
'verification:create': {}
|
'verification:create': {}
|
||||||
'verification:revoke': {}
|
'verification:revoke': {}
|
||||||
'verification:badge:click': {}
|
'verification:badge:click': {}
|
||||||
|
|||||||
@@ -251,6 +251,16 @@ let PostMenuItems = ({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const onToggleWordsAndTagsMute = () => {
|
||||||
|
ax.metric('postMenu:openMuteWordsDialog', {
|
||||||
|
uri: postUri,
|
||||||
|
authorDid: postAuthor.did,
|
||||||
|
logContext,
|
||||||
|
feedDescriptor: feedFeedback.feedDescriptor,
|
||||||
|
})
|
||||||
|
mutedWordsDialogControl.open()
|
||||||
|
}
|
||||||
|
|
||||||
const onCopyPostText = () => {
|
const onCopyPostText = () => {
|
||||||
const str = richTextToString(richText, true)
|
const str = richTextToString(richText, true)
|
||||||
|
|
||||||
@@ -426,6 +436,13 @@ let PostMenuItems = ({
|
|||||||
logger.error('Failed to block account', {message: e})
|
logger.error('Failed to block account', {message: e})
|
||||||
Toast.show(l`There was an issue! ${e.toString()}`, 'xmark')
|
Toast.show(l`There was an issue! ${e.toString()}`, 'xmark')
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
ax.metric('postMenu:blockAccount', {
|
||||||
|
uri: postUri,
|
||||||
|
authorDid: postAuthor.did,
|
||||||
|
logContext,
|
||||||
|
feedDescriptor: feedFeedback.feedDescriptor,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -440,6 +457,13 @@ let PostMenuItems = ({
|
|||||||
logger.error('Failed to unmute account', {message: e})
|
logger.error('Failed to unmute account', {message: e})
|
||||||
Toast.show(l`There was an issue! ${e.toString()}`, 'xmark')
|
Toast.show(l`There was an issue! ${e.toString()}`, 'xmark')
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
ax.metric('postMenu:unmuteAccount', {
|
||||||
|
uri: postUri,
|
||||||
|
authorDid: postAuthor.did,
|
||||||
|
logContext,
|
||||||
|
feedDescriptor: feedFeedback.feedDescriptor,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
@@ -451,6 +475,13 @@ let PostMenuItems = ({
|
|||||||
logger.error('Failed to mute account', {message: e})
|
logger.error('Failed to mute account', {message: e})
|
||||||
Toast.show(l`There was an issue! ${e.toString()}`, 'xmark')
|
Toast.show(l`There was an issue! ${e.toString()}`, 'xmark')
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
ax.metric('postMenu:muteAccount', {
|
||||||
|
uri: postUri,
|
||||||
|
authorDid: postAuthor.did,
|
||||||
|
logContext,
|
||||||
|
feedDescriptor: feedFeedback.feedDescriptor,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -601,7 +632,7 @@ let PostMenuItems = ({
|
|||||||
<Menu.Item
|
<Menu.Item
|
||||||
testID="postDropdownMuteWordsBtn"
|
testID="postDropdownMuteWordsBtn"
|
||||||
label={l`Mute words & tags`}
|
label={l`Mute words & tags`}
|
||||||
onPress={() => mutedWordsDialogControl.open()}>
|
onPress={onToggleWordsAndTagsMute}>
|
||||||
<Menu.ItemText>{l`Mute words & tags`}</Menu.ItemText>
|
<Menu.ItemText>{l`Mute words & tags`}</Menu.ItemText>
|
||||||
<Menu.ItemIcon icon={Filter} position="right" />
|
<Menu.ItemIcon icon={Filter} position="right" />
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
@@ -785,6 +816,14 @@ let PostMenuItems = ({
|
|||||||
...post,
|
...post,
|
||||||
$type: 'app.bsky.feed.defs#postView',
|
$type: 'app.bsky.feed.defs#postView',
|
||||||
}}
|
}}
|
||||||
|
onAfterSubmit={() => {
|
||||||
|
ax.metric('postMenu:reportPost', {
|
||||||
|
uri: postUri,
|
||||||
|
authorDid: postAuthor.did,
|
||||||
|
logContext,
|
||||||
|
feedDescriptor: feedFeedback.feedDescriptor,
|
||||||
|
})
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
<PostInteractionSettingsDialog
|
<PostInteractionSettingsDialog
|
||||||
control={postInteractionSettingsDialogControl}
|
control={postInteractionSettingsDialogControl}
|
||||||
|
|||||||
@@ -417,6 +417,7 @@ function useProfileUnfollowMutation(
|
|||||||
export function useProfileMuteMutationQueue(
|
export function useProfileMuteMutationQueue(
|
||||||
profile: Shadow<bsky.profile.AnyProfileView>,
|
profile: Shadow<bsky.profile.AnyProfileView>,
|
||||||
) {
|
) {
|
||||||
|
const ax = useAnalytics()
|
||||||
const queryClient = useQueryClient()
|
const queryClient = useQueryClient()
|
||||||
const did = profile.did
|
const did = profile.did
|
||||||
const initialMuted = profile.viewer?.muted
|
const initialMuted = profile.viewer?.muted
|
||||||
@@ -430,11 +431,13 @@ export function useProfileMuteMutationQueue(
|
|||||||
await muteMutation.mutateAsync({
|
await muteMutation.mutateAsync({
|
||||||
did,
|
did,
|
||||||
})
|
})
|
||||||
|
ax.metric('profile:mute', {})
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
await unmuteMutation.mutateAsync({
|
await unmuteMutation.mutateAsync({
|
||||||
did,
|
did,
|
||||||
})
|
})
|
||||||
|
ax.metric('profile:unmute', {})
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -492,6 +495,7 @@ function useProfileUnmuteMutation() {
|
|||||||
export function useProfileBlockMutationQueue(
|
export function useProfileBlockMutationQueue(
|
||||||
profile: Shadow<bsky.profile.AnyProfileView>,
|
profile: Shadow<bsky.profile.AnyProfileView>,
|
||||||
) {
|
) {
|
||||||
|
const ax = useAnalytics()
|
||||||
const queryClient = useQueryClient()
|
const queryClient = useQueryClient()
|
||||||
const did = profile.did
|
const did = profile.did
|
||||||
const initialBlockingUri = profile.viewer?.blocking
|
const initialBlockingUri = profile.viewer?.blocking
|
||||||
@@ -505,6 +509,7 @@ export function useProfileBlockMutationQueue(
|
|||||||
const {uri} = await blockMutation.mutateAsync({
|
const {uri} = await blockMutation.mutateAsync({
|
||||||
did,
|
did,
|
||||||
})
|
})
|
||||||
|
ax.metric('profile:block', {})
|
||||||
return uri
|
return uri
|
||||||
} else {
|
} else {
|
||||||
if (prevBlockUri) {
|
if (prevBlockUri) {
|
||||||
@@ -512,6 +517,7 @@ export function useProfileBlockMutationQueue(
|
|||||||
did,
|
did,
|
||||||
blockUri: prevBlockUri,
|
blockUri: prevBlockUri,
|
||||||
})
|
})
|
||||||
|
ax.metric('profile:unblock', {})
|
||||||
}
|
}
|
||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user