Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Messages with reactions function, dm fix #596

Merged
merged 12 commits into from
Feb 3, 2025

Conversation

cameronvoell
Copy link
Contributor

@cameronvoell cameronvoell commented Jan 30, 2025

To do:

Copy link

changeset-bot bot commented Jan 30, 2025

⚠️ No Changeset found

Latest commit: faad8de

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@@ -159,6 +177,18 @@ class ContentJson(
)
)

ContentTypeReactionV2.id -> {
val reaction: FfiReaction = decodeReaction(encodedContent!!.toByteArray())
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reactionV2 in this PR mainly serves to show how proto based ContentTypes that are used in libxmtp and upstream xmtp-android/ios can be utilized in React Native.

In this PR, we're basically converting the proto type back to json before utilizing the Reaction content in RN typescript code. An alternative would be to send the reaction content as bytes over the RN bridge and deserialize the bytes to the Reaction proto object in typescript. This pattern would generally lead to less data going over the RN bridge and would probably be a net gain for pretty much all data classes we use. However, it probably makes sense to start implementing that pattern in a separate PR.

Lastly, in a follow up, we can delete the reactionV2Codec in RN, and simply update the ContentTypeId version from 1.0 to 2.0, and the underlying SDK will switch from using JSON serializing to proto serializing without RN integrators knowing the difference. One exception is that old clients will not be able to deserialize messages sent with the proto backed reactions, but they should recognize that the version has been updated, and display the fallback instead. maintaining the two different Reaction and ReactionV2 for a short while in RN will help us test those paths.

@@ -0,0 +1,194 @@
diff --git a/node_modules/react-native/sdks/hermes/hermes-engine.podspec b/node_modules/react-native/sdks/hermes/hermes-engine.podspec
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See issue here on incorrect checksum error for boost dependency. Only affects our RN example app - facebook/react-native#42180

@@ -1,10 +1,15 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"changelog": [
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the documentation isnt super clear on this, but hoping this will fix our changesets not creating github release / tag.

@cameronvoell cameronvoell marked this pull request as ready for review February 3, 2025 20:25
@cameronvoell cameronvoell requested review from a team as code owners February 3, 2025 20:25
action = getReactionV2Action(reaction.get("action").asString.lowercase()),
schema = getReactionV2Schema(reaction.get("schema").asString.lowercase()),
content = reaction.get("content").asString,
referenceInboxId = ""
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: is that intentional left empty?

Copy link
Contributor Author

@cameronvoell cameronvoell Feb 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea that property is sort of stubbed in for now, as I noticed it was included in the xmtp-js reaction type: https://github.com/xmtp/xmtp-js/blob/80aa5ec4fb24b60def222537cebcb20c818ca993/content-types/content-type-reaction/src/Reaction.ts#L24

However xmtp-react-native has an existing ReactionContent type that didn't feel worth updating at this point since I'm not sure what referenceInboxId would actually be used for.

definitely a code smell though, I added a clarifying comments here 👌: faad8de

@cameronvoell
Copy link
Contributor Author

@cameronvoell cameronvoell merged commit 3dac8cb into main Feb 3, 2025
5 of 6 checks passed
@cameronvoell cameronvoell deleted the cv/01-21-messagewithreactions_function branch February 3, 2025 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants