From 2414559b80ae9916aaa01bcc8da4f8b4cbf64238 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Mon, 20 May 2024 09:56:57 -0500 Subject: [PATCH 01/19] =?UTF-8?q?[=F0=9F=90=B4]=20Don't=20retry=20sends=20?= =?UTF-8?q?(#4111)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Don't retry sends * Don't retry batch sends --- src/state/messages/convo/agent.ts | 37 +++++++++++++------------------ 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/src/state/messages/convo/agent.ts b/src/state/messages/convo/agent.ts index 4418eaae77..71b0b6f2d3 100644 --- a/src/state/messages/convo/agent.ts +++ b/src/state/messages/convo/agent.ts @@ -793,15 +793,13 @@ export class Convo { const {id, message} = pendingMessage - const response = await networkRetry(2, () => { - return this.agent.api.chat.bsky.convo.sendMessage( - { - convoId: this.convoId, - message, - }, - {encoding: 'application/json', headers: DM_SERVICE_HEADERS}, - ) - }) + const response = await this.agent.api.chat.bsky.convo.sendMessage( + { + convoId: this.convoId, + message, + }, + {encoding: 'application/json', headers: DM_SERVICE_HEADERS}, + ) const res = response.data // remove from queue @@ -883,18 +881,15 @@ export class Convo { ) try { - // throw new Error('UNCOMMENT TO TEST RETRY') - const {data} = await networkRetry(2, () => { - return this.agent.api.chat.bsky.convo.sendMessageBatch( - { - items: messageArray.map(({message}) => ({ - convoId: this.convoId, - message, - })), - }, - {encoding: 'application/json', headers: DM_SERVICE_HEADERS}, - ) - }) + const {data} = await this.agent.api.chat.bsky.convo.sendMessageBatch( + { + items: messageArray.map(({message}) => ({ + convoId: this.convoId, + message, + })), + }, + {encoding: 'application/json', headers: DM_SERVICE_HEADERS}, + ) const {items} = data /* From 24f8794d4db517540a2151440deb51bba171f89a Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Mon, 20 May 2024 17:18:56 +0100 Subject: [PATCH 02/19] =?UTF-8?q?[=F0=9F=90=B4]=20DM=20button=20on=20profi?= =?UTF-8?q?le=20(#4097)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add profile button * separate out button to component * normalise subscribe to labeller button size * infinite staletime * use Link rather than Button and change icon * adjust icon position --- src/components/dms/MessageProfileButton.tsx | 39 +++++++++++++ .../Profile/Header/ProfileHeaderLabeler.tsx | 6 +- .../Profile/Header/ProfileHeaderStandard.tsx | 56 ++++++++++++------- .../queries/messages/get-convo-for-members.ts | 32 ++++++++++- src/view/com/profile/ProfileMenu.tsx | 34 +++++------ 5 files changed, 125 insertions(+), 42 deletions(-) create mode 100644 src/components/dms/MessageProfileButton.tsx diff --git a/src/components/dms/MessageProfileButton.tsx b/src/components/dms/MessageProfileButton.tsx new file mode 100644 index 0000000000..6f227de65a --- /dev/null +++ b/src/components/dms/MessageProfileButton.tsx @@ -0,0 +1,39 @@ +import React from 'react' +import {AppBskyActorDefs} from '@atproto/api' +import {msg} from '@lingui/macro' +import {useLingui} from '@lingui/react' + +import {useMaybeConvoForUser} from '#/state/queries/messages/get-convo-for-members' +import {atoms as a, useTheme} from '#/alf' +import {Message_Stroke2_Corner0_Rounded as Message} from '../icons/Message' +import {Link} from '../Link' + +export function MessageProfileButton({ + profile, +}: { + profile: AppBskyActorDefs.ProfileView +}) { + const {_} = useLingui() + const t = useTheme() + + const {data: convoId} = useMaybeConvoForUser(profile.did) + + if (!convoId) return null + + return ( + + + + ) +} diff --git a/src/screens/Profile/Header/ProfileHeaderLabeler.tsx b/src/screens/Profile/Header/ProfileHeaderLabeler.tsx index 459bd0d958..e79b345cd3 100644 --- a/src/screens/Profile/Header/ProfileHeaderLabeler.tsx +++ b/src/screens/Profile/Header/ProfileHeaderLabeler.tsx @@ -128,7 +128,7 @@ let ProfileHeaderLabeler = ({ const onPressSubscribe = React.useCallback( () => - requireAuth(async () => { + requireAuth(async (): Promise => { if (!canSubscribe) { cantSubscribePrompt.open() return @@ -197,7 +197,6 @@ let ProfileHeaderLabeler = ({ diff --git a/src/screens/Profile/Header/ProfileHeaderStandard.tsx b/src/screens/Profile/Header/ProfileHeaderStandard.tsx index f3f2a370da..66141e7826 100644 --- a/src/screens/Profile/Header/ProfileHeaderStandard.tsx +++ b/src/screens/Profile/Header/ProfileHeaderStandard.tsx @@ -28,6 +28,7 @@ import {ProfileMenu} from '#/view/com/profile/ProfileMenu' import * as Toast from '#/view/com/util/Toast' import {atoms as a, useTheme} from '#/alf' import {Button, ButtonIcon, ButtonText} from '#/components/Button' +import {MessageProfileButton} from '#/components/dms/MessageProfileButton' import {Check_Stroke2_Corner0_Rounded as Check} from '#/components/icons/Check' import {PlusLarge_Stroke2_Corner0_Rounded as Plus} from '#/components/icons/Plus' import * as Prompt from '#/components/Prompt' @@ -156,7 +157,14 @@ let ProfileHeaderStandard = ({ style={[a.px_lg, a.pt_md, a.pb_sm]} pointerEvents={isIOS ? 'auto' : 'box-none'}> {isMe ? ( + label={_(msg`Show follows similar to ${profile.handle}`)} + style={{width: 36, height: 36}}> + + + )}