From b7b59b0bb99d482254c5840352b9538af469598b Mon Sep 17 00:00:00 2001 From: Hailey Date: Wed, 31 Jul 2024 00:45:57 -0700 Subject: [PATCH] remove `SignupQueued` screen --- src/screens/SignupQueued.tsx | 219 ------------------ .../createNativeStackNavigatorWithAuth.tsx | 4 - 2 files changed, 223 deletions(-) delete mode 100644 src/screens/SignupQueued.tsx diff --git a/src/screens/SignupQueued.tsx b/src/screens/SignupQueued.tsx deleted file mode 100644 index 4e4fedcfae..0000000000 --- a/src/screens/SignupQueued.tsx +++ /dev/null @@ -1,219 +0,0 @@ -import React from 'react' -import {View} from 'react-native' -import {useSafeAreaInsets} from 'react-native-safe-area-context' -import {msg, plural, Trans} from '@lingui/macro' -import {useLingui} from '@lingui/react' - -import {logger} from '#/logger' -import {isWeb} from '#/platform/detection' -import {isSignupQueued, useAgent, useSessionApi} from '#/state/session' -import {useOnboardingDispatch} from '#/state/shell' -import {ScrollView} from '#/view/com/util/Views' -import {Logo} from '#/view/icons/Logo' -import {atoms as a, useBreakpoints, useTheme} from '#/alf' -import {Button, ButtonIcon, ButtonText} from '#/components/Button' -import {Loader} from '#/components/Loader' -import {P, Text} from '#/components/Typography' - -const COL_WIDTH = 400 - -export function SignupQueued() { - const {_} = useLingui() - const t = useTheme() - const insets = useSafeAreaInsets() - const {gtMobile} = useBreakpoints() - const onboardingDispatch = useOnboardingDispatch() - const {logout} = useSessionApi() - const agent = useAgent() - - const [isProcessing, setProcessing] = React.useState(false) - const [estimatedTime, setEstimatedTime] = React.useState( - undefined, - ) - const [placeInQueue, setPlaceInQueue] = React.useState( - undefined, - ) - - const checkStatus = React.useCallback(async () => { - setProcessing(true) - try { - const res = await agent.com.atproto.temp.checkSignupQueue() - if (res.data.activated) { - // ready to go, exchange the access token for a usable one and kick off onboarding - await agent.refreshSession() - if (!isSignupQueued(agent.session?.accessJwt)) { - onboardingDispatch({type: 'start'}) - } - } else { - // not ready, update UI - setEstimatedTime(msToString(res.data.estimatedTimeMs)) - if (typeof res.data.placeInQueue !== 'undefined') { - setPlaceInQueue(Math.max(res.data.placeInQueue, 1)) - } - } - } catch (e: any) { - logger.error('Failed to check signup queue', {err: e.toString()}) - } finally { - setProcessing(false) - } - }, [ - setProcessing, - setEstimatedTime, - setPlaceInQueue, - onboardingDispatch, - agent, - ]) - - React.useEffect(() => { - checkStatus() - const interval = setInterval(checkStatus, 60e3) - return () => clearInterval(interval) - }, [checkStatus]) - - const checkBtn = ( - - ) - - return ( - - - - - - - - - - You're in line - -

- - There's been a rush of new users to Bluesky! We'll activate your - account as soon as we can. - -

- - - {typeof placeInQueue === 'number' && ( - - {placeInQueue} - - )} -

- {typeof placeInQueue === 'number' ? ( - left to go. - ) : ( - You are in line. - )}{' '} - {estimatedTime ? ( - - We estimate {estimatedTime} until your account is ready. - - ) : ( - - We will let you know when your account is ready. - - )} -

-
- - {isWeb && gtMobile && ( - - - {checkBtn} - - )} -
- - - -
- - {(!isWeb || !gtMobile) && ( - - - {checkBtn} - - - - )} -
- ) -} - -function msToString(ms: number | undefined): string | undefined { - if (ms && ms > 0) { - const estimatedTimeMins = Math.ceil(ms / 60e3) - if (estimatedTimeMins > 59) { - const estimatedTimeHrs = Math.round(estimatedTimeMins / 60) - if (estimatedTimeHrs > 6) { - // dont even bother - return undefined - } - // hours - return `${estimatedTimeHrs} ${plural(estimatedTimeHrs, { - one: 'hour', - other: 'hours', - })}` - } - // minutes - return `${estimatedTimeMins} ${plural(estimatedTimeMins, { - one: 'minute', - other: 'minutes', - })}` - } - return undefined -} diff --git a/src/view/shell/createNativeStackNavigatorWithAuth.tsx b/src/view/shell/createNativeStackNavigatorWithAuth.tsx index 203e7e5077..b14cbfbba6 100644 --- a/src/view/shell/createNativeStackNavigatorWithAuth.tsx +++ b/src/view/shell/createNativeStackNavigatorWithAuth.tsx @@ -33,7 +33,6 @@ import {useGate} from 'lib/statsig/statsig' import {isNative, isWeb} from 'platform/detection' import {Deactivated} from '#/screens/Deactivated' import {Onboarding} from '#/screens/Onboarding' -import {SignupQueued} from '#/screens/SignupQueued' import {LoggedOut} from '../com/auth/LoggedOut' import {BottomBarWeb} from './bottom-bar/BottomBarWeb' import {DesktopLeftNav} from './desktop/LeftNav' @@ -110,9 +109,6 @@ function NativeStackNavigator({ ) { return } - if (hasSession && currentAccount?.signupQueued) { - return - } if (showLoggedOut) { return setShowLoggedOut(false)} /> }