From c6d85332d86bee91f9f6484bbbdeecdd60ed6b9e Mon Sep 17 00:00:00 2001 From: Naomi Plasterer Date: Fri, 1 Dec 2023 12:23:59 -0800 Subject: [PATCH] fix up the reaction codec --- example/src/HomeScreen.tsx | 2 +- example/src/LaunchScreen.tsx | 3 ++- src/lib/DecodedMessage.ts | 2 +- src/lib/NativeCodecs/ReactionCodec.ts | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/example/src/HomeScreen.tsx b/example/src/HomeScreen.tsx index 0a551d145..00d5d4c2e 100644 --- a/example/src/HomeScreen.tsx +++ b/example/src/HomeScreen.tsx @@ -98,7 +98,7 @@ function ConversationItem({ - {lastMessage?.content().text} + {lastMessage?.fallback} {lastMessage?.senderAddress}: {moment(lastMessage?.sent).fromNow()} diff --git a/example/src/LaunchScreen.tsx b/example/src/LaunchScreen.tsx index 9d58653a7..0a0842eb9 100644 --- a/example/src/LaunchScreen.tsx +++ b/example/src/LaunchScreen.tsx @@ -87,7 +87,7 @@ export default function LaunchScreen({ onPress={() => { configureWallet( 'local', - XMTP.Client.createRandom({ env: 'local', appVersion }) + XMTP.Client.createRandom({ env: 'local', appVersion, codecs: [new XMTP.ReactionCodec()] }) ) }} /> @@ -132,6 +132,7 @@ export default function LaunchScreen({ XMTP.Client.createFromKeyBundle(savedKeys.keyBundle!, { env: 'local', appVersion, + codecs: [new XMTP.ReactionCodec()] }) ) }} diff --git a/src/lib/DecodedMessage.ts b/src/lib/DecodedMessage.ts index 57a489139..078a87d9d 100644 --- a/src/lib/DecodedMessage.ts +++ b/src/lib/DecodedMessage.ts @@ -97,7 +97,7 @@ export class DecodedMessage { } } - throw new Error('no content type found') + throw new Error(`no content type found ${JSON.stringify(this.nativeContent)}`) } } } diff --git a/src/lib/NativeCodecs/ReactionCodec.ts b/src/lib/NativeCodecs/ReactionCodec.ts index f5d54b3b3..9eabf8e6c 100644 --- a/src/lib/NativeCodecs/ReactionCodec.ts +++ b/src/lib/NativeCodecs/ReactionCodec.ts @@ -6,7 +6,7 @@ import { } from '../ContentCodec' export class ReactionCodec implements NativeContentCodec { - contentKey: string = 'attachment' + contentKey: string = 'reaction' contentType: ContentTypeId = { authorityId: 'xmtp.org',