about summary refs log tree commit diff
path: root/src/lib/hooks
diff options
context:
space:
mode:
authordan <dan.abramov@gmail.com>2024-03-20 03:24:05 +0000
committerGitHub <noreply@github.com>2024-03-19 20:24:05 -0700
commit3d8d1dd1737c11d924bec7d51ae4deb6cb6336b0 (patch)
treeadb96f24141561ba4adfd818e179b0c5c0d2bff1 /src/lib/hooks
parent2e2fae378af09682370e9b4ebf59d32cae1b848c (diff)
downloadvoidsky-3d8d1dd1737c11d924bec7d51ae4deb6cb6336b0.tar.zst
[Statsig] Track login/logout (#3286)
* [Statsig] Track login/logout

* Fix missing attribution
Diffstat (limited to 'src/lib/hooks')
-rw-r--r--src/lib/hooks/useAccountSwitcher.ts8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/lib/hooks/useAccountSwitcher.ts b/src/lib/hooks/useAccountSwitcher.ts
index 74b5674d5..eb1685a0a 100644
--- a/src/lib/hooks/useAccountSwitcher.ts
+++ b/src/lib/hooks/useAccountSwitcher.ts
@@ -6,6 +6,7 @@ import {useSessionApi, SessionAccount} from '#/state/session'
 import * as Toast from '#/view/com/util/Toast'
 import {useCloseAllActiveElements} from '#/state/util'
 import {useLoggedOutViewControls} from '#/state/shell/logged-out'
+import {LogEvents} from '../statsig/statsig'
 
 export function useAccountSwitcher() {
   const {track} = useAnalytics()
@@ -14,7 +15,10 @@ export function useAccountSwitcher() {
   const {requestSwitchToAccount} = useLoggedOutViewControls()
 
   const onPressSwitchAccount = useCallback(
-    async (account: SessionAccount) => {
+    async (
+      account: SessionAccount,
+      logContext: LogEvents['account:loggedIn']['logContext'],
+    ) => {
       track('Settings:SwitchAccountButtonClicked')
 
       try {
@@ -28,7 +32,7 @@ export function useAccountSwitcher() {
             // So we change the URL ourselves. The navigator will pick it up on remount.
             history.pushState(null, '', '/')
           }
-          await selectAccount(account)
+          await selectAccount(account, logContext)
           setTimeout(() => {
             Toast.show(`Signed in as @${account.handle}`)
           }, 100)