diff --git a/src/lib/statsig/events.ts b/src/lib/statsig/events.ts index b434b40f19..2de5ffb787 100644 --- a/src/lib/statsig/events.ts +++ b/src/lib/statsig/events.ts @@ -13,7 +13,7 @@ export type LogEvents = { withPassword: boolean } 'account:loggedOut': { - logContext: 'SwitchAccount' | 'Settings' | 'SignupQueued' + logContext: 'SwitchAccount' | 'Settings' | 'SignupQueued' | 'Deactivated' } 'notifications:openApp': {} 'notifications:request': { diff --git a/src/screens/Deactivated.tsx b/src/screens/Deactivated.tsx index 00121d3c56..dd75ce5df5 100644 --- a/src/screens/Deactivated.tsx +++ b/src/screens/Deactivated.tsx @@ -6,7 +6,8 @@ import {useLingui} from '@lingui/react' import {useFocusEffect} from '@react-navigation/native' import {useAccountSwitcher} from '#/lib/hooks/useAccountSwitcher' -import {type SessionAccount, useSession} from '#/state/session' +import {isWeb} from '#/platform/detection' +import {type SessionAccount, useSession, useSessionApi} from '#/state/session' import {useSetMinimalShellMode} from '#/state/shell' import {useLoggedOutViewControls} from '#/state/shell/logged-out' import {ScrollView} from '#/view/com/util/Views' @@ -30,6 +31,7 @@ export function Deactivated() { const {setShowLoggedOut} = useLoggedOutViewControls() const hasOtherAccounts = accounts.length > 1 const setMinimalShellMode = useSetMinimalShellMode() + const {logout} = useSessionApi() useFocusEffect( React.useCallback(() => { @@ -50,6 +52,18 @@ export function Deactivated() { setShowLoggedOut(true) }, [setShowLoggedOut]) + const onPressLogout = React.useCallback(() => { + if (isWeb) { + // We're switching accounts, which remounts the entire app. + // On mobile, this gets us Home, but on the web we also need reset the URL. + // We can't change the URL via a navigate() call because the navigator + // itself is about to unmount, and it calls pushState() too late. + // So we change the URL ourselves. The navigator will pick it up on remount. + history.pushState(null, '', '/') + } + logout('Deactivated') + }, [logout]) + return ( - Hello! + Welcome back! - + - You have deactivated your account, and can no longer access - Bluesky. To reactivate, click the button below. + You previously deactivated @{currentAccount?.handle}. + + + + + You can reactivate your account to continue logging in. Your + profile and posts will be visible to other users. - + + + + @@ -127,7 +158,7 @@ export function Deactivated() {