Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

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

add reason to log (#8381)

authored by

hailey and committed by
GitHub
4ef7a6b6 f3bc9624

+13 -6
+9 -5
src/lib/hooks/useNotificationHandler.ts
··· 5 5 6 6 import {useAccountSwitcher} from '#/lib/hooks/useAccountSwitcher' 7 7 import {type NavigationProp} from '#/lib/routes/types' 8 - import {logEvent} from '#/lib/statsig/statsig' 9 8 import {Logger} from '#/logger' 10 9 import {isAndroid} from '#/platform/detection' 11 10 import {useCurrentConvoId} from '#/state/messages/current-convo-id' ··· 17 16 import {useCloseAllActiveElements} from '#/state/util' 18 17 import {resetToTab} from '#/Navigation' 19 18 20 - type NotificationReason = 19 + export type NotificationReason = 21 20 | 'like' 22 21 | 'repost' 23 22 | 'follow' ··· 229 228 'type' in e.notification.request.trigger && 230 229 e.notification.request.trigger.type === 'push' 231 230 ) { 231 + const payload = e.notification.request.trigger 232 + .payload as NotificationPayload 233 + 232 234 logger.debug( 233 235 'User pressed a notification, opening notifications tab', 234 236 {}, 235 237 ) 236 - logEvent('notifications:openApp', {}) 238 + logger.metric('notifications:openApp', {reason: payload.reason}) 239 + 237 240 invalidateCachedUnreadPage() 238 - const payload = e.notification.request.trigger 239 - .payload as NotificationPayload 240 241 truncateAndInvalidate(queryClient, RQKEY_NOTIFS('all')) 242 + 241 243 if ( 242 244 payload.reason === 'mention' || 243 245 payload.reason === 'quote' || ··· 245 247 ) { 246 248 truncateAndInvalidate(queryClient, RQKEY_NOTIFS('mentions')) 247 249 } 250 + 248 251 logger.debug('Notifications: handleNotification', { 249 252 content: e.notification.request.content, 250 253 payload: e.notification.request.trigger.payload, 251 254 }) 255 + 252 256 handleNotification(payload) 253 257 Notifications.dismissAllNotificationsAsync() 254 258 }
+4 -1
src/logger/metrics.ts
··· 1 + import {type NotificationReason} from '#/lib/hooks/useNotificationHandler' 1 2 import {type FeedDescriptor} from '#/state/queries/post-feed' 2 3 3 4 export type MetricEvents = { ··· 23 24 | 'Takendown' 24 25 scope: 'current' | 'every' 25 26 } 26 - 'notifications:openApp': {} 27 + 'notifications:openApp': { 28 + reason: NotificationReason 29 + } 27 30 'notifications:request': { 28 31 context: 'StartOnboarding' | 'AfterOnboarding' | 'Login' | 'Home' 29 32 status: 'granted' | 'denied' | 'undetermined'