Skip to content

Commit

Permalink
fix up the reaction codec
Browse files Browse the repository at this point in the history
  • Loading branch information
nplasterer committed Dec 1, 2023
1 parent db7e361 commit c6d8533
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion example/src/HomeScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ function ConversationItem({
</View>
<View style={{ padding: 4 }}>
<Text numberOfLines={1} ellipsizeMode="tail">
{lastMessage?.content().text}
{lastMessage?.fallback}
</Text>
<Text>{lastMessage?.senderAddress}:</Text>
<Text>{moment(lastMessage?.sent).fromNow()}</Text>
Expand Down
3 changes: 2 additions & 1 deletion example/src/LaunchScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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()] })

Check warning on line 90 in example/src/LaunchScreen.tsx

View workflow job for this annotation

GitHub Actions / lint

Replace `·env:·'local',·appVersion,·codecs:·[new·XMTP.ReactionCodec()]` with `⏎················env:·'local',⏎················appVersion,⏎················codecs:·[new·XMTP.ReactionCodec()],⏎·············`
)
}}
/>
Expand Down Expand Up @@ -132,6 +132,7 @@ export default function LaunchScreen({
XMTP.Client.createFromKeyBundle(savedKeys.keyBundle!, {
env: 'local',
appVersion,
codecs: [new XMTP.ReactionCodec()]

Check warning on line 135 in example/src/LaunchScreen.tsx

View workflow job for this annotation

GitHub Actions / lint

Insert `,`
})
)
}}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/DecodedMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export class DecodedMessage<ContentTypes = any> {
}
}

throw new Error('no content type found')
throw new Error(`no content type found ${JSON.stringify(this.nativeContent)}`)
}
}
}
2 changes: 1 addition & 1 deletion src/lib/NativeCodecs/ReactionCodec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
} from '../ContentCodec'

export class ReactionCodec implements NativeContentCodec<ReactionContent> {
contentKey: string = 'attachment'
contentKey: string = 'reaction'

contentType: ContentTypeId = {
authorityId: 'xmtp.org',
Expand Down

0 comments on commit c6d8533

Please sign in to comment.