From 8f6181495e52a47f8085e0fe92ded6cac35a8df4 Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Mon, 3 Aug 2026 19:38:24 +0300 Subject: [PATCH] migrate the notification say-hello action to the chat client Co-Authored-By: Claude Fable 5 --- .../notifications/NotificationFeedItem.tsx | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/view/com/notifications/NotificationFeedItem.tsx b/src/view/com/notifications/NotificationFeedItem.tsx index c11cb8049b..2afb3a0f43 100644 --- a/src/view/com/notifications/NotificationFeedItem.tsx +++ b/src/view/com/notifications/NotificationFeedItem.tsx @@ -21,12 +21,13 @@ import { type ModerationOpts, } from '@atproto/api' import {TID} from '@atproto/common-web' +import {type DidString} from '@atproto/syntax' import {plural} from '@lingui/core/macro' import {Plural, Trans, useLingui} from '@lingui/react/macro' import {useNavigation} from '@react-navigation/native' import {useQueryClient} from '@tanstack/react-query' -import {DM_SERVICE_HEADERS, MAX_POST_LINES} from '#/lib/constants' +import {MAX_POST_LINES} from '#/lib/constants' import {useAnimatedValue} from '#/lib/hooks/useAnimatedValue' import {makeProfileLink} from '#/lib/routes/links' import {type NavigationProp} from '#/lib/routes/types' @@ -38,7 +39,7 @@ import {useProfileShadow} from '#/state/cache/profile-shadow' import {type FeedNotification} from '#/state/queries/notifications/feed' import {useProfileFollowMutationQueue} from '#/state/queries/profile' import {unstableCacheProfileView} from '#/state/queries/unstable-profile-cache' -import {useAgent, useSession} from '#/state/session' +import {useChatClient, useSession} from '#/state/session' import {FeedSourceCard} from '#/view/com/feeds/FeedSourceCard' import {Post} from '#/view/com/post/Post' import {formatCount} from '#/view/com/util/numeric/format' @@ -73,6 +74,7 @@ import * as Toast from '#/components/Toast' import {Text} from '#/components/Typography' import {useAnalytics} from '#/analytics' import {IS_WEB} from '#/env' +import {chat} from '#/lexicons' import * as bsky from '#/types/bsky' const MAX_AUTHORS = 5 @@ -911,21 +913,21 @@ function FollowBackButton({profile}: {profile: AppBskyActorDefs.ProfileView}) { function SayHelloBtn({profile}: {profile: AppBskyActorDefs.ProfileView}) { const {t: l} = useLingui() - const agent = useAgent() + const client = useChatClient() + const {currentAccount} = useSession() const navigation = useNavigation() const [isLoading, setIsLoading] = useState(false) const onPress = async () => { try { setIsLoading(true) - const res = await agent.api.chat.bsky.convo.getConvoForMembers( - { - members: [profile.did, agent.session!.did], - }, - {headers: DM_SERVICE_HEADERS}, - ) + const data = await client.call(chat.bsky.convo.getConvoForMembers, { + // both dids are already resolved - one from the profile view, one from + // the active session + members: [profile.did, currentAccount!.did] as DidString[], + }) navigation.navigate('MessagesConversation', { - conversation: res.data.convo.id, + conversation: data.convo.id, }) } catch (e) { logger.error('Failed to get conversation', {safeMessage: e})