[Statsig] Update experiments (#3617)

zio/stable
dan 2024-04-19 15:23:47 +01:00 committed by GitHub
parent f709fbcbdd
commit 55aea348c2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 30 additions and 26 deletions

View File

@ -1,12 +1,12 @@
export type Gate = export type Gate =
// Keep this alphabetic please. // Keep this alphabetic please.
| 'autoexpand_suggestions_on_profile_follow' | 'autoexpand_suggestions_on_profile_follow_v2'
| 'disable_min_shell_on_foregrounding' | 'disable_min_shell_on_foregrounding_v2'
| 'disable_poll_on_discover' | 'disable_poll_on_discover_v2'
| 'hide_vertical_scroll_indicators' | 'hide_vertical_scroll_indicators'
| 'new_profile_scroll_component' | 'new_profile_scroll_component'
| 'new_search' | 'new_search'
| 'receive_updates' | 'receive_updates'
| 'show_follow_back_label' | 'show_follow_back_label_v2'
| 'start_session_with_following' | 'start_session_with_following_v2'
| 'use_new_suggestions_endpoint' | 'use_new_suggestions_endpoint'

View File

@ -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) setShowSuggestedFollows(true)
} }
} catch (e: any) { } catch (e: any) {

View File

@ -27,7 +27,7 @@ function getInitialFeed(gate: (gateName: Gate) => boolean) {
return feedFromSession return feedFromSession
} }
} }
if (!gate('start_session_with_following')) { if (!gate('start_session_with_following_v2')) {
const feedFromPersisted = persisted.get('lastSelectedHomeFeed') const feedFromPersisted = persisted.get('lastSelectedHomeFeed')
if (feedFromPersisted) { if (feedFromPersisted) {
// Fall back to the last chosen one across all tabs. // Fall back to the last chosen one across all tabs.

View File

@ -104,17 +104,11 @@ export function FeedPage({
}) })
}, [scrollToTop, feed, queryClient, setHasNew]) }, [scrollToTop, feed, queryClient, setHasNew])
let feedPollInterval const isDiscoverFeed =
if ( feed ===
feed === // Discover 'feedgen|at://did:plc:z72i7hdynmk6r22z27h6tvur/app.bsky.feed.generator/whats-hot'
'feedgen|at://did:plc:z72i7hdynmk6r22z27h6tvur/app.bsky.feed.generator/whats-hot' && const adjustedHasNew =
// TODO: This gate check is still too early. Move it to where the polling happens. hasNew && !(isDiscoverFeed && gate('disable_poll_on_discover_v2'))
gate('disable_poll_on_discover')
) {
feedPollInterval = undefined
} else {
feedPollInterval = POLL_FREQ
}
return ( return (
<View testID={testID} style={s.h100pct}> <View testID={testID} style={s.h100pct}>
@ -124,7 +118,7 @@ export function FeedPage({
enabled={isPageFocused} enabled={isPageFocused}
feed={feed} feed={feed}
feedParams={feedParams} feedParams={feedParams}
pollInterval={feedPollInterval} pollInterval={POLL_FREQ}
disablePoll={hasNew} disablePoll={hasNew}
scrollElRef={scrollElRef} scrollElRef={scrollElRef}
onScrolledDownChange={setIsScrolledDown} onScrolledDownChange={setIsScrolledDown}
@ -134,11 +128,11 @@ export function FeedPage({
headerOffset={headerOffset} headerOffset={headerOffset}
/> />
</MainScrollProvider> </MainScrollProvider>
{(isScrolledDown || hasNew) && ( {(isScrolledDown || adjustedHasNew) && (
<LoadLatestBtn <LoadLatestBtn
onPress={onPressLoadLatest} onPress={onPressLoadLatest}
label={_(msg`Load new posts`)} label={_(msg`Load new posts`)}
showIndicator={hasNew} showIndicator={adjustedHasNew}
/> />
)} )}

View File

@ -140,7 +140,7 @@ function PostThreadFollowBtnLoaded({
style={[!isFollowing ? palInverted.text : pal.text, s.bold]} style={[!isFollowing ? palInverted.text : pal.text, s.bold]}
numberOfLines={1}> numberOfLines={1}>
{!isFollowing ? ( {!isFollowing ? (
isFollowedBy && gate('show_follow_back_label') ? ( isFollowedBy && gate('show_follow_back_label_v2') ? (
<Trans>Follow Back</Trans> <Trans>Follow Back</Trans>
) : ( ) : (
<Trans>Follow</Trans> <Trans>Follow</Trans>

View File

@ -5,6 +5,7 @@ import {useFocusEffect} from '@react-navigation/native'
import {PROD_DEFAULT_FEED} from '#/lib/constants' import {PROD_DEFAULT_FEED} from '#/lib/constants'
import {useNonReactiveCallback} from '#/lib/hooks/useNonReactiveCallback' import {useNonReactiveCallback} from '#/lib/hooks/useNonReactiveCallback'
import {useSetTitle} from '#/lib/hooks/useSetTitle' import {useSetTitle} from '#/lib/hooks/useSetTitle'
import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries'
import {logEvent, LogEvents, useGate} from '#/lib/statsig/statsig' import {logEvent, LogEvents, useGate} from '#/lib/statsig/statsig'
import {emitSoftReset} from '#/state/events' import {emitSoftReset} from '#/state/events'
import {FeedSourceInfo, usePinnedFeedsInfos} from '#/state/queries/feed' 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 {usePreferencesQuery} from '#/state/queries/preferences'
import {UsePreferencesQueryResponse} from '#/state/queries/preferences/types' import {UsePreferencesQueryResponse} from '#/state/queries/preferences/types'
import {useSession} from '#/state/session' 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 {useSelectedFeed, useSetSelectedFeed} from '#/state/shell/selected-feed'
import {useOTAUpdates} from 'lib/hooks/useOTAUpdates' import {useOTAUpdates} from 'lib/hooks/useOTAUpdates'
import {HomeTabNavigatorParams, NativeStackScreenProps} from 'lib/routes/types' import {HomeTabNavigatorParams, NativeStackScreenProps} from 'lib/routes/types'
@ -112,11 +117,16 @@ function HomeScreenReady({
) )
const gate = useGate() const gate = useGate()
const mode = useMinimalShellMode()
const {isMobile} = useWebMediaQueries()
React.useEffect(() => { React.useEffect(() => {
const listener = AppState.addEventListener('change', nextAppState => { const listener = AppState.addEventListener('change', nextAppState => {
if (nextAppState === 'active') { if (nextAppState === 'active') {
// TODO: Check if minimal shell is on before logging an exposure. if (
if (gate('disable_min_shell_on_foregrounding')) { isMobile &&
mode.value === 1 &&
gate('disable_min_shell_on_foregrounding_v2')
) {
setMinimalShellMode(false) setMinimalShellMode(false)
} }
} }
@ -124,7 +134,7 @@ function HomeScreenReady({
return () => { return () => {
listener.remove() listener.remove()
} }
}, [setMinimalShellMode, gate]) }, [setMinimalShellMode, mode, isMobile, gate])
const onPageSelected = React.useCallback( const onPageSelected = React.useCallback(
(index: number) => { (index: number) => {