Skip to content

Commit

Permalink
Fix reply to (#1326)
Browse files Browse the repository at this point in the history
  • Loading branch information
lourou authored Dec 9, 2024
1 parent 307eba5 commit d4108ff
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
16 changes: 11 additions & 5 deletions components/Chat/Message/message-content-types/message-reply.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,15 @@ import { useQuery } from "@tanstack/react-query";
import { useAppTheme } from "@theme/useAppTheme";
import { sentryTrackError } from "@utils/sentry";
import { getReadableProfile } from "@utils/str";
import { DecodedMessage, MessageId, ReplyCodec } from "@xmtp/react-native-sdk";
import {
DecodedMessage,
InboxId,
MessageId,
ReplyCodec,
} from "@xmtp/react-native-sdk";
import { memo } from "react";
import { getCurrentConversationMessages } from "../../../../features/conversation/conversation-service";
import { usePreferredInboxName } from "@/hooks/usePreferredInboxName";

export const MessageReply = memo(function MessageReply(props: {
message: DecodedMessage<[ReplyCodec]>;
Expand Down Expand Up @@ -116,9 +122,9 @@ const MessageReplyReference = memo(function MessageReplyReference(props: {
const replyMessageReference =
useConversationMessageForReplyMessage(referenceMessageId);

const readableProfile = replyMessageReference
? getReadableProfile(currentAccount, replyMessageReference.senderAddress)
: null;
const inboxName = usePreferredInboxName(
replyMessageReference?.senderAddress as InboxId
);

return (
<VStack
Expand Down Expand Up @@ -151,7 +157,7 @@ const MessageReplyReference = memo(function MessageReplyReference(props: {
}
/>
<Text preset="smaller" color="secondary" inverted={fromMe}>
{readableProfile}
{inboxName}
</Text>
</HStack>
{!!replyMessageReference && (
Expand Down
12 changes: 7 additions & 5 deletions features/conversation/composer/composer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { sentryTrackError } from "@utils/sentry";
import { DecodedMessageWithCodecsType } from "@utils/xmtpRN/client";
import {
DecodedMessage,
InboxId,
MessageId,
RemoteAttachmentCodec,
RemoteAttachmentContent,
Expand Down Expand Up @@ -64,6 +65,7 @@ import {
} from "../conversation-service";
import { AddAttachmentButton } from "./add-attachment-button";
import { ISendMessageParams } from "@/features/conversation/conversation-context";
import { usePreferredInboxName } from "@/hooks/usePreferredInboxName";

export type IComposerSendArgs = ISendMessageParams;

Expand Down Expand Up @@ -230,15 +232,15 @@ const ReplyPreview = memo(function ReplyPreview() {
? getConversationMessages(currentAccount, topic!)?.byId[replyingToMessageId]
: undefined;

const readableProfile = replyMessage
? getReadableProfile(currentAccount, replyMessage?.senderAddress)
: null;
const inboxName = usePreferredInboxName(
replyMessage?.senderAddress as InboxId
);

const replyingTo = replyMessage
? replyMessage.senderAddress === currentAccountInboxId
? `Replying to you`
: readableProfile
? `Replying to ${readableProfile}`
: inboxName
? `Replying to ${inboxName}`
: "Replying"
: "";

Expand Down

0 comments on commit d4108ff

Please sign in to comment.