From afec3ee5f8afd85a950612b9ae0f253ff6025b79 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Thu, 11 Dec 2025 13:28:50 -0600 Subject: [PATCH] Move Takendown and Deactivated screens out to the shell alongside AA (#9538) (cherry picked from commit d3923c1f2e71553631de6e717055a850cf8c6098) --- .../components/NoAccessScreen.tsx | 208 +++++++++--------- src/screens/Deactivated.tsx | 9 - src/screens/Takendown.tsx | 25 +-- .../createNativeStackNavigatorWithAuth.tsx | 8 - src/view/shell/index.tsx | 25 ++- src/view/shell/index.web.tsx | 26 ++- 6 files changed, 152 insertions(+), 149 deletions(-) diff --git a/src/ageAssurance/components/NoAccessScreen.tsx b/src/ageAssurance/components/NoAccessScreen.tsx index 316758ed13..a8667bf0c5 100644 --- a/src/ageAssurance/components/NoAccessScreen.tsx +++ b/src/ageAssurance/components/NoAccessScreen.tsx @@ -122,123 +122,127 @@ export function NoAccessScreen() { return ( <> - - + - - - + + + + - {hasDeclaredAge ? ( - <> - {isAARegion ? ( - <> + {hasDeclaredAge ? ( + <> + {isAARegion ? ( + <> + + + Hey there! + + + + You are accessing Bluesky from a region that legally + requires us to verify your age before allowing you to + access the app. + + + + {!isBlocked && birthdateUpdateText} + + + + + ) : ( - - Hey there! - - You are accessing Bluesky from a region that legally - requires us to verify your age before allowing you to - access the app. + Unfortunately, the birthdate you have saved to your + profile makes you too young to access Bluesky. - {!isBlocked && birthdateUpdateText} + {birthdateUpdateText} - - - - ) : ( - - - - Unfortunately, the birthdate you have saved to your - profile makes you too young to access Bluesky. - - - - {birthdateUpdateText} - - )} - - ) : ( - - - Hi there! - - - - In order to provide an age-appropriate experience, we need to - know your birthdate. This is a one-time thing, and your data - will be kept private. - - - - - Set your birthdate below and we'll get you back to posting and - exploring in no time! - - - - - {isUsingAppPassword && ( - + )} + + ) : ( + + + Hi there! + + - Hmm, it looks like you're logged in with an{' '} - App Password. To set your - birthdate, you'll need to log in with your main account - password, or ask whomever controls this account to do so. + In order to provide an age-appropriate experience, we need + to know your birthdate. This is a one-time thing, and your + data will be kept private. - - )} - - )} + + + + Set your birthdate below and we'll get you back to posting + and exploring in no time! + + + - - - - - To log out,{' '} - { - onPressLogout() - })}> - click here - - . - - + {isUsingAppPassword && ( + + + Hmm, it looks like you're logged in with an{' '} + App Password. To set your + birthdate, you'll need to log in with your main account + password, or ask whomever controls this account to do so. + + + )} + + )} + + + + + + To log out,{' '} + { + onPressLogout() + })}> + click here + + . + + + - - + + diff --git a/src/screens/Deactivated.tsx b/src/screens/Deactivated.tsx index 334b503f4b..fd07811a75 100644 --- a/src/screens/Deactivated.tsx +++ b/src/screens/Deactivated.tsx @@ -3,7 +3,6 @@ import {View} from 'react-native' import {useSafeAreaInsets} from 'react-native-safe-area-context' import {msg, Trans} from '@lingui/macro' import {useLingui} from '@lingui/react' -import {useFocusEffect} from '@react-navigation/native' import {useQueryClient} from '@tanstack/react-query' import {useAccountSwitcher} from '#/lib/hooks/useAccountSwitcher' @@ -15,7 +14,6 @@ import { useSession, useSessionApi, } from '#/state/session' -import {useSetMinimalShellMode} from '#/state/shell' import {useLoggedOutViewControls} from '#/state/shell/logged-out' import {Logo} from '#/view/icons/Logo' import {atoms as a, useTheme} from '#/alf' @@ -37,19 +35,12 @@ export function Deactivated() { const {onPressSwitchAccount, pendingDid} = useAccountSwitcher() const {setShowLoggedOut} = useLoggedOutViewControls() const hasOtherAccounts = accounts.length > 1 - const setMinimalShellMode = useSetMinimalShellMode() const {logoutCurrentAccount} = useSessionApi() const agent = useAgent() const [pending, setPending] = React.useState(false) const [error, setError] = React.useState() const queryClient = useQueryClient() - useFocusEffect( - React.useCallback(() => { - setMinimalShellMode(true) - }, [setMinimalShellMode]), - ) - const onSelectAccount = React.useCallback( (account: SessionAccount) => { if (account.did !== currentAccount?.did) { diff --git a/src/screens/Takendown.tsx b/src/screens/Takendown.tsx index dd319a4c62..77f219e55d 100644 --- a/src/screens/Takendown.tsx +++ b/src/screens/Takendown.tsx @@ -1,6 +1,5 @@ import {useMemo, useState} from 'react' -import {Modal, View} from 'react-native' -import {SystemBars} from 'react-native-edge-to-edge' +import {View} from 'react-native' import {KeyboardAwareScrollView} from 'react-native-keyboard-controller' import {useSafeAreaInsets} from 'react-native-safe-area-context' import {type ComAtprotoAdminDefs, ToolsOzoneReportDefs} from '@atproto/api' @@ -15,14 +14,14 @@ import { } from '#/lib/constants' import {useEnableKeyboardController} from '#/lib/hooks/useEnableKeyboardController' import {cleanError} from '#/lib/strings/errors' -import {isIOS, isWeb} from '#/platform/detection' +import {isWeb} from '#/platform/detection' import {useAgent, useSession, useSessionApi} from '#/state/session' import {CharProgress} from '#/view/com/composer/char-progress/CharProgress' import {Logo} from '#/view/icons/Logo' -import {atoms as a, native, useBreakpoints, useTheme, web} from '#/alf' +import {atoms as a, useBreakpoints, useTheme} from '#/alf' import {Button, ButtonIcon, ButtonText} from '#/components/Button' import * as TextField from '#/components/forms/TextField' -import {InlineLinkText} from '#/components/Link' +import {SimpleInlineLinkText} from '#/components/Link' import {Loader} from '#/components/Loader' import {P, Text} from '#/components/Typography' @@ -130,12 +129,7 @@ export function Takendown() { useEnableKeyboardController(true) return ( - - {isIOS && } + Your account was found to be in violation of the{' '} - + style={[a.text_md, a.leading_normal]}> Bluesky Social Terms of Service - + . You have been sent an email outlining the specific violation and suspension period, if applicable. You can appeal this decision if you believe it was made in error. @@ -267,6 +260,6 @@ export function Takendown() { )} - + ) } diff --git a/src/view/shell/createNativeStackNavigatorWithAuth.tsx b/src/view/shell/createNativeStackNavigatorWithAuth.tsx index bb022a0134..075c1e1812 100644 --- a/src/view/shell/createNativeStackNavigatorWithAuth.tsx +++ b/src/view/shell/createNativeStackNavigatorWithAuth.tsx @@ -35,10 +35,8 @@ import { useLoggedOutViewControls, } from '#/state/shell/logged-out' import {LoggedOut} from '#/view/com/auth/LoggedOut' -import {Deactivated} from '#/screens/Deactivated' import {Onboarding} from '#/screens/Onboarding' import {SignupQueued} from '#/screens/SignupQueued' -import {Takendown} from '#/screens/Takendown' import {atoms as a, useLayoutBreakpoints} from '#/alf' import {PolicyUpdateOverlay} from '#/components/PolicyUpdateOverlay' import {BottomBarWeb} from './bottom-bar/BottomBarWeb' @@ -119,15 +117,9 @@ function NativeStackNavigator({ if (hasSession && currentAccount?.signupQueued) { return } - if (hasSession && currentAccount?.status === 'takendown') { - return - } if (showLoggedOut) { return setShowLoggedOut(false)} /> } - if (currentAccount?.status === 'deactivated') { - return - } if (onboardingState.isActive) { return } diff --git a/src/view/shell/index.tsx b/src/view/shell/index.tsx index c12141adb2..f27c982cb1 100644 --- a/src/view/shell/index.tsx +++ b/src/view/shell/index.tsx @@ -23,6 +23,8 @@ import {useCloseAnyActiveElement} from '#/state/util' import {Lightbox} from '#/view/com/lightbox/Lightbox' import {ModalsContainer} from '#/view/com/modals/Modal' import {ErrorBoundary} from '#/view/com/util/ErrorBoundary' +import {Deactivated} from '#/screens/Deactivated' +import {Takendown} from '#/screens/Takendown' import {atoms as a, select, useTheme} from '#/alf' import {setSystemUITheme} from '#/alf/util/systemUI' import {AgeAssuranceRedirectDialog} from '#/components/ageAssurance/AgeAssuranceRedirectDialog' @@ -195,6 +197,7 @@ function DrawerLayout({children}: {children: React.ReactNode}) { export function Shell() { const t = useTheme() const aa = useAgeAssurance() + const {currentAccount} = useSession() const fullyExpandedCount = useDialogFullyExpandedCountContext() useIntentHandler() @@ -214,15 +217,23 @@ export function Shell() { navigationBar: t.name !== 'light' ? 'light' : 'dark', }} /> - {aa.state.access === aa.Access.None ? ( - + {currentAccount?.status === 'takendown' ? ( + + ) : currentAccount?.status === 'deactivated' ? ( + ) : ( - - - - )} + <> + {aa.state.access === aa.Access.None ? ( + + ) : ( + + + + )} - + + + )} ) } diff --git a/src/view/shell/index.web.tsx b/src/view/shell/index.web.tsx index 7fd5155ca3..a37b68032b 100644 --- a/src/view/shell/index.web.tsx +++ b/src/view/shell/index.web.tsx @@ -8,12 +8,15 @@ import {RemoveScrollBar} from 'react-remove-scroll-bar' import {useIntentHandler} from '#/lib/hooks/useIntentHandler' import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries' import {type NavigationProp} from '#/lib/routes/types' +import {useSession} from '#/state/session' import {useIsDrawerOpen, useSetDrawerOpen} from '#/state/shell' import {useComposerKeyboardShortcut} from '#/state/shell/composer/useComposerKeyboardShortcut' import {useCloseAllActiveElements} from '#/state/util' import {Lightbox} from '#/view/com/lightbox/Lightbox' import {ModalsContainer} from '#/view/com/modals/Modal' import {ErrorBoundary} from '#/view/com/util/ErrorBoundary' +import {Deactivated} from '#/screens/Deactivated' +import {Takendown} from '#/screens/Takendown' import {atoms as a, select, useTheme} from '#/alf' import {AgeAssuranceRedirectDialog} from '#/components/ageAssurance/AgeAssuranceRedirectDialog' import {EmailDialog} from '#/components/dialogs/EmailDialog' @@ -141,17 +144,26 @@ function ShellInner() { export function Shell() { const t = useTheme() const aa = useAgeAssurance() + const {currentAccount} = useSession() return ( - {aa.state.access === aa.Access.None ? ( - + {currentAccount?.status === 'takendown' ? ( + + ) : currentAccount?.status === 'deactivated' ? ( + ) : ( - - - - )} + <> + {aa.state.access === aa.Access.None ? ( + + ) : ( + + + + )} - + + + )} ) }