From 4a7436886d0548ae453997286f5a8c2ac4b297a0 Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Tue, 21 May 2024 01:29:22 +0100 Subject: [PATCH] remove DMs gate (#4112) --- src/lib/statsig/gates.ts | 1 - src/screens/Messages/Conversation/index.tsx | 5 -- src/screens/Messages/List/index.tsx | 5 -- src/screens/Messages/Settings.tsx | 5 -- src/screens/Messages/gate.tsx | 17 ---- src/state/messages/events/index.tsx | 17 +--- src/view/shell/bottom-bar/BottomBar.tsx | 97 ++++++--------------- src/view/shell/bottom-bar/BottomBarWeb.tsx | 42 +++------ src/view/shell/desktop/LeftNav.tsx | 4 +- 9 files changed, 41 insertions(+), 152 deletions(-) delete mode 100644 src/screens/Messages/gate.tsx diff --git a/src/lib/statsig/gates.ts b/src/lib/statsig/gates.ts index 42f86c81..b0ba7d75 100644 --- a/src/lib/statsig/gates.ts +++ b/src/lib/statsig/gates.ts @@ -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' diff --git a/src/screens/Messages/Conversation/index.tsx b/src/screens/Messages/Conversation/index.tsx index 62e0e815..eaa3ddec 100644 --- a/src/screens/Messages/Conversation/index.tsx +++ b/src/screens/Messages/Conversation/index.tsx @@ -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 - return ( diff --git a/src/screens/Messages/List/index.tsx b/src/screens/Messages/List/index.tsx index 2427840b..d083ae5b 100644 --- a/src/screens/Messages/List/index.tsx +++ b/src/screens/Messages/List/index.tsx @@ -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 @@ -129,9 +127,6 @@ export function MessagesScreen({navigation, route}: Props) { navigation.navigate('MessagesSettings') }, [navigation]) - const gate = useGate() - if (!gate('dms')) return - if (conversations.length < 1) { return ( diff --git a/src/screens/Messages/Settings.tsx b/src/screens/Messages/Settings.tsx index 7671239a..a9df2456 100644 --- a/src/screens/Messages/Settings.tsx +++ b/src/screens/Messages/Settings.tsx @@ -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 - return ( diff --git a/src/screens/Messages/gate.tsx b/src/screens/Messages/gate.tsx deleted file mode 100644 index f225a0c9..00000000 --- a/src/screens/Messages/gate.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import React from 'react' -import {Text, View} from 'react-native' - -export function ClipClopGate() { - return ( - - 🐴 - Nice try - - ) -} diff --git a/src/state/messages/events/index.tsx b/src/state/messages/events/index.tsx index e8768573..b0be73b1 100644 --- a/src/state/messages/events/index.tsx +++ b/src/state/messages/events/index.tsx @@ -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({ ) } - -export function MessagesEventBusProvider({ - children, -}: { - children: React.ReactNode -}) { - const gate = useGate() - if (gate('dms')) { - return ( - {children} - ) - } - return children -} diff --git a/src/view/shell/bottom-bar/BottomBar.tsx b/src/view/shell/bottom-bar/BottomBar.tsx index 7b74880c..0a7897f1 100644 --- a/src/view/shell/bottom-bar/BottomBar.tsx +++ b/src/view/shell/bottom-bar/BottomBar.tsx @@ -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,56 +179,32 @@ export function BottomBar({navigation}: BottomTabBarProps) { accessibilityLabel={_(msg`Search`)} accessibilityHint="" /> - {gate('dms') ? ( - - ) : ( - - ) - } - onPress={onPressMessages} - notificationCount={numUnreadMessages.numUnread} - accessible={true} - accessibilityRole="tab" - accessibilityLabel={_(msg`Chat`)} - accessibilityHint={ - numUnreadMessages.count > 0 - ? `${numUnreadMessages.numUnread} unread` - : '' - } - /> - ) : ( - - ) : ( - - ) - } - onPress={onPressFeeds} - accessible={true} - accessibilityRole="tab" - accessibilityLabel={_(msg`Feeds`)} - accessibilityHint="" - /> - )} + + ) : ( + + ) + } + onPress={onPressMessages} + notificationCount={numUnreadMessages.numUnread} + accessible={true} + accessibilityRole="tab" + accessibilityLabel={_(msg`Chat`)} + accessibilityHint={ + numUnreadMessages.count > 0 + ? `${numUnreadMessages.numUnread} unread` + : '' + } + /> { @@ -105,31 +99,17 @@ export function BottomBarWeb() { {hasSession && ( <> - {gate('dms') ? ( - - {({isActive}) => { - const Icon = isActive ? MessageFilled : Message - return ( - - ) - }} - - ) : ( - - {({isActive}) => { - const Icon = isActive ? HashtagFilled : Hashtag - return ( - - ) - }} - - )} + + {({isActive}) => { + const Icon = isActive ? MessageFilled : Message + return ( + + ) + }} + {({isActive}) => { const Icon = isActive ? BellFilled : Bell diff --git a/src/view/shell/desktop/LeftNav.tsx b/src/view/shell/desktop/LeftNav.tsx index 3fc0774f..9b2b4922 100644 --- a/src/view/shell/desktop/LeftNav.tsx +++ b/src/view/shell/desktop/LeftNav.tsx @@ -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={} label={_(msg`Notifications`)} /> - {gate('dms') && } +