-
Notifications
You must be signed in to change notification settings - Fork 22
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
base: main
Are you sure you want to change the base?
Conversation
|
@@ -159,6 +177,18 @@ class ContentJson( | |||
) | |||
) | |||
|
|||
ContentTypeReactionV2.id -> { | |||
val reaction: FfiReaction = decodeReaction(encodedContent!!.toByteArray()) |
There was a problem hiding this comment.
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.
To do: