diff options
author | Samuel Newman <mozzius@protonmail.com> | 2024-05-21 01:29:22 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-20 19:29:22 -0500 |
commit | 4a7436886d0548ae453997286f5a8c2ac4b297a0 (patch) | |
tree | 1adc5e46a824016df65d261df99ad5661c74f42d /src | |
parent | a7b0242cc8aaf09273abe20903e88e59a4acd1a7 (diff) | |
download | voidsky-4a7436886d0548ae453997286f5a8c2ac4b297a0.tar.zst |
remove DMs gate (#4112)
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/statsig/gates.ts | 1 | ||||
-rw-r--r-- | src/screens/Messages/Conversation/index.tsx | 5 | ||||
-rw-r--r-- | src/screens/Messages/List/index.tsx | 5 | ||||
-rw-r--r-- | src/screens/Messages/Settings.tsx | 5 | ||||
-rw-r--r-- | src/screens/Messages/gate.tsx | 17 | ||||
-rw-r--r-- | src/state/messages/events/index.tsx | 17 | ||||
-rw-r--r-- | src/view/shell/bottom-bar/BottomBar.tsx | 97 | ||||
-rw-r--r-- | src/view/shell/bottom-bar/BottomBarWeb.tsx | 42 | ||||
-rw-r--r-- | src/view/shell/desktop/LeftNav.tsx | 4 |
9 files changed, 41 insertions, 152 deletions
diff --git a/src/lib/statsig/gates.ts b/src/lib/statsig/gates.ts index 42f86c81c..b0ba7d753 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 62e0e8157..eaa3ddecb 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 <ClipClopGate /> - return ( <ConvoProvider convoId={convoId}> <Inner /> diff --git a/src/screens/Messages/List/index.tsx b/src/screens/Messages/List/index.tsx index 2427840b9..d083ae5ba 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<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}> diff --git a/src/screens/Messages/Settings.tsx b/src/screens/Messages/Settings.tsx index 7671239ad..a9df2456d 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 <ClipClopGate /> - return ( <CenteredView sideBorders style={a.h_full_vh}> <ViewHeader title={_(msg`Settings`)} showOnDesktop showBorder /> diff --git a/src/screens/Messages/gate.tsx b/src/screens/Messages/gate.tsx deleted file mode 100644 index f225a0c9d..000000000 --- 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 ( - <View - style={{ - flex: 1, - alignItems: 'center', - justifyContent: 'center', - gap: 20, - }}> - <Text style={{fontSize: 50}}>🐴</Text> - <Text style={{textAlign: 'center'}}>Nice try</Text> - </View> - ) -} diff --git a/src/state/messages/events/index.tsx b/src/state/messages/events/index.tsx index e8768573b..b0be73b10 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({ </MessagesEventBusContext.Provider> ) } - -export function MessagesEventBusProvider({ - children, -}: { - children: React.ReactNode -}) { - const gate = useGate() - if (gate('dms')) { - return ( - <Temp_MessagesEventBusProvider>{children}</Temp_MessagesEventBusProvider> - ) - } - return children -} diff --git a/src/view/shell/bottom-bar/BottomBar.tsx b/src/view/shell/bottom-bar/BottomBar.tsx index 7b74880c5..0a7897f17 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' @@ -37,10 +36,6 @@ import { 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, } from '#/components/icons/HomeOpen' @@ -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') ? ( - <Btn - testID="bottomBarMessagesBtn" - icon={ - isAtMessages ? ( - <MessageFilled - width={iconWidth - 1} - style={[styles.ctrlIcon, pal.text, styles.feedsIcon]} - /> - ) : ( - <Message - width={iconWidth - 1} - style={[styles.ctrlIcon, pal.text, styles.feedsIcon]} - /> - ) - } - onPress={onPressMessages} - notificationCount={numUnreadMessages.numUnread} - accessible={true} - accessibilityRole="tab" - accessibilityLabel={_(msg`Chat`)} - accessibilityHint={ - numUnreadMessages.count > 0 - ? `${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 + testID="bottomBarMessagesBtn" + icon={ + isAtMessages ? ( + <MessageFilled + width={iconWidth - 1} + style={[styles.ctrlIcon, pal.text, styles.feedsIcon]} + /> + ) : ( + <Message + width={iconWidth - 1} + style={[styles.ctrlIcon, pal.text, styles.feedsIcon]} + /> + ) + } + onPress={onPressMessages} + notificationCount={numUnreadMessages.numUnread} + accessible={true} + accessibilityRole="tab" + accessibilityLabel={_(msg`Chat`)} + accessibilityHint={ + numUnreadMessages.count > 0 + ? `${numUnreadMessages.numUnread} unread` + : '' + } + /> <Btn testID="bottomBarNotificationsBtn" icon={ diff --git a/src/view/shell/bottom-bar/BottomBarWeb.tsx b/src/view/shell/bottom-bar/BottomBarWeb.tsx index f2d2f26f9..6860e8024 100644 --- a/src/view/shell/bottom-bar/BottomBarWeb.tsx +++ b/src/view/shell/bottom-bar/BottomBarWeb.tsx @@ -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' @@ -27,10 +26,6 @@ import { 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, } from '#/components/icons/HomeOpen' @@ -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,31 +99,17 @@ export function BottomBarWeb() { {hasSession && ( <> - {gate('dms') ? ( - <NavItem routeName="Messages" href="/messages"> - {({isActive}) => { - const Icon = isActive ? MessageFilled : Message - return ( - <Icon - width={iconWidth - 1} - style={[styles.ctrlIcon, pal.text, styles.messagesIcon]} - /> - ) - }} - </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="Messages" href="/messages"> + {({isActive}) => { + const Icon = isActive ? MessageFilled : Message + return ( + <Icon + width={iconWidth - 1} + style={[styles.ctrlIcon, pal.text, styles.messagesIcon]} + /> + ) + }} + </NavItem> <NavItem routeName="Notifications" href="/notifications"> {({isActive}) => { const Icon = isActive ? BellFilled : Bell diff --git a/src/view/shell/desktop/LeftNav.tsx b/src/view/shell/desktop/LeftNav.tsx index 3fc0774f3..9b2b4922a 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={<BellFilled width={NAV_ICON_WIDTH} style={pal.text} />} label={_(msg`Notifications`)} /> - {gate('dms') && <ChatNavItem />} + <ChatNavItem /> <NavItem href="/feeds" icon={ |