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

Custom content types #155

Merged
merged 38 commits into from
Dec 2, 2023
Merged

Custom content types #155

merged 38 commits into from
Dec 2, 2023

Conversation

nakajima
Copy link
Contributor

@nakajima nakajima commented Nov 27, 2023

Introduces the ability to use custom content types on iOS (Kotlin support to follow).

This PR does not replace any of the existing content types that already ship with SDK. Instead it changes DecodedMessage#content to be a function rather than a property. The function will either return the same values it does today or the decoded content from a JS content codec.

If we dig this overall approach then we can look into replacing the hard coded codecs in a couple places, but I don't know what that would look like for codecs that require a native component (like attachments).

Basic usage can be seen in the tests:

Note: This solution is only suitable for very basic content types.
For things like remote attachments, a native component will still
be necessary for performance.
@nakajima nakajima marked this pull request as ready for review November 27, 2023 22:03
@nakajima nakajima requested a review from a team as a code owner November 27, 2023 22:03
Copy link
Contributor

@nplasterer nplasterer left a comment

Choose a reason for hiding this comment

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

This looks good to me. We should wait to release this till we have the android side implemented. But all the tests except the new one pass for android as well.

src/XMTP.types.ts Show resolved Hide resolved
src/XMTP.types.ts Show resolved Hide resolved
@nplasterer nplasterer changed the title Custom content types on iOS Custom content types Nov 30, 2023
@nplasterer nplasterer requested a review from jhaaaa as a code owner November 30, 2023 21:22
README.md Outdated Show resolved Hide resolved
Copy link
Contributor

@nplasterer nplasterer left a comment

Choose a reason for hiding this comment

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

Just ran the example app and all the tests. LGTM 👍

@nplasterer nplasterer merged commit 718f8a9 into main Dec 2, 2023
4 of 5 checks passed
@nplasterer nplasterer deleted the custom-content-types branch December 2, 2023 00:21
Copy link
Contributor

github-actions bot commented Dec 2, 2023

🎉 This PR is included in version 1.21.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants