Handle pressing all go.bsky.app links in-app w/ resolution (#4680)

This commit is contained in:
Hailey 2024-06-27 19:35:20 -07:00 committed by GitHub
parent 030c8e268e
commit 91c4aa7c2d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 186 additions and 17 deletions

View file

@ -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<State>({
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<Controls>(
() => ({
setShowLoggedOut(show) {