remove DMs gate (#4112)

zio/stable
Samuel Newman 2024-05-21 01:29:22 +01:00 committed by GitHub
parent a7b0242cc8
commit 4a7436886d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 41 additions and 152 deletions

View File

@ -3,7 +3,6 @@ export type Gate =
| 'autoexpand_suggestions_on_profile_follow_v2' | 'autoexpand_suggestions_on_profile_follow_v2'
| 'disable_min_shell_on_foregrounding_v3' | 'disable_min_shell_on_foregrounding_v3'
| 'disable_poll_on_discover_v2' | 'disable_poll_on_discover_v2'
| 'dms'
| 'reduced_onboarding_and_home_algo_v2' | 'reduced_onboarding_and_home_algo_v2'
| 'request_notifications_permission_after_onboarding' | 'request_notifications_permission_after_onboarding'
| 'show_follow_back_label_v2' | 'show_follow_back_label_v2'

View File

@ -7,7 +7,6 @@ import {useFocusEffect} from '@react-navigation/native'
import {NativeStackScreenProps} from '@react-navigation/native-stack' import {NativeStackScreenProps} from '@react-navigation/native-stack'
import {CommonNavigatorParams} from '#/lib/routes/types' import {CommonNavigatorParams} from '#/lib/routes/types'
import {useGate} from '#/lib/statsig/statsig'
import {useCurrentConvoId} from '#/state/messages/current-convo-id' import {useCurrentConvoId} from '#/state/messages/current-convo-id'
import {useModerationOpts} from '#/state/preferences/moderation-opts' import {useModerationOpts} from '#/state/preferences/moderation-opts'
import {useProfileQuery} from '#/state/queries/profile' import {useProfileQuery} from '#/state/queries/profile'
@ -23,14 +22,12 @@ import {MessagesListBlockedFooter} from '#/components/dms/MessagesListBlockedFoo
import {MessagesListHeader} from '#/components/dms/MessagesListHeader' import {MessagesListHeader} from '#/components/dms/MessagesListHeader'
import {Error} from '#/components/Error' import {Error} from '#/components/Error'
import {Loader} from '#/components/Loader' import {Loader} from '#/components/Loader'
import {ClipClopGate} from '../gate'
type Props = NativeStackScreenProps< type Props = NativeStackScreenProps<
CommonNavigatorParams, CommonNavigatorParams,
'MessagesConversation' 'MessagesConversation'
> >
export function MessagesConversationScreen({route}: Props) { export function MessagesConversationScreen({route}: Props) {
const gate = useGate()
const {gtMobile} = useBreakpoints() const {gtMobile} = useBreakpoints()
const setMinimalShellMode = useSetMinimalShellMode() const setMinimalShellMode = useSetMinimalShellMode()
@ -54,8 +51,6 @@ export function MessagesConversationScreen({route}: Props) {
}, [gtMobile, convoId, setCurrentConvoId, setMinimalShellMode]), }, [gtMobile, convoId, setCurrentConvoId, setMinimalShellMode]),
) )
if (!gate('dms')) return <ClipClopGate />
return ( return (
<ConvoProvider convoId={convoId}> <ConvoProvider convoId={convoId}>
<Inner /> <Inner />

View File

@ -7,7 +7,6 @@ import {NativeStackScreenProps} from '@react-navigation/native-stack'
import {useInitialNumToRender} from '#/lib/hooks/useInitialNumToRender' import {useInitialNumToRender} from '#/lib/hooks/useInitialNumToRender'
import {MessagesTabNavigatorParams} from '#/lib/routes/types' import {MessagesTabNavigatorParams} from '#/lib/routes/types'
import {useGate} from '#/lib/statsig/statsig'
import {cleanError} from '#/lib/strings/errors' import {cleanError} from '#/lib/strings/errors'
import {logger} from '#/logger' import {logger} from '#/logger'
import {useListConvos} from '#/state/queries/messages/list-converations' import {useListConvos} from '#/state/queries/messages/list-converations'
@ -29,7 +28,6 @@ import {Link} from '#/components/Link'
import {ListFooter} from '#/components/Lists' import {ListFooter} from '#/components/Lists'
import {Loader} from '#/components/Loader' import {Loader} from '#/components/Loader'
import {Text} from '#/components/Typography' import {Text} from '#/components/Typography'
import {ClipClopGate} from '../gate'
import {ChatListItem} from './ChatListItem' import {ChatListItem} from './ChatListItem'
type Props = NativeStackScreenProps<MessagesTabNavigatorParams, 'Messages'> type Props = NativeStackScreenProps<MessagesTabNavigatorParams, 'Messages'>
@ -129,9 +127,6 @@ export function MessagesScreen({navigation, route}: Props) {
navigation.navigate('MessagesSettings') navigation.navigate('MessagesSettings')
}, [navigation]) }, [navigation])
const gate = useGate()
if (!gate('dms')) return <ClipClopGate />
if (conversations.length < 1) { if (conversations.length < 1) {
return ( return (
<View style={a.flex_1}> <View style={a.flex_1}>

View File

@ -5,7 +5,6 @@ import {useLingui} from '@lingui/react'
import {NativeStackScreenProps} from '@react-navigation/native-stack' import {NativeStackScreenProps} from '@react-navigation/native-stack'
import {CommonNavigatorParams} from '#/lib/routes/types' import {CommonNavigatorParams} from '#/lib/routes/types'
import {useGate} from '#/lib/statsig/statsig'
import {isNative} from '#/platform/detection' import {isNative} from '#/platform/detection'
import {useUpdateActorDeclaration} from '#/state/queries/messages/actor-declaration' import {useUpdateActorDeclaration} from '#/state/queries/messages/actor-declaration'
import {useProfileQuery} from '#/state/queries/profile' import {useProfileQuery} from '#/state/queries/profile'
@ -18,7 +17,6 @@ import {Divider} from '#/components/Divider'
import * as Toggle from '#/components/forms/Toggle' import * as Toggle from '#/components/forms/Toggle'
import {Text} from '#/components/Typography' import {Text} from '#/components/Typography'
import {useBackgroundNotificationPreferences} from '../../../modules/expo-background-notification-handler/src/BackgroundNotificationHandlerProvider' import {useBackgroundNotificationPreferences} from '../../../modules/expo-background-notification-handler/src/BackgroundNotificationHandlerProvider'
import {ClipClopGate} from './gate'
type AllowIncoming = 'all' | 'none' | 'following' type AllowIncoming = 'all' | 'none' | 'following'
@ -46,9 +44,6 @@ export function MessagesSettingsScreen({}: Props) {
[updateDeclaration], [updateDeclaration],
) )
const gate = useGate()
if (!gate('dms')) return <ClipClopGate />
return ( return (
<CenteredView sideBorders style={a.h_full_vh}> <CenteredView sideBorders style={a.h_full_vh}>
<ViewHeader title={_(msg`Settings`)} showOnDesktop showBorder /> <ViewHeader title={_(msg`Settings`)} showOnDesktop showBorder />

View File

@ -1,17 +0,0 @@
import React from 'react'
import {Text, View} from 'react-native'
export function ClipClopGate() {
return (
<View
style={{
flex: 1,
alignItems: 'center',
justifyContent: 'center',
gap: 20,
}}>
<Text style={{fontSize: 50}}>🐴</Text>
<Text style={{textAlign: 'center'}}>Nice try</Text>
</View>
)
}

View File

@ -1,7 +1,6 @@
import React from 'react' import React from 'react'
import {AppState} from 'react-native' import {AppState} from 'react-native'
import {useGate} from '#/lib/statsig/statsig'
import {isWeb} from '#/platform/detection' import {isWeb} from '#/platform/detection'
import {MessagesEventBus} from '#/state/messages/events/agent' import {MessagesEventBus} from '#/state/messages/events/agent'
import {useAgent} from '#/state/session' import {useAgent} from '#/state/session'
@ -19,7 +18,7 @@ export function useMessagesEventBus() {
return ctx return ctx
} }
export function Temp_MessagesEventBusProvider({ export function MessagesEventBusProvider({
children, children,
}: { }: {
children: React.ReactNode children: React.ReactNode
@ -61,17 +60,3 @@ export function Temp_MessagesEventBusProvider({
</MessagesEventBusContext.Provider> </MessagesEventBusContext.Provider>
) )
} }
export function MessagesEventBusProvider({
children,
}: {
children: React.ReactNode
}) {
const gate = useGate()
if (gate('dms')) {
return (
<Temp_MessagesEventBusProvider>{children}</Temp_MessagesEventBusProvider>
)
}
return children
}

View File

@ -15,7 +15,6 @@ import {useNavigationTabState} from '#/lib/hooks/useNavigationTabState'
import {usePalette} from '#/lib/hooks/usePalette' import {usePalette} from '#/lib/hooks/usePalette'
import {clamp} from '#/lib/numbers' import {clamp} from '#/lib/numbers'
import {getTabState, TabState} from '#/lib/routes/helpers' import {getTabState, TabState} from '#/lib/routes/helpers'
import {useGate} from '#/lib/statsig/statsig'
import {s} from '#/lib/styles' import {s} from '#/lib/styles'
import {emitSoftReset} from '#/state/events' import {emitSoftReset} from '#/state/events'
import {useUnreadMessageCount} from '#/state/queries/messages/list-converations' import {useUnreadMessageCount} from '#/state/queries/messages/list-converations'
@ -36,10 +35,6 @@ import {
Bell_Filled_Corner0_Rounded as BellFilled, Bell_Filled_Corner0_Rounded as BellFilled,
Bell_Stroke2_Corner0_Rounded as Bell, Bell_Stroke2_Corner0_Rounded as Bell,
} from '#/components/icons/Bell' } from '#/components/icons/Bell'
import {
Hashtag_Filled_Corner0_Rounded as HashtagFilled,
Hashtag_Stroke2_Corner0_Rounded as Hashtag,
} from '#/components/icons/Hashtag'
import { import {
HomeOpen_Filled_Corner0_Rounded as HomeFilled, HomeOpen_Filled_Corner0_Rounded as HomeFilled,
HomeOpen_Stoke2_Corner0_Rounded as Home, HomeOpen_Stoke2_Corner0_Rounded as Home,
@ -67,14 +62,8 @@ export function BottomBar({navigation}: BottomTabBarProps) {
const safeAreaInsets = useSafeAreaInsets() const safeAreaInsets = useSafeAreaInsets()
const {track} = useAnalytics() const {track} = useAnalytics()
const {footerHeight} = useShellLayout() const {footerHeight} = useShellLayout()
const { const {isAtHome, isAtSearch, isAtNotifications, isAtMyProfile, isAtMessages} =
isAtHome, useNavigationTabState()
isAtSearch,
isAtFeeds,
isAtNotifications,
isAtMyProfile,
isAtMessages,
} = useNavigationTabState()
const numUnreadNotifications = useUnreadNotifications() const numUnreadNotifications = useUnreadNotifications()
const numUnreadMessages = useUnreadMessageCount() const numUnreadMessages = useUnreadMessageCount()
const {footerMinimalShellTransform} = useMinimalShellMode() const {footerMinimalShellTransform} = useMinimalShellMode()
@ -84,7 +73,6 @@ export function BottomBar({navigation}: BottomTabBarProps) {
const dedupe = useDedupe() const dedupe = useDedupe()
const accountSwitchControl = useDialogControl() const accountSwitchControl = useDialogControl()
const playHaptic = useHaptics() const playHaptic = useHaptics()
const gate = useGate()
const iconWidth = 28 const iconWidth = 28
const showSignIn = React.useCallback(() => { const showSignIn = React.useCallback(() => {
@ -118,10 +106,6 @@ export function BottomBar({navigation}: BottomTabBarProps) {
() => onPressTab('Search'), () => onPressTab('Search'),
[onPressTab], [onPressTab],
) )
const onPressFeeds = React.useCallback(
() => onPressTab('Feeds'),
[onPressTab],
)
const onPressNotifications = React.useCallback( const onPressNotifications = React.useCallback(
() => onPressTab('Notifications'), () => onPressTab('Notifications'),
[onPressTab], [onPressTab],
@ -129,7 +113,6 @@ export function BottomBar({navigation}: BottomTabBarProps) {
const onPressProfile = React.useCallback(() => { const onPressProfile = React.useCallback(() => {
onPressTab('MyProfile') onPressTab('MyProfile')
}, [onPressTab]) }, [onPressTab])
const onPressMessages = React.useCallback(() => { const onPressMessages = React.useCallback(() => {
onPressTab('Messages') onPressTab('Messages')
}, [onPressTab]) }, [onPressTab])
@ -196,56 +179,32 @@ export function BottomBar({navigation}: BottomTabBarProps) {
accessibilityLabel={_(msg`Search`)} accessibilityLabel={_(msg`Search`)}
accessibilityHint="" accessibilityHint=""
/> />
{gate('dms') ? ( <Btn
<Btn testID="bottomBarMessagesBtn"
testID="bottomBarMessagesBtn" icon={
icon={ isAtMessages ? (
isAtMessages ? ( <MessageFilled
<MessageFilled width={iconWidth - 1}
width={iconWidth - 1} style={[styles.ctrlIcon, pal.text, styles.feedsIcon]}
style={[styles.ctrlIcon, pal.text, styles.feedsIcon]} />
/> ) : (
) : ( <Message
<Message width={iconWidth - 1}
width={iconWidth - 1} style={[styles.ctrlIcon, pal.text, styles.feedsIcon]}
style={[styles.ctrlIcon, pal.text, styles.feedsIcon]} />
/> )
) }
} onPress={onPressMessages}
onPress={onPressMessages} notificationCount={numUnreadMessages.numUnread}
notificationCount={numUnreadMessages.numUnread} accessible={true}
accessible={true} accessibilityRole="tab"
accessibilityRole="tab" accessibilityLabel={_(msg`Chat`)}
accessibilityLabel={_(msg`Chat`)} accessibilityHint={
accessibilityHint={ numUnreadMessages.count > 0
numUnreadMessages.count > 0 ? `${numUnreadMessages.numUnread} unread`
? `${numUnreadMessages.numUnread} unread` : ''
: '' }
} />
/>
) : (
<Btn
testID="bottomBarFeedsBtn"
icon={
isAtFeeds ? (
<HashtagFilled
width={iconWidth + 1}
style={[styles.ctrlIcon, pal.text, styles.feedsIcon]}
/>
) : (
<Hashtag
width={iconWidth + 1}
style={[styles.ctrlIcon, pal.text, styles.feedsIcon]}
/>
)
}
onPress={onPressFeeds}
accessible={true}
accessibilityRole="tab"
accessibilityLabel={_(msg`Feeds`)}
accessibilityHint=""
/>
)}
<Btn <Btn
testID="bottomBarNotificationsBtn" testID="bottomBarNotificationsBtn"
icon={ icon={

View File

@ -12,7 +12,6 @@ import {clamp} from '#/lib/numbers'
import {getCurrentRoute, isTab} from '#/lib/routes/helpers' import {getCurrentRoute, isTab} from '#/lib/routes/helpers'
import {makeProfileLink} from '#/lib/routes/links' import {makeProfileLink} from '#/lib/routes/links'
import {CommonNavigatorParams} from '#/lib/routes/types' import {CommonNavigatorParams} from '#/lib/routes/types'
import {useGate} from '#/lib/statsig/statsig'
import {s} from '#/lib/styles' import {s} from '#/lib/styles'
import {useSession} from '#/state/session' import {useSession} from '#/state/session'
import {useLoggedOutViewControls} from '#/state/shell/logged-out' import {useLoggedOutViewControls} from '#/state/shell/logged-out'
@ -26,10 +25,6 @@ import {
Bell_Filled_Corner0_Rounded as BellFilled, Bell_Filled_Corner0_Rounded as BellFilled,
Bell_Stroke2_Corner0_Rounded as Bell, Bell_Stroke2_Corner0_Rounded as Bell,
} from '#/components/icons/Bell' } from '#/components/icons/Bell'
import {
Hashtag_Filled_Corner0_Rounded as HashtagFilled,
Hashtag_Stroke2_Corner0_Rounded as Hashtag,
} from '#/components/icons/Hashtag'
import { import {
HomeOpen_Filled_Corner0_Rounded as HomeFilled, HomeOpen_Filled_Corner0_Rounded as HomeFilled,
HomeOpen_Stoke2_Corner0_Rounded as Home, HomeOpen_Stoke2_Corner0_Rounded as Home,
@ -54,7 +49,6 @@ export function BottomBarWeb() {
const {footerMinimalShellTransform} = useMinimalShellMode() const {footerMinimalShellTransform} = useMinimalShellMode()
const {requestSwitchToAccount} = useLoggedOutViewControls() const {requestSwitchToAccount} = useLoggedOutViewControls()
const closeAllActiveElements = useCloseAllActiveElements() const closeAllActiveElements = useCloseAllActiveElements()
const gate = useGate()
const iconWidth = 26 const iconWidth = 26
const showSignIn = React.useCallback(() => { const showSignIn = React.useCallback(() => {
@ -105,31 +99,17 @@ export function BottomBarWeb() {
{hasSession && ( {hasSession && (
<> <>
{gate('dms') ? ( <NavItem routeName="Messages" href="/messages">
<NavItem routeName="Messages" href="/messages"> {({isActive}) => {
{({isActive}) => { const Icon = isActive ? MessageFilled : Message
const Icon = isActive ? MessageFilled : Message return (
return ( <Icon
<Icon width={iconWidth - 1}
width={iconWidth - 1} style={[styles.ctrlIcon, pal.text, styles.messagesIcon]}
style={[styles.ctrlIcon, pal.text, styles.messagesIcon]} />
/> )
) }}
}} </NavItem>
</NavItem>
) : (
<NavItem routeName="Feeds" href="/feeds">
{({isActive}) => {
const Icon = isActive ? HashtagFilled : Hashtag
return (
<Icon
width={iconWidth + 1}
style={[styles.ctrlIcon, pal.text, styles.feedsIcon]}
/>
)
}}
</NavItem>
)}
<NavItem routeName="Notifications" href="/notifications"> <NavItem routeName="Notifications" href="/notifications">
{({isActive}) => { {({isActive}) => {
const Icon = isActive ? BellFilled : Bell const Icon = isActive ? BellFilled : Bell

View File

@ -12,7 +12,6 @@ import {
useNavigationState, useNavigationState,
} from '@react-navigation/native' } from '@react-navigation/native'
import {useGate} from '#/lib/statsig/statsig'
import {isInvalidHandle} from '#/lib/strings/handles' import {isInvalidHandle} from '#/lib/strings/handles'
import {emitSoftReset} from '#/state/events' import {emitSoftReset} from '#/state/events'
import {useFetchHandle} from '#/state/queries/handle' import {useFetchHandle} from '#/state/queries/handle'
@ -304,7 +303,6 @@ export function DesktopLeftNav() {
const {_} = useLingui() const {_} = useLingui()
const {isDesktop, isTablet} = useWebMediaQueries() const {isDesktop, isTablet} = useWebMediaQueries()
const numUnreadNotifications = useUnreadNotifications() const numUnreadNotifications = useUnreadNotifications()
const gate = useGate()
if (!hasSession && !isDesktop) { if (!hasSession && !isDesktop) {
return null return null
@ -351,7 +349,7 @@ export function DesktopLeftNav() {
iconFilled={<BellFilled width={NAV_ICON_WIDTH} style={pal.text} />} iconFilled={<BellFilled width={NAV_ICON_WIDTH} style={pal.text} />}
label={_(msg`Notifications`)} label={_(msg`Notifications`)}
/> />
{gate('dms') && <ChatNavItem />} <ChatNavItem />
<NavItem <NavItem
href="/feeds" href="/feeds"
icon={ icon={