diff --git a/src/lib/statsig/gates.ts b/src/lib/statsig/gates.ts index 391314162c..befa993191 100644 --- a/src/lib/statsig/gates.ts +++ b/src/lib/statsig/gates.ts @@ -7,6 +7,7 @@ export type Gate = | 'debug_subscriptions' | 'disable_onboarding_policy_update_notice' | 'explore_show_suggested_feeds' + | 'feed_reply_button_open_thread' | 'old_postonboarding' | 'onboarding_add_video_feed' | 'onboarding_suggested_accounts' diff --git a/src/view/com/posts/PostFeedItem.tsx b/src/view/com/posts/PostFeedItem.tsx index 2f03a168b5..91eca5ba1d 100644 --- a/src/view/com/posts/PostFeedItem.tsx +++ b/src/view/com/posts/PostFeedItem.tsx @@ -11,6 +11,7 @@ import { } from '@atproto/api' import {msg, Trans} from '@lingui/macro' import {useLingui} from '@lingui/react' +import {useNavigation} from '@react-navigation/native' import {useQueryClient} from '@tanstack/react-query' import {useActorStatus} from '#/lib/actor-status' @@ -19,6 +20,8 @@ import {MAX_POST_LINES} from '#/lib/constants' import {useOpenComposer} from '#/lib/hooks/useOpenComposer' import {usePalette} from '#/lib/hooks/usePalette' import {makeProfileLink} from '#/lib/routes/links' +import {type NavigationProp} from '#/lib/routes/types' +import {useGate} from '#/lib/statsig/statsig' import {sanitizeDisplayName} from '#/lib/strings/display-names' import {sanitizeHandle} from '#/lib/strings/handles' import {countLines} from '#/lib/strings/helpers' @@ -167,35 +170,50 @@ let FeedItemInner = ({ }): React.ReactNode => { const queryClient = useQueryClient() const {openComposer} = useOpenComposer() + const navigation = useNavigation() const pal = usePalette('default') + const gate = useGate() const {_} = useLingui() const [hover, setHover] = useState(false) - const href = useMemo(() => { + const [href, rkey] = useMemo(() => { const urip = new AtUri(post.uri) - return makeProfileLink(post.author, 'post', urip.rkey) + return [makeProfileLink(post.author, 'post', urip.rkey), urip.rkey] }, [post.uri, post.author]) const {sendInteraction, feedSourceInfo} = useFeedFeedbackContext() const onPressReply = () => { - sendInteraction({ - item: post.uri, - event: 'app.bsky.feed.defs#interactionReply', - feedContext, - reqId, - }) - openComposer({ - replyTo: { - uri: post.uri, - cid: post.cid, - text: record.text || '', - author: post.author, - embed: post.embed, - moderation, - langs: record.langs, - }, - }) + if (gate('feed_reply_button_open_thread')) { + sendInteraction({ + item: post.uri, + event: 'app.bsky.feed.defs#clickthroughItem', + feedContext, + reqId, + }) + navigation.navigate('PostThread', { + name: post.author.did, + rkey, + }) + } else { + sendInteraction({ + item: post.uri, + event: 'app.bsky.feed.defs#interactionReply', + feedContext, + reqId, + }) + openComposer({ + replyTo: { + uri: post.uri, + cid: post.cid, + text: record.text || '', + author: post.author, + embed: post.embed, + moderation, + langs: record.langs, + }, + }) + } } const onOpenAuthor = () => {