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

View File

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

View File

@ -5,7 +5,6 @@ import {useLingui} from '@lingui/react'
import {NativeStackScreenProps} from '@react-navigation/native-stack'
import {CommonNavigatorParams} from '#/lib/routes/types'
import {useGate} from '#/lib/statsig/statsig'
import {isNative} from '#/platform/detection'
import {useUpdateActorDeclaration} from '#/state/queries/messages/actor-declaration'
import {useProfileQuery} from '#/state/queries/profile'
@ -18,7 +17,6 @@ import {Divider} from '#/components/Divider'
import * as Toggle from '#/components/forms/Toggle'
import {Text} from '#/components/Typography'
import {useBackgroundNotificationPreferences} from '../../../modules/expo-background-notification-handler/src/BackgroundNotificationHandlerProvider'
import {ClipClopGate} from './gate'
type AllowIncoming = 'all' | 'none' | 'following'
@ -46,9 +44,6 @@ export function MessagesSettingsScreen({}: Props) {
[updateDeclaration],
)
const gate = useGate()
if (!gate('dms')) return <ClipClopGate />
return (
<CenteredView sideBorders style={a.h_full_vh}>
<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 {AppState} from 'react-native'
import {useGate} from '#/lib/statsig/statsig'
import {isWeb} from '#/platform/detection'
import {MessagesEventBus} from '#/state/messages/events/agent'
import {useAgent} from '#/state/session'
@ -19,7 +18,7 @@ export function useMessagesEventBus() {
return ctx
}
export function Temp_MessagesEventBusProvider({
export function MessagesEventBusProvider({
children,
}: {
children: React.ReactNode
@ -61,17 +60,3 @@ export function Temp_MessagesEventBusProvider({
</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 {clamp} from '#/lib/numbers'
import {getTabState, TabState} from '#/lib/routes/helpers'
import {useGate} from '#/lib/statsig/statsig'
import {s} from '#/lib/styles'
import {emitSoftReset} from '#/state/events'
import {useUnreadMessageCount} from '#/state/queries/messages/list-converations'
@ -36,10 +35,6 @@ import {
Bell_Filled_Corner0_Rounded as BellFilled,
Bell_Stroke2_Corner0_Rounded as Bell,
} from '#/components/icons/Bell'
import {
Hashtag_Filled_Corner0_Rounded as HashtagFilled,
Hashtag_Stroke2_Corner0_Rounded as Hashtag,
} from '#/components/icons/Hashtag'
import {
HomeOpen_Filled_Corner0_Rounded as HomeFilled,
HomeOpen_Stoke2_Corner0_Rounded as Home,
@ -67,14 +62,8 @@ export function BottomBar({navigation}: BottomTabBarProps) {
const safeAreaInsets = useSafeAreaInsets()
const {track} = useAnalytics()
const {footerHeight} = useShellLayout()
const {
isAtHome,
isAtSearch,
isAtFeeds,
isAtNotifications,
isAtMyProfile,
isAtMessages,
} = useNavigationTabState()
const {isAtHome, isAtSearch, isAtNotifications, isAtMyProfile, isAtMessages} =
useNavigationTabState()
const numUnreadNotifications = useUnreadNotifications()
const numUnreadMessages = useUnreadMessageCount()
const {footerMinimalShellTransform} = useMinimalShellMode()
@ -84,7 +73,6 @@ export function BottomBar({navigation}: BottomTabBarProps) {
const dedupe = useDedupe()
const accountSwitchControl = useDialogControl()
const playHaptic = useHaptics()
const gate = useGate()
const iconWidth = 28
const showSignIn = React.useCallback(() => {
@ -118,10 +106,6 @@ export function BottomBar({navigation}: BottomTabBarProps) {
() => onPressTab('Search'),
[onPressTab],
)
const onPressFeeds = React.useCallback(
() => onPressTab('Feeds'),
[onPressTab],
)
const onPressNotifications = React.useCallback(
() => onPressTab('Notifications'),
[onPressTab],
@ -129,7 +113,6 @@ export function BottomBar({navigation}: BottomTabBarProps) {
const onPressProfile = React.useCallback(() => {
onPressTab('MyProfile')
}, [onPressTab])
const onPressMessages = React.useCallback(() => {
onPressTab('Messages')
}, [onPressTab])
@ -196,7 +179,6 @@ export function BottomBar({navigation}: BottomTabBarProps) {
accessibilityLabel={_(msg`Search`)}
accessibilityHint=""
/>
{gate('dms') ? (
<Btn
testID="bottomBarMessagesBtn"
icon={
@ -223,29 +205,6 @@ export function BottomBar({navigation}: BottomTabBarProps) {
: ''
}
/>
) : (
<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
testID="bottomBarNotificationsBtn"
icon={

View File

@ -12,7 +12,6 @@ import {clamp} from '#/lib/numbers'
import {getCurrentRoute, isTab} from '#/lib/routes/helpers'
import {makeProfileLink} from '#/lib/routes/links'
import {CommonNavigatorParams} from '#/lib/routes/types'
import {useGate} from '#/lib/statsig/statsig'
import {s} from '#/lib/styles'
import {useSession} from '#/state/session'
import {useLoggedOutViewControls} from '#/state/shell/logged-out'
@ -26,10 +25,6 @@ import {
Bell_Filled_Corner0_Rounded as BellFilled,
Bell_Stroke2_Corner0_Rounded as Bell,
} from '#/components/icons/Bell'
import {
Hashtag_Filled_Corner0_Rounded as HashtagFilled,
Hashtag_Stroke2_Corner0_Rounded as Hashtag,
} from '#/components/icons/Hashtag'
import {
HomeOpen_Filled_Corner0_Rounded as HomeFilled,
HomeOpen_Stoke2_Corner0_Rounded as Home,
@ -54,7 +49,6 @@ export function BottomBarWeb() {
const {footerMinimalShellTransform} = useMinimalShellMode()
const {requestSwitchToAccount} = useLoggedOutViewControls()
const closeAllActiveElements = useCloseAllActiveElements()
const gate = useGate()
const iconWidth = 26
const showSignIn = React.useCallback(() => {
@ -105,7 +99,6 @@ export function BottomBarWeb() {
{hasSession && (
<>
{gate('dms') ? (
<NavItem routeName="Messages" href="/messages">
{({isActive}) => {
const Icon = isActive ? MessageFilled : Message
@ -117,19 +110,6 @@ export function BottomBarWeb() {
)
}}
</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">
{({isActive}) => {
const Icon = isActive ? BellFilled : Bell

View File

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