attempt to gate
This commit is contained in:
+53
-49
@@ -40,7 +40,7 @@ import {
|
|||||||
type SearchTabNavigatorParams,
|
type SearchTabNavigatorParams,
|
||||||
} from '#/lib/routes/types'
|
} from '#/lib/routes/types'
|
||||||
import {type RouteParams, type State} from '#/lib/routes/types'
|
import {type RouteParams, type State} from '#/lib/routes/types'
|
||||||
import {attachRouteToLogEvents, logEvent} from '#/lib/statsig/statsig'
|
import {attachRouteToLogEvents, logEvent, useGate} from '#/lib/statsig/statsig'
|
||||||
import {bskyTitle} from '#/lib/strings/headings'
|
import {bskyTitle} from '#/lib/strings/headings'
|
||||||
import {logger} from '#/logger'
|
import {logger} from '#/logger'
|
||||||
import {isNative, isWeb} from '#/platform/detection'
|
import {isNative, isWeb} from '#/platform/detection'
|
||||||
@@ -149,7 +149,6 @@ import {useNonReactiveCallback} from './lib/hooks/useNonReactiveCallback'
|
|||||||
import {useLoggedOutViewControls} from './state/shell/logged-out'
|
import {useLoggedOutViewControls} from './state/shell/logged-out'
|
||||||
import {useLoggedOutView} from './state/shell/logged-out'
|
import {useLoggedOutView} from './state/shell/logged-out'
|
||||||
import {useCloseAllActiveElements} from './state/util'
|
import {useCloseAllActiveElements} from './state/util'
|
||||||
import {AuthModal} from './view/shell/desktop/AuthLayout'
|
|
||||||
|
|
||||||
const navigationRef = createNavigationContainerRef<AllNavigatorParams>()
|
const navigationRef = createNavigationContainerRef<AllNavigatorParams>()
|
||||||
|
|
||||||
@@ -789,63 +788,68 @@ const FlatNavigator = () => {
|
|||||||
*/
|
*/
|
||||||
export const NativeNavigator = () => {
|
export const NativeNavigator = () => {
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
|
const gate = useGate()
|
||||||
const {hasSession} = useSession()
|
const {hasSession} = useSession()
|
||||||
const {showLoggedOut} = useLoggedOutView()
|
const {showLoggedOut} = useLoggedOutView()
|
||||||
|
|
||||||
return (
|
if (gate('new_auth_flow')) {
|
||||||
<Core.Navigator screenOptions={screenOptions(t)}>
|
return (
|
||||||
{hasSession && !showLoggedOut ? (
|
<Core.Navigator screenOptions={screenOptions(t)}>
|
||||||
<Core.Screen
|
{hasSession && !showLoggedOut ? (
|
||||||
name="App"
|
|
||||||
getComponent={() => TabsNavigator}
|
|
||||||
options={{animation: 'fade', animationDuration: 200}}
|
|
||||||
/>
|
|
||||||
) : (
|
|
||||||
<>
|
|
||||||
<Core.Screen
|
<Core.Screen
|
||||||
name="Landing"
|
name="App"
|
||||||
getComponent={() => LandingScreen}
|
getComponent={() => TabsNavigator}
|
||||||
options={{animation: 'fade', animationDuration: 200}}
|
options={{animation: 'fade', animationDuration: 200}}
|
||||||
/>
|
/>
|
||||||
<Core.Screen
|
) : (
|
||||||
name="StarterPackLanding"
|
<>
|
||||||
getComponent={() => StarterPackLandingScreen}
|
|
||||||
/>
|
|
||||||
<Core.Group>
|
|
||||||
<Core.Screen
|
<Core.Screen
|
||||||
name="SelectAccount"
|
name="Landing"
|
||||||
getComponent={() => SelectAccountScreen}
|
getComponent={() => LandingScreen}
|
||||||
/>
|
options={{animation: 'fade', animationDuration: 200}}
|
||||||
<Core.Screen name="SignIn" getComponent={() => SignInScreen} />
|
|
||||||
<Core.Screen
|
|
||||||
name="ForgotPassword"
|
|
||||||
getComponent={() => ForgotPasswordScreen}
|
|
||||||
/>
|
/>
|
||||||
<Core.Screen
|
<Core.Screen
|
||||||
name="SetNewPassword"
|
name="StarterPackLanding"
|
||||||
getComponent={() => SetNewPasswordScreen}
|
getComponent={() => StarterPackLandingScreen}
|
||||||
/>
|
/>
|
||||||
<Core.Screen
|
<Core.Group>
|
||||||
name="PasswordUpdated"
|
<Core.Screen
|
||||||
getComponent={() => PasswordUpdatedScreen}
|
name="SelectAccount"
|
||||||
/>
|
getComponent={() => SelectAccountScreen}
|
||||||
<Core.Screen
|
/>
|
||||||
name="SignUpInfo"
|
<Core.Screen name="SignIn" getComponent={() => SignInScreen} />
|
||||||
getComponent={() => SignUpInfoScreen}
|
<Core.Screen
|
||||||
/>
|
name="ForgotPassword"
|
||||||
<Core.Screen
|
getComponent={() => ForgotPasswordScreen}
|
||||||
name="SignUpHandle"
|
/>
|
||||||
getComponent={() => SignUpHandleScreen}
|
<Core.Screen
|
||||||
/>
|
name="SetNewPassword"
|
||||||
<Core.Screen
|
getComponent={() => SetNewPasswordScreen}
|
||||||
name="SignUpCaptcha"
|
/>
|
||||||
getComponent={() => SignUpCaptchaScreen}
|
<Core.Screen
|
||||||
/>
|
name="PasswordUpdated"
|
||||||
</Core.Group>
|
getComponent={() => PasswordUpdatedScreen}
|
||||||
</>
|
/>
|
||||||
)}
|
<Core.Screen
|
||||||
</Core.Navigator>
|
name="SignUpInfo"
|
||||||
)
|
getComponent={() => SignUpInfoScreen}
|
||||||
|
/>
|
||||||
|
<Core.Screen
|
||||||
|
name="SignUpHandle"
|
||||||
|
getComponent={() => SignUpHandleScreen}
|
||||||
|
/>
|
||||||
|
<Core.Screen
|
||||||
|
name="SignUpCaptcha"
|
||||||
|
getComponent={() => SignUpCaptchaScreen}
|
||||||
|
/>
|
||||||
|
</Core.Group>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</Core.Navigator>
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
return <TabsNavigator />
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ export type Gate =
|
|||||||
| 'debug_show_feedcontext'
|
| 'debug_show_feedcontext'
|
||||||
| 'debug_subscriptions'
|
| 'debug_subscriptions'
|
||||||
| 'explore_show_suggested_feeds'
|
| 'explore_show_suggested_feeds'
|
||||||
|
| 'new_auth_flow'
|
||||||
| 'old_postonboarding'
|
| 'old_postonboarding'
|
||||||
| 'onboarding_add_video_feed'
|
| 'onboarding_add_video_feed'
|
||||||
| 'post_threads_v2_unspecced'
|
| 'post_threads_v2_unspecced'
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import {
|
|||||||
|
|
||||||
import {PWI_ENABLED} from '#/lib/build-flags'
|
import {PWI_ENABLED} from '#/lib/build-flags'
|
||||||
import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries'
|
import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries'
|
||||||
|
import {useGate} from '#/lib/statsig/statsig'
|
||||||
import {isWeb} from '#/platform/detection'
|
import {isWeb} from '#/platform/detection'
|
||||||
import {useSession} from '#/state/session'
|
import {useSession} from '#/state/session'
|
||||||
import {useOnboardingState} from '#/state/shell'
|
import {useOnboardingState} from '#/state/shell'
|
||||||
@@ -34,6 +35,7 @@ import {
|
|||||||
useLoggedOutView,
|
useLoggedOutView,
|
||||||
useLoggedOutViewControls,
|
useLoggedOutViewControls,
|
||||||
} from '#/state/shell/logged-out'
|
} from '#/state/shell/logged-out'
|
||||||
|
import {LoggedOut} from '#/view/com/auth/LoggedOut'
|
||||||
import {AuthenticationFlow} from '#/screens/Authentication/components/Flow'
|
import {AuthenticationFlow} from '#/screens/Authentication/components/Flow'
|
||||||
import {Deactivated} from '#/screens/Deactivated'
|
import {Deactivated} from '#/screens/Deactivated'
|
||||||
import {Onboarding} from '#/screens/Onboarding'
|
import {Onboarding} from '#/screens/Onboarding'
|
||||||
@@ -112,9 +114,17 @@ function NativeStackNavigator({
|
|||||||
const {setShowLoggedOut} = useLoggedOutViewControls()
|
const {setShowLoggedOut} = useLoggedOutViewControls()
|
||||||
const {isMobile} = useWebMediaQueries()
|
const {isMobile} = useWebMediaQueries()
|
||||||
const {leftNavMinimal} = useLayoutBreakpoints()
|
const {leftNavMinimal} = useLayoutBreakpoints()
|
||||||
// Temp: use old system for web. TODO: unify
|
const gate = useGate()
|
||||||
if (isWeb && !hasSession && (!PWI_ENABLED || activeRouteRequiresAuth)) {
|
|
||||||
return <AuthenticationFlow />
|
if (!hasSession && (!PWI_ENABLED || activeRouteRequiresAuth)) {
|
||||||
|
if (gate('new_auth_flow')) {
|
||||||
|
// I don't like how we have to split it like this, would prefer something neater
|
||||||
|
if (isWeb) {
|
||||||
|
return <AuthenticationFlow />
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return <LoggedOut />
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (hasSession && currentAccount?.signupQueued) {
|
if (hasSession && currentAccount?.signupQueued) {
|
||||||
return <SignupQueued />
|
return <SignupQueued />
|
||||||
@@ -122,8 +132,14 @@ function NativeStackNavigator({
|
|||||||
if (hasSession && currentAccount?.status === 'takendown') {
|
if (hasSession && currentAccount?.status === 'takendown') {
|
||||||
return <Takendown />
|
return <Takendown />
|
||||||
}
|
}
|
||||||
if (isWeb && showLoggedOut) {
|
if (showLoggedOut) {
|
||||||
return <AuthenticationFlow onDismiss={() => setShowLoggedOut(false)} />
|
if (gate('new_auth_flow')) {
|
||||||
|
if (isWeb) {
|
||||||
|
return <AuthenticationFlow onDismiss={() => setShowLoggedOut(false)} />
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return <LoggedOut onDismiss={() => setShowLoggedOut(false)} />
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (currentAccount?.status === 'deactivated') {
|
if (currentAccount?.status === 'deactivated') {
|
||||||
return <Deactivated />
|
return <Deactivated />
|
||||||
|
|||||||
Reference in New Issue
Block a user