Update statsig API
This commit is contained in:
@@ -244,7 +244,8 @@ const pinnedFeedInfosQueryKeyRoot = 'pinnedFeedsInfos'
|
|||||||
export function usePinnedFeedsInfos() {
|
export function usePinnedFeedsInfos() {
|
||||||
const {hasSession} = useSession()
|
const {hasSession} = useSession()
|
||||||
const {data: preferences, isLoading: isLoadingPrefs} = usePreferencesQuery()
|
const {data: preferences, isLoading: isLoadingPrefs} = usePreferencesQuery()
|
||||||
const isPrimaryAlgoExperimentEnabled = useGate(
|
const gate = useGate()
|
||||||
|
const isPrimaryAlgoExperimentEnabled = gate(
|
||||||
'reduced_onboarding_and_home_algo',
|
'reduced_onboarding_and_home_algo',
|
||||||
)
|
)
|
||||||
const primaryAlgo = preferences?.primaryAlgorithm
|
const primaryAlgo = preferences?.primaryAlgorithm
|
||||||
|
|||||||
@@ -12,28 +12,40 @@ const stateContext = React.createContext<StateContext>('home')
|
|||||||
const setContext = React.createContext<SetContext>((_: string) => {})
|
const setContext = React.createContext<SetContext>((_: string) => {})
|
||||||
|
|
||||||
function getInitialFeed(gate: (gateName: Gate) => boolean) {
|
function getInitialFeed(gate: (gateName: Gate) => boolean) {
|
||||||
|
const isPrimaryAlgoExperimentEnabled = gate(
|
||||||
|
'reduced_onboarding_and_home_algo',
|
||||||
|
)
|
||||||
|
let feed = isPrimaryAlgoExperimentEnabled ? 'primary-algo' : 'home'
|
||||||
|
|
||||||
if (isWeb) {
|
if (isWeb) {
|
||||||
if (window.location.pathname === '/') {
|
if (window.location.pathname === '/') {
|
||||||
const params = new URLSearchParams(window.location.search)
|
const params = new URLSearchParams(window.location.search)
|
||||||
const feedFromUrl = params.get('feed')
|
const feedFromUrl = params.get('feed')
|
||||||
if (feedFromUrl) {
|
if (feedFromUrl) {
|
||||||
// If explicitly booted from a link like /?feed=..., prefer that.
|
// basically a link to a specific tab, use that every time if present
|
||||||
return feedFromUrl
|
return feedFromUrl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const feedFromSession = sessionStorage.getItem('lastSelectedHomeFeed')
|
const feedFromSession = sessionStorage.getItem('lastSelectedHomeFeed')
|
||||||
if (feedFromSession) {
|
if (feedFromSession) {
|
||||||
// Fall back to a previously chosen feed for this browser tab.
|
// Fall back to a previously chosen feed for this browser tab.
|
||||||
return feedFromSession
|
feed = feedFromSession
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!gate('start_session_with_following')) {
|
|
||||||
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.
|
||||||
return feedFromPersisted
|
feed = feedFromPersisted
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isPrimaryAlgoExperimentEnabled) {
|
||||||
|
if (feed === 'home') {
|
||||||
|
return 'home'
|
||||||
}
|
}
|
||||||
|
return 'primary-algo'
|
||||||
|
}
|
||||||
|
|
||||||
return 'home'
|
return 'home'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -93,9 +93,7 @@ export function FeedSourceCardLoaded({
|
|||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const removePromptControl = Prompt.usePromptControl()
|
const removePromptControl = Prompt.usePromptControl()
|
||||||
const navigation = useNavigationDeduped()
|
const navigation = useNavigationDeduped()
|
||||||
const isPrimaryAlgoExperimentEnabled = useGate(
|
const gate = useGate()
|
||||||
'reduced_onboarding_and_home_algo',
|
|
||||||
)
|
|
||||||
const primaryAlgoDialogControl = Prompt.usePromptControl()
|
const primaryAlgoDialogControl = Prompt.usePromptControl()
|
||||||
|
|
||||||
const {isPending: isSavePending, mutateAsync: saveFeed} =
|
const {isPending: isSavePending, mutateAsync: saveFeed} =
|
||||||
@@ -239,7 +237,7 @@ export function FeedSourceCardLoaded({
|
|||||||
</View>
|
</View>
|
||||||
|
|
||||||
{showFeedSaveButton &&
|
{showFeedSaveButton &&
|
||||||
(isPrimaryAlgoExperimentEnabled && isPrimaryAlgo ? (
|
(gate('reduced_onboarding_and_home_algo') && isPrimaryAlgo ? (
|
||||||
<Button
|
<Button
|
||||||
variant="solid"
|
variant="solid"
|
||||||
color="secondary"
|
color="secondary"
|
||||||
|
|||||||
@@ -54,9 +54,7 @@ function HomeScreenReady({
|
|||||||
pinnedFeedInfos: FeedSourceInfo[]
|
pinnedFeedInfos: FeedSourceInfo[]
|
||||||
}) {
|
}) {
|
||||||
useOTAUpdates()
|
useOTAUpdates()
|
||||||
const isPrimaryAlgoExperimentEnabled = useGate(
|
const gate = useGate()
|
||||||
'reduced_onboarding_and_home_algo',
|
|
||||||
)
|
|
||||||
|
|
||||||
const allFeeds = React.useMemo(() => {
|
const allFeeds = React.useMemo(() => {
|
||||||
const feeds: FeedDescriptor[] = []
|
const feeds: FeedDescriptor[] = []
|
||||||
@@ -66,6 +64,9 @@ function HomeScreenReady({
|
|||||||
} else if (uri.includes('app.bsky.graph.list')) {
|
} else if (uri.includes('app.bsky.graph.list')) {
|
||||||
feeds.push(`list|${uri}`)
|
feeds.push(`list|${uri}`)
|
||||||
} else if (uri === 'primary-algo') {
|
} else if (uri === 'primary-algo') {
|
||||||
|
const isPrimaryAlgoExperimentEnabled = gate(
|
||||||
|
'reduced_onboarding_and_home_algo',
|
||||||
|
)
|
||||||
if (
|
if (
|
||||||
isPrimaryAlgoExperimentEnabled &&
|
isPrimaryAlgoExperimentEnabled &&
|
||||||
preferences.primaryAlgorithm.enabled &&
|
preferences.primaryAlgorithm.enabled &&
|
||||||
@@ -87,11 +88,7 @@ function HomeScreenReady({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return feeds
|
return feeds
|
||||||
}, [
|
}, [pinnedFeedInfos, gate, preferences.primaryAlgorithm])
|
||||||
pinnedFeedInfos,
|
|
||||||
isPrimaryAlgoExperimentEnabled,
|
|
||||||
preferences.primaryAlgorithm,
|
|
||||||
])
|
|
||||||
|
|
||||||
const rawSelectedFeed = useSelectedFeed()
|
const rawSelectedFeed = useSelectedFeed()
|
||||||
const setSelectedFeed = useSetSelectedFeed()
|
const setSelectedFeed = useSetSelectedFeed()
|
||||||
@@ -137,7 +134,6 @@ function HomeScreenReady({
|
|||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
const gate = useGate()
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
const listener = AppState.addEventListener('change', nextAppState => {
|
const listener = AppState.addEventListener('change', nextAppState => {
|
||||||
if (nextAppState === 'active') {
|
if (nextAppState === 'active') {
|
||||||
|
|||||||
@@ -168,7 +168,8 @@ export function ProfileFeedScreenInner({
|
|||||||
const playHaptic = useHaptics()
|
const playHaptic = useHaptics()
|
||||||
const feedSectionRef = React.useRef<SectionRef>(null)
|
const feedSectionRef = React.useRef<SectionRef>(null)
|
||||||
const isScreenFocused = useIsFocused()
|
const isScreenFocused = useIsFocused()
|
||||||
const isPrimaryAlgoExperimentEnabled = useGate(
|
const gate = useGate()
|
||||||
|
const isPrimaryAlgoExperimentEnabled = gate(
|
||||||
'reduced_onboarding_and_home_algo',
|
'reduced_onboarding_and_home_algo',
|
||||||
)
|
)
|
||||||
const primaryAlgoDialogControl = useDialogControl()
|
const primaryAlgoDialogControl = useDialogControl()
|
||||||
|
|||||||
Reference in New Issue
Block a user