-
Notifications
You must be signed in to change notification settings - Fork 210
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 channel member extra data #3487
Conversation
Generated by 🚫 Danger |
… a channel member including extra data
4ff45d1
to
b90bee3
Compare
SDK Size
|
SDK Performance
|
SDK Size
|
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 good and works well (apart from the last case). Added 2 small things, let me know what you think. And we need the docs - these would be LLC only.
Sources/StreamChat/Controllers/ChannelController/ChannelController.swift
Outdated
Show resolved
Hide resolved
dbbf3d9
to
357fed2
Compare
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.
LGTM ✅ Also, we should add the docs in the other repo.
Quality Gate passedIssues Measures |
🔗 Issue Links
https://linear.app/stream/issue/IOS-27
🎯 Goal
Add support for adding and reading extra data from channel members.
📝 Summary
ChatChannelMemberController.partialUpdate()
to add extra data to a member of a channelCurrentChatUserController.updateMemberData()
to add extra data to the current user's member of a channelChatChannelMember.memberExtraData
to access member's specific extra dataChatChannelController.addMembers()
to accept an array ofMemberInfo
instead ofUserId
so that it is possible to add additional data to the member.addMembers
method, which only supports userIds.🛠 Implementation
ChatChannelMember.memberExtraData
:This new property is added in order to parse the extra data from the channel member object. Because our
ChatChannelMember
object is actually a subclass ofChatUser
, we need a new property to distinguish the user's extra data, and the member's extra data.ChatChannelMemberController.addMembers()
:This method now supports a
MemberInfo
struct, similar to the one we use when connecting a user (UserInfo
).🧪 Manual Testing Notes
Note: It is required to enable the premium member feature on the Demo App. Or use the StreamDevelopers scheme.
Adding members with custom data ✅
1. Login with Leia 2. Open the Debug Actions of a Channel 3. Tap "Add a premium member" 4. It should add the new member and say "Premium member added to the channel"Show custom data when querying members ✅
1. Login with Leia 2. Open the Debug Actions of a Channel 3. Tap "Show Channel Members" 4. It should show all channel members, and the premium members should have a badge 👑Querying members by custom data ✅
1. Login with Leia 2. Open the Debug Actions of a Channel 3. Tap "Show Channel Premium Members" 4. It should show only the premium members 👑Partial update current member with custom data ✅
1. Login with Leia 2. Open the Debug Actions of a Channel 3. Tap "Set current member as premium" 5. It should make the current logged in member, a premium memberPartial update a member with custom data 🟡
1. Login with Leia 2. Open the Debug Actions of a Channel 3. Tap "Set member as premium" 4. Make sure to select a member that is not already a premium member 5. It should make that existing member, a premium memberBackend Bug: At the moment, this always updates the current user, independent of the user id provided. This is getting fixed by the backend soon.
☑️ Contributor Checklist