From 91c4aa7c2dc598dd5e2c828e44c0d2c94cf0967d Mon Sep 17 00:00:00 2001 From: Hailey Date: Thu, 27 Jun 2024 19:35:20 -0700 Subject: Handle pressing all go.bsky.app links in-app w/ resolution (#4680) --- src/state/shell/logged-out.tsx | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/state/shell/logged-out.tsx') diff --git a/src/state/shell/logged-out.tsx b/src/state/shell/logged-out.tsx index dc78d03d5..2c577fdd2 100644 --- a/src/state/shell/logged-out.tsx +++ b/src/state/shell/logged-out.tsx @@ -50,6 +50,7 @@ export function Provider({children}: React.PropsWithChildren<{}>) { const activeStarterPack = useActiveStarterPack() const {hasSession} = useSession() const shouldShowStarterPack = Boolean(activeStarterPack?.uri) && !hasSession + const [state, setState] = React.useState({ showLoggedOut: shouldShowStarterPack, requestedAccountSwitchTo: shouldShowStarterPack @@ -59,6 +60,25 @@ export function Provider({children}: React.PropsWithChildren<{}>) { : undefined, }) + const [prevActiveStarterPack, setPrevActiveStarterPack] = + React.useState(activeStarterPack) + if (activeStarterPack?.uri !== prevActiveStarterPack?.uri) { + setPrevActiveStarterPack(activeStarterPack) + if (activeStarterPack) { + setState(s => ({ + ...s, + showLoggedOut: true, + requestedAccountSwitchTo: 'starterpack', + })) + } else { + setState(s => ({ + ...s, + showLoggedOut: false, + requestedAccountSwitchTo: undefined, + })) + } + } + const controls = React.useMemo( () => ({ setShowLoggedOut(show) { -- cgit 1.4.1