[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 =
// 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'

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

View File

@ -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.

View File

@ -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 (
<View testID={testID} style={s.h100pct}>
@ -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}
/>
</MainScrollProvider>
{(isScrolledDown || hasNew) && (
{(isScrolledDown || adjustedHasNew) && (
<LoadLatestBtn
onPress={onPressLoadLatest}
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]}
numberOfLines={1}>
{!isFollowing ? (
isFollowedBy && gate('show_follow_back_label') ? (
isFollowedBy && gate('show_follow_back_label_v2') ? (
<Trans>Follow Back</Trans>
) : (
<Trans>Follow</Trans>

View File

@ -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) => {