diff --git a/src/lib/statsig/gates.ts b/src/lib/statsig/gates.ts index 314799f2..d540cde1 100644 --- a/src/lib/statsig/gates.ts +++ b/src/lib/statsig/gates.ts @@ -1,12 +1,12 @@ export type Gate = // Keep this alphabetic please. - | 'autoexpand_suggestions_on_profile_follow' - | 'disable_min_shell_on_foregrounding' - | 'disable_poll_on_discover' + | 'autoexpand_suggestions_on_profile_follow_v2' + | 'disable_min_shell_on_foregrounding_v2' + | 'disable_poll_on_discover_v2' | 'hide_vertical_scroll_indicators' | 'new_profile_scroll_component' | 'new_search' | 'receive_updates' - | 'show_follow_back_label' - | 'start_session_with_following' + | 'show_follow_back_label_v2' + | 'start_session_with_following_v2' | 'use_new_suggestions_endpoint' diff --git a/src/screens/Profile/Header/ProfileHeaderStandard.tsx b/src/screens/Profile/Header/ProfileHeaderStandard.tsx index 9e036132..7c52bcbd 100644 --- a/src/screens/Profile/Header/ProfileHeaderStandard.tsx +++ b/src/screens/Profile/Header/ProfileHeaderStandard.tsx @@ -94,7 +94,7 @@ let ProfileHeaderStandard = ({ )}`, ), ) - if (isWeb && gate('autoexpand_suggestions_on_profile_follow')) { + if (isWeb && gate('autoexpand_suggestions_on_profile_follow_v2')) { setShowSuggestedFollows(true) } } catch (e: any) { diff --git a/src/state/shell/selected-feed.tsx b/src/state/shell/selected-feed.tsx index dca3445f..df50b395 100644 --- a/src/state/shell/selected-feed.tsx +++ b/src/state/shell/selected-feed.tsx @@ -27,7 +27,7 @@ function getInitialFeed(gate: (gateName: Gate) => boolean) { return feedFromSession } } - if (!gate('start_session_with_following')) { + if (!gate('start_session_with_following_v2')) { const feedFromPersisted = persisted.get('lastSelectedHomeFeed') if (feedFromPersisted) { // Fall back to the last chosen one across all tabs. diff --git a/src/view/com/feeds/FeedPage.tsx b/src/view/com/feeds/FeedPage.tsx index 2b8fde63..4ebf64da 100644 --- a/src/view/com/feeds/FeedPage.tsx +++ b/src/view/com/feeds/FeedPage.tsx @@ -104,17 +104,11 @@ export function FeedPage({ }) }, [scrollToTop, feed, queryClient, setHasNew]) - let feedPollInterval - if ( - feed === // Discover - 'feedgen|at://did:plc:z72i7hdynmk6r22z27h6tvur/app.bsky.feed.generator/whats-hot' && - // TODO: This gate check is still too early. Move it to where the polling happens. - gate('disable_poll_on_discover') - ) { - feedPollInterval = undefined - } else { - feedPollInterval = POLL_FREQ - } + const isDiscoverFeed = + feed === + 'feedgen|at://did:plc:z72i7hdynmk6r22z27h6tvur/app.bsky.feed.generator/whats-hot' + const adjustedHasNew = + hasNew && !(isDiscoverFeed && gate('disable_poll_on_discover_v2')) return ( @@ -124,7 +118,7 @@ export function FeedPage({ enabled={isPageFocused} feed={feed} feedParams={feedParams} - pollInterval={feedPollInterval} + pollInterval={POLL_FREQ} disablePoll={hasNew} scrollElRef={scrollElRef} onScrolledDownChange={setIsScrolledDown} @@ -134,11 +128,11 @@ export function FeedPage({ headerOffset={headerOffset} /> - {(isScrolledDown || hasNew) && ( + {(isScrolledDown || adjustedHasNew) && ( )} diff --git a/src/view/com/post-thread/PostThreadFollowBtn.tsx b/src/view/com/post-thread/PostThreadFollowBtn.tsx index 7c9a5445..1f70f41c 100644 --- a/src/view/com/post-thread/PostThreadFollowBtn.tsx +++ b/src/view/com/post-thread/PostThreadFollowBtn.tsx @@ -140,7 +140,7 @@ function PostThreadFollowBtnLoaded({ style={[!isFollowing ? palInverted.text : pal.text, s.bold]} numberOfLines={1}> {!isFollowing ? ( - isFollowedBy && gate('show_follow_back_label') ? ( + isFollowedBy && gate('show_follow_back_label_v2') ? ( Follow Back ) : ( Follow diff --git a/src/view/screens/Home.tsx b/src/view/screens/Home.tsx index fbaa49a3..3eaa1b87 100644 --- a/src/view/screens/Home.tsx +++ b/src/view/screens/Home.tsx @@ -5,6 +5,7 @@ import {useFocusEffect} from '@react-navigation/native' import {PROD_DEFAULT_FEED} from '#/lib/constants' import {useNonReactiveCallback} from '#/lib/hooks/useNonReactiveCallback' import {useSetTitle} from '#/lib/hooks/useSetTitle' +import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries' import {logEvent, LogEvents, useGate} from '#/lib/statsig/statsig' import {emitSoftReset} from '#/state/events' import {FeedSourceInfo, usePinnedFeedsInfos} from '#/state/queries/feed' @@ -12,7 +13,11 @@ import {FeedDescriptor, FeedParams} from '#/state/queries/post-feed' import {usePreferencesQuery} from '#/state/queries/preferences' import {UsePreferencesQueryResponse} from '#/state/queries/preferences/types' import {useSession} from '#/state/session' -import {useSetDrawerSwipeDisabled, useSetMinimalShellMode} from '#/state/shell' +import { + useMinimalShellMode, + useSetDrawerSwipeDisabled, + useSetMinimalShellMode, +} from '#/state/shell' import {useSelectedFeed, useSetSelectedFeed} from '#/state/shell/selected-feed' import {useOTAUpdates} from 'lib/hooks/useOTAUpdates' import {HomeTabNavigatorParams, NativeStackScreenProps} from 'lib/routes/types' @@ -112,11 +117,16 @@ function HomeScreenReady({ ) const gate = useGate() + const mode = useMinimalShellMode() + const {isMobile} = useWebMediaQueries() React.useEffect(() => { const listener = AppState.addEventListener('change', nextAppState => { if (nextAppState === 'active') { - // TODO: Check if minimal shell is on before logging an exposure. - if (gate('disable_min_shell_on_foregrounding')) { + if ( + isMobile && + mode.value === 1 && + gate('disable_min_shell_on_foregrounding_v2') + ) { setMinimalShellMode(false) } } @@ -124,7 +134,7 @@ function HomeScreenReady({ return () => { listener.remove() } - }, [setMinimalShellMode, gate]) + }, [setMinimalShellMode, mode, isMobile, gate]) const onPageSelected = React.useCallback( (index: number) => {