Skip to content

Commit

Permalink
Add events
Browse files Browse the repository at this point in the history
  • Loading branch information
estrattonbailey committed Sep 13, 2024
1 parent c723153 commit 08ac3a2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/components/dialogs/nuxs/TenMillion/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {useLingui} from '@lingui/react'
import {networkRetry} from '#/lib/async/retry'
import {getCanvas} from '#/lib/canvas'
import {shareUrl} from '#/lib/sharing'
import {logEvent} from '#/lib/statsig/statsig'
import {sanitizeDisplayName} from '#/lib/strings/display-names'
import {sanitizeHandle} from '#/lib/strings/handles'
import {isIOS, isNative} from '#/platform/detection'
Expand Down Expand Up @@ -199,6 +200,7 @@ export function TenMillionInner({userNumber}: {userNumber: number}) {
if (uri) {
control.close(() => {
setTimeout(() => {
logEvent('tmd:post', {})
openComposer({
text: _(
msg`Bluesky now has over 10 million users, and I was #${i18n.number(
Expand All @@ -220,6 +222,7 @@ export function TenMillionInner({userNumber}: {userNumber: number}) {
const onNativeShare = React.useCallback(() => {
if (uri) {
control.close(() => {
logEvent('tmd:share', {})
shareUrl(uri)
})
}
Expand All @@ -240,6 +243,7 @@ export function TenMillionInner({userNumber}: {userNumber: number}) {

try {
await MediaLibrary.createAssetAsync(uri)
logEvent('tmd:download', {})
Toast.show(_(msg`Image saved to your camera roll!`))
} catch (e: unknown) {
console.log(e)
Expand All @@ -258,6 +262,7 @@ export function TenMillionInner({userNumber}: {userNumber: number}) {
link.setAttribute('download', `Bluesky 10M Users.png`)
link.setAttribute('href', imgHref)
link.click()
logEvent('tmd:download', {})
}
}, [uri])

Expand Down
4 changes: 4 additions & 0 deletions src/lib/statsig/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,4 +225,8 @@ export type LogEvents = {
'test:gate1:sometimes': {}
'test:gate2:always': {}
'test:gate2:sometimes': {}

'tmd:share': {}
'tmd:download': {}
'tmd:post': {}
}

0 comments on commit 08ac3a2

Please sign in to comment.