-
Notifications
You must be signed in to change notification settings - Fork 212
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
Add support for transforming Messages, Channels and Members #3564
base: develop
Are you sure you want to change the base?
Conversation
SDK Size
|
6066703
to
206c580
Compare
Generated by 🚫 Danger |
Sources/StreamChat/Controllers/ChannelController/ChannelController.swift
Outdated
Show resolved
Hide resolved
StateLayer needs also this. |
@laevandus I've add it to the state layer already 🤔 |
c7b09f2
to
c2307b6
Compare
Co-authored-by: Toomas Vahter <[email protected]>
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.
Looks great, I like this approach more! Few more finishing touches (docs, tests) and we're good to 🚢
SDK Performance
|
SDK Size
|
Quality Gate passedIssues Measures |
🔗 Issue Links
Resolves https://linear.app/stream/issue/IOS-638
🎯 Goal
Add support for transforming Messages, Channels and Members. This will allow changing some of the data of these models at run time.
The most common use case for this feature is to easily allow E2EE encryption.
Note
Our Members and User models are different, and since Member is a subclass of User (Tech Debt), transforming Users would not reflect on Members, so at the moment we only provide transforming members. If in the future Users is needed, it needs to be a new function to transform Users.
📝 Summary
A new
StreamModelsTransformer
protocol is added and can be implemented by customers. Currently, only Channels, Messages and Channel Members are transformable, with limited data that can be changed.Example usage:
With the
replacing
function, if customers want to only change the data of a specific controller, they can do it like so:🛠 Implementation
The way it works is that when
asModel()
transformation happens, we provide a way to change it before returning the final model.🧪 Manual Testing Notes
N/A
☑️ Contributor Checklist
docs-content
repo