Move metric to try body

This commit is contained in:
Eric Bailey
2025-03-06 14:08:21 -06:00
parent da1949b256
commit 5ee3c49cd2
+20 -24
View File
@@ -393,76 +393,72 @@ function Header({
try { try {
await listMuteMutation.mutateAsync({uri: list.uri, mute: true}) await listMuteMutation.mutateAsync({uri: list.uri, mute: true})
Toast.show(_(msg({message: 'List muted', context: 'toast'}))) Toast.show(_(msg({message: 'List muted', context: 'toast'})))
logger.metric(
'moderation:subscribedToList',
{listType: 'mute'},
{statsig: true},
)
} catch { } catch {
Toast.show( Toast.show(
_( _(
msg`There was an issue. Please check your internet connection and try again.`, msg`There was an issue. Please check your internet connection and try again.`,
), ),
) )
return
} }
logger.metric(
'moderation:subscribedToList',
{listType: 'mute'},
{statsig: true},
)
}, [list, listMuteMutation, _]) }, [list, listMuteMutation, _])
const onUnsubscribeMute = useCallback(async () => { const onUnsubscribeMute = useCallback(async () => {
try { try {
await listMuteMutation.mutateAsync({uri: list.uri, mute: false}) await listMuteMutation.mutateAsync({uri: list.uri, mute: false})
Toast.show(_(msg({message: 'List unmuted', context: 'toast'}))) Toast.show(_(msg({message: 'List unmuted', context: 'toast'})))
logger.metric(
'moderation:unsubscribedFromList',
{listType: 'mute'},
{statsig: true},
)
} catch { } catch {
Toast.show( Toast.show(
_( _(
msg`There was an issue. Please check your internet connection and try again.`, msg`There was an issue. Please check your internet connection and try again.`,
), ),
) )
return
} }
logger.metric(
'moderation:unsubscribedFromList',
{listType: 'mute'},
{statsig: true},
)
}, [list, listMuteMutation, _]) }, [list, listMuteMutation, _])
const onSubscribeBlock = useCallback(async () => { const onSubscribeBlock = useCallback(async () => {
try { try {
await listBlockMutation.mutateAsync({uri: list.uri, block: true}) await listBlockMutation.mutateAsync({uri: list.uri, block: true})
Toast.show(_(msg({message: 'List blocked', context: 'toast'}))) Toast.show(_(msg({message: 'List blocked', context: 'toast'})))
logger.metric(
'moderation:subscribedToList',
{listType: 'block'},
{statsig: true},
)
} catch { } catch {
Toast.show( Toast.show(
_( _(
msg`There was an issue. Please check your internet connection and try again.`, msg`There was an issue. Please check your internet connection and try again.`,
), ),
) )
return
} }
logger.metric(
'moderation:subscribedToList',
{listType: 'block'},
{statsig: true},
)
}, [list, listBlockMutation, _]) }, [list, listBlockMutation, _])
const onUnsubscribeBlock = useCallback(async () => { const onUnsubscribeBlock = useCallback(async () => {
try { try {
await listBlockMutation.mutateAsync({uri: list.uri, block: false}) await listBlockMutation.mutateAsync({uri: list.uri, block: false})
Toast.show(_(msg({message: 'List unblocked', context: 'toast'}))) Toast.show(_(msg({message: 'List unblocked', context: 'toast'})))
logger.metric(
'moderation:unsubscribedFromList',
{listType: 'block'},
{statsig: true},
)
} catch { } catch {
Toast.show( Toast.show(
_( _(
msg`There was an issue. Please check your internet connection and try again.`, msg`There was an issue. Please check your internet connection and try again.`,
), ),
) )
return
} }
logger.metric(
'moderation:unsubscribedFromList',
{listType: 'block'},
{statsig: true},
)
}, [list, listBlockMutation, _]) }, [list, listBlockMutation, _])
const onPressEdit = useCallback(() => { const onPressEdit = useCallback(() => {