this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add new metrics for post menu interactions (#10022)

Co-authored-by: Eric Bailey <git@esb.lol>

authored by

DS Boyce
Eric Bailey
and committed by
GitHub
850e6e6f 0937f522

+81 -1
+35
src/analytics/metrics/types.ts
··· 470 470 profileDid: string 471 471 position?: number 472 472 } 473 + 'profile:mute': {} 474 + 'profile:unmute': {} 475 + 'profile:block': {} 476 + 'profile:unblock': {} 473 477 'suggestedUser:follow': { 474 478 logContext: 475 479 | 'Explore' ··· 717 721 os: Platform['OS'] 718 722 sourceLanguage: string 719 723 targetLanguage: string 724 + } 725 + 726 + 'postMenu:openMuteWordsDialog': { 727 + uri: string 728 + authorDid: string 729 + logContext: 'FeedItem' | 'PostThreadItem' | 'Post' | 'ImmersiveVideo' 730 + feedDescriptor?: string 731 + } 732 + 'postMenu:muteAccount': { 733 + uri: string 734 + authorDid: string 735 + logContext: 'FeedItem' | 'PostThreadItem' | 'Post' | 'ImmersiveVideo' 736 + feedDescriptor?: string 737 + } 738 + 'postMenu:unmuteAccount': { 739 + uri: string 740 + authorDid: string 741 + logContext: 'FeedItem' | 'PostThreadItem' | 'Post' | 'ImmersiveVideo' 742 + feedDescriptor?: string 743 + } 744 + 'postMenu:blockAccount': { 745 + uri: string 746 + authorDid: string 747 + logContext: 'FeedItem' | 'PostThreadItem' | 'Post' | 'ImmersiveVideo' 748 + feedDescriptor?: string 749 + } 750 + 'postMenu:reportPost': { 751 + uri: string 752 + authorDid: string 753 + logContext: 'FeedItem' | 'PostThreadItem' | 'Post' | 'ImmersiveVideo' 754 + feedDescriptor?: string 720 755 } 721 756 722 757 'verification:create': {}
+40 -1
src/components/PostControls/PostMenu/PostMenuItems.tsx
··· 251 251 } 252 252 } 253 253 254 + const onToggleWordsAndTagsMute = () => { 255 + ax.metric('postMenu:openMuteWordsDialog', { 256 + uri: postUri, 257 + authorDid: postAuthor.did, 258 + logContext, 259 + feedDescriptor: feedFeedback.feedDescriptor, 260 + }) 261 + mutedWordsDialogControl.open() 262 + } 263 + 254 264 const onCopyPostText = () => { 255 265 const str = richTextToString(richText, true) 256 266 ··· 426 436 logger.error('Failed to block account', {message: e}) 427 437 Toast.show(l`There was an issue! ${e.toString()}`, 'xmark') 428 438 } 439 + } finally { 440 + ax.metric('postMenu:blockAccount', { 441 + uri: postUri, 442 + authorDid: postAuthor.did, 443 + logContext, 444 + feedDescriptor: feedFeedback.feedDescriptor, 445 + }) 429 446 } 430 447 } 431 448 ··· 440 457 logger.error('Failed to unmute account', {message: e}) 441 458 Toast.show(l`There was an issue! ${e.toString()}`, 'xmark') 442 459 } 460 + } finally { 461 + ax.metric('postMenu:unmuteAccount', { 462 + uri: postUri, 463 + authorDid: postAuthor.did, 464 + logContext, 465 + feedDescriptor: feedFeedback.feedDescriptor, 466 + }) 443 467 } 444 468 } else { 445 469 try { ··· 451 475 logger.error('Failed to mute account', {message: e}) 452 476 Toast.show(l`There was an issue! ${e.toString()}`, 'xmark') 453 477 } 478 + } finally { 479 + ax.metric('postMenu:muteAccount', { 480 + uri: postUri, 481 + authorDid: postAuthor.did, 482 + logContext, 483 + feedDescriptor: feedFeedback.feedDescriptor, 484 + }) 454 485 } 455 486 } 456 487 } ··· 601 632 <Menu.Item 602 633 testID="postDropdownMuteWordsBtn" 603 634 label={l`Mute words & tags`} 604 - onPress={() => mutedWordsDialogControl.open()}> 635 + onPress={onToggleWordsAndTagsMute}> 605 636 <Menu.ItemText>{l`Mute words & tags`}</Menu.ItemText> 606 637 <Menu.ItemIcon icon={Filter} position="right" /> 607 638 </Menu.Item> ··· 784 815 subject={{ 785 816 ...post, 786 817 $type: 'app.bsky.feed.defs#postView', 818 + }} 819 + onAfterSubmit={() => { 820 + ax.metric('postMenu:reportPost', { 821 + uri: postUri, 822 + authorDid: postAuthor.did, 823 + logContext, 824 + feedDescriptor: feedFeedback.feedDescriptor, 825 + }) 787 826 }} 788 827 /> 789 828 <PostInteractionSettingsDialog
+6
src/state/queries/profile.ts
··· 417 417 export function useProfileMuteMutationQueue( 418 418 profile: Shadow<bsky.profile.AnyProfileView>, 419 419 ) { 420 + const ax = useAnalytics() 420 421 const queryClient = useQueryClient() 421 422 const did = profile.did 422 423 const initialMuted = profile.viewer?.muted ··· 430 431 await muteMutation.mutateAsync({ 431 432 did, 432 433 }) 434 + ax.metric('profile:mute', {}) 433 435 return true 434 436 } else { 435 437 await unmuteMutation.mutateAsync({ 436 438 did, 437 439 }) 440 + ax.metric('profile:unmute', {}) 438 441 return false 439 442 } 440 443 }, ··· 492 495 export function useProfileBlockMutationQueue( 493 496 profile: Shadow<bsky.profile.AnyProfileView>, 494 497 ) { 498 + const ax = useAnalytics() 495 499 const queryClient = useQueryClient() 496 500 const did = profile.did 497 501 const initialBlockingUri = profile.viewer?.blocking ··· 505 509 const {uri} = await blockMutation.mutateAsync({ 506 510 did, 507 511 }) 512 + ax.metric('profile:block', {}) 508 513 return uri 509 514 } else { 510 515 if (prevBlockUri) { ··· 512 517 did, 513 518 blockUri: prevBlockUri, 514 519 }) 520 + ax.metric('profile:unblock', {}) 515 521 } 516 522 return undefined 517 523 }