Remove native_pwi_disabled (#4896)

* Remove native_pwi_disabled

* Remove search button
zio/stable
Eric Bailey 2024-08-08 12:14:02 -05:00 committed by GitHub
parent e7a0055a85
commit 3ea8eb6013
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 3 additions and 57 deletions

View File

@ -1,7 +1,6 @@
export type Gate = export type Gate =
// Keep this alphabetic please. // Keep this alphabetic please.
| 'debug_show_feedcontext' | 'debug_show_feedcontext'
| 'native_pwi_disabled'
| 'new_user_guided_tour' | 'new_user_guided_tour'
| 'onboarding_minimum_interests' | 'onboarding_minimum_interests'
| 'session_withproxy_fix' | 'session_withproxy_fix'

View File

@ -1,25 +1,20 @@
import React from 'react' import React from 'react'
import {Pressable, View} from 'react-native' import {Pressable, View} from 'react-native'
import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
import {msg, Trans} from '@lingui/macro' import {msg} from '@lingui/macro'
import {useLingui} from '@lingui/react' import {useLingui} from '@lingui/react'
import {useNavigation} from '@react-navigation/native'
import {useAnalytics} from '#/lib/analytics/analytics' import {useAnalytics} from '#/lib/analytics/analytics'
import {usePalette} from '#/lib/hooks/usePalette' import {usePalette} from '#/lib/hooks/usePalette'
import {logEvent} from '#/lib/statsig/statsig' import {logEvent} from '#/lib/statsig/statsig'
import {s} from '#/lib/styles' import {s} from '#/lib/styles'
import {isIOS, isNative} from '#/platform/detection' import {isIOS} from '#/platform/detection'
import {useSession} from '#/state/session'
import { import {
useLoggedOutView, useLoggedOutView,
useLoggedOutViewControls, useLoggedOutViewControls,
} from '#/state/shell/logged-out' } from '#/state/shell/logged-out'
import {useSetMinimalShellMode} from '#/state/shell/minimal-mode' import {useSetMinimalShellMode} from '#/state/shell/minimal-mode'
import {NavigationProp} from 'lib/routes/types'
import {useGate} from 'lib/statsig/statsig'
import {ErrorBoundary} from '#/view/com/util/ErrorBoundary' import {ErrorBoundary} from '#/view/com/util/ErrorBoundary'
import {Text} from '#/view/com/util/text/Text'
import {Login} from '#/screens/Login' import {Login} from '#/screens/Login'
import {Signup} from '#/screens/Signup' import {Signup} from '#/screens/Signup'
import {LandingScreen} from '#/screens/StarterPack/StarterPackLandingScreen' import {LandingScreen} from '#/screens/StarterPack/StarterPackLandingScreen'
@ -34,7 +29,6 @@ enum ScreenState {
export {ScreenState as LoggedOutScreenState} export {ScreenState as LoggedOutScreenState}
export function LoggedOut({onDismiss}: {onDismiss?: () => void}) { export function LoggedOut({onDismiss}: {onDismiss?: () => void}) {
const {hasSession} = useSession()
const {_} = useLingui() const {_} = useLingui()
const pal = usePalette('default') const pal = usePalette('default')
const setMinimalShellMode = useSetMinimalShellMode() const setMinimalShellMode = useSetMinimalShellMode()
@ -52,10 +46,7 @@ export function LoggedOut({onDismiss}: {onDismiss?: () => void}) {
} }
}) })
const {clearRequestedAccount} = useLoggedOutViewControls() const {clearRequestedAccount} = useLoggedOutViewControls()
const navigation = useNavigation<NavigationProp>()
const gate = useGate()
const isFirstScreen = screenState === ScreenState.S_LoginOrCreateAccount
React.useEffect(() => { React.useEffect(() => {
screen('Login') screen('Login')
setMinimalShellMode(true) setMinimalShellMode(true)
@ -68,10 +59,6 @@ export function LoggedOut({onDismiss}: {onDismiss?: () => void}) {
clearRequestedAccount() clearRequestedAccount()
}, [clearRequestedAccount, onDismiss]) }, [clearRequestedAccount, onDismiss])
const onPressSearch = React.useCallback(() => {
navigation.navigate(`SearchTab`)
}, [navigation])
return ( return (
<View testID="noSessionView" style={[s.hContentRegion, pal.view]}> <View testID="noSessionView" style={[s.hContentRegion, pal.view]}>
<ErrorBoundary> <ErrorBoundary>
@ -98,39 +85,6 @@ export function LoggedOut({onDismiss}: {onDismiss?: () => void}) {
}} }}
/> />
</Pressable> </Pressable>
) : isNative &&
!hasSession &&
isFirstScreen &&
!gate('native_pwi_disabled') ? (
<Pressable
accessibilityHint={_(msg`Search for users`)}
accessibilityLabel={_(msg`Search for users`)}
accessibilityRole="button"
style={{
flexDirection: 'row',
alignItems: 'center',
gap: 4,
position: 'absolute',
top: 20,
right: 20,
paddingHorizontal: 16,
paddingVertical: 8,
zIndex: 100,
backgroundColor: pal.btn.backgroundColor,
borderRadius: 100,
}}
onPress={onPressSearch}>
<Text type="lg-bold" style={[pal.text]}>
<Trans>Search</Trans>{' '}
</Text>
<FontAwesomeIcon
icon="search"
size={16}
style={{
color: String(pal.text.color),
}}
/>
</Pressable>
) : null} ) : null}
{screenState === ScreenState.S_StarterPack ? ( {screenState === ScreenState.S_StarterPack ? (

View File

@ -29,7 +29,6 @@ import {
useLoggedOutView, useLoggedOutView,
useLoggedOutViewControls, useLoggedOutViewControls,
} from '#/state/shell/logged-out' } from '#/state/shell/logged-out'
import {useGate} from 'lib/statsig/statsig'
import {isNative, isWeb} from 'platform/detection' import {isNative, isWeb} from 'platform/detection'
import {Deactivated} from '#/screens/Deactivated' import {Deactivated} from '#/screens/Deactivated'
import {Onboarding} from '#/screens/Onboarding' import {Onboarding} from '#/screens/Onboarding'
@ -51,7 +50,6 @@ function NativeStackNavigator({
screenOptions, screenOptions,
...rest ...rest
}: NativeStackNavigatorProps) { }: NativeStackNavigatorProps) {
const gate = useGate()
// --- this is copy and pasted from the original native stack navigator --- // --- this is copy and pasted from the original native stack navigator ---
const {state, descriptors, navigation, NavigationContent} = const {state, descriptors, navigation, NavigationContent} =
useNavigationBuilder< useNavigationBuilder<
@ -102,12 +100,7 @@ function NativeStackNavigator({
const {showLoggedOut} = useLoggedOutView() const {showLoggedOut} = useLoggedOutView()
const {setShowLoggedOut} = useLoggedOutViewControls() const {setShowLoggedOut} = useLoggedOutViewControls()
const {isMobile, isTabletOrMobile} = useWebMediaQueries() const {isMobile, isTabletOrMobile} = useWebMediaQueries()
if ( if (!hasSession && (!PWI_ENABLED || activeRouteRequiresAuth || isNative)) {
!hasSession &&
(!PWI_ENABLED ||
activeRouteRequiresAuth ||
(isNative && gate('native_pwi_disabled')))
) {
return <LoggedOut /> return <LoggedOut />
} }
if (hasSession && currentAccount?.signupQueued) { if (hasSession && currentAccount?.signupQueued) {