Add events

zio/dev^2
Eric Bailey 2024-09-13 12:05:15 -05:00
parent c7231537f1
commit 08ac3a27c2
2 changed files with 9 additions and 0 deletions

View File

@ -12,6 +12,7 @@ import {useLingui} from '@lingui/react'
import {networkRetry} from '#/lib/async/retry' import {networkRetry} from '#/lib/async/retry'
import {getCanvas} from '#/lib/canvas' import {getCanvas} from '#/lib/canvas'
import {shareUrl} from '#/lib/sharing' import {shareUrl} from '#/lib/sharing'
import {logEvent} from '#/lib/statsig/statsig'
import {sanitizeDisplayName} from '#/lib/strings/display-names' import {sanitizeDisplayName} from '#/lib/strings/display-names'
import {sanitizeHandle} from '#/lib/strings/handles' import {sanitizeHandle} from '#/lib/strings/handles'
import {isIOS, isNative} from '#/platform/detection' import {isIOS, isNative} from '#/platform/detection'
@ -199,6 +200,7 @@ export function TenMillionInner({userNumber}: {userNumber: number}) {
if (uri) { if (uri) {
control.close(() => { control.close(() => {
setTimeout(() => { setTimeout(() => {
logEvent('tmd:post', {})
openComposer({ openComposer({
text: _( text: _(
msg`Bluesky now has over 10 million users, and I was #${i18n.number( msg`Bluesky now has over 10 million users, and I was #${i18n.number(
@ -220,6 +222,7 @@ export function TenMillionInner({userNumber}: {userNumber: number}) {
const onNativeShare = React.useCallback(() => { const onNativeShare = React.useCallback(() => {
if (uri) { if (uri) {
control.close(() => { control.close(() => {
logEvent('tmd:share', {})
shareUrl(uri) shareUrl(uri)
}) })
} }
@ -240,6 +243,7 @@ export function TenMillionInner({userNumber}: {userNumber: number}) {
try { try {
await MediaLibrary.createAssetAsync(uri) await MediaLibrary.createAssetAsync(uri)
logEvent('tmd:download', {})
Toast.show(_(msg`Image saved to your camera roll!`)) Toast.show(_(msg`Image saved to your camera roll!`))
} catch (e: unknown) { } catch (e: unknown) {
console.log(e) console.log(e)
@ -258,6 +262,7 @@ export function TenMillionInner({userNumber}: {userNumber: number}) {
link.setAttribute('download', `Bluesky 10M Users.png`) link.setAttribute('download', `Bluesky 10M Users.png`)
link.setAttribute('href', imgHref) link.setAttribute('href', imgHref)
link.click() link.click()
logEvent('tmd:download', {})
} }
}, [uri]) }, [uri])

View File

@ -225,4 +225,8 @@ export type LogEvents = {
'test:gate1:sometimes': {} 'test:gate1:sometimes': {}
'test:gate2:always': {} 'test:gate2:always': {}
'test:gate2:sometimes': {} 'test:gate2:sometimes': {}
'tmd:share': {}
'tmd:download': {}
'tmd:post': {}
} }