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

Add support for channel member extra data #3487

Merged
merged 25 commits into from
Nov 18, 2024

Conversation

nuno-vieira
Copy link
Member

@nuno-vieira nuno-vieira commented Nov 12, 2024

🔗 Issue Links

https://linear.app/stream/issue/IOS-27

🎯 Goal

Add support for adding and reading extra data from channel members.

📝 Summary

  • Adds ChatChannelMemberController.partialUpdate() to add extra data to a member of a channel
  • Adds CurrentChatUserController.updateMemberData() to add extra data to the current user's member of a channel
  • Adds ChatChannelMember.memberExtraData to access member's specific extra data
  • Changes ChatChannelController.addMembers() to accept an array of MemberInfo instead of UserId so that it is possible to add additional data to the member.
  • Deprecates the addMembers method, which only supports userIds.
  • Adds a "Premium Member Feature" to the Demo App in order to be able to test this new feature (Behind a feature flag)

🛠 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 of ChatUser, 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 member
Partial 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 member

Backend 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

  • I have signed the Stream CLA (required)
  • This change should be manually QAed
  • Changelog is updated with client-facing changes
  • Changelog is updated with new localization keys
  • New code is covered by unit tests
  • Comparison screenshots added for visual changes
  • Affected documentation updated (docusaurus, tutorial, CMS)

@nuno-vieira nuno-vieira requested a review from a team as a code owner November 12, 2024 19:20
@nuno-vieira nuno-vieira added 🌐 SDK: StreamChat (LLC) Tasks related to the StreamChat LLC SDK ✅ Feature An issue or PR related to a feature labels Nov 12, 2024
Copy link

github-actions bot commented Nov 12, 2024

2 Warnings
⚠️ Big PR
⚠️ The changes should be manually QAed before the Pull Request will be merged

Generated by 🚫 Danger

@Stream-SDK-Bot
Copy link
Collaborator

Stream-SDK-Bot commented Nov 12, 2024

SDK Size

title develop branch diff status
StreamChat 6.92 MB 6.96 MB +37 KB 🟢
StreamChatUI 4.95 MB 4.95 MB 0 KB 🟢

@Stream-SDK-Bot
Copy link
Collaborator

SDK Performance

target metric benchmark branch performance status
MessageList Hitches total duration 10 ms 1.67 ms 83.3% 🔼 🟢
Duration 2.6 s 2.54 s 2.31% 🔼 🟢
Hitch time ratio 4 ms per s 0.66 ms per s 83.5% 🔼 🟢
Frame rate 75 fps 78.21 fps 4.28% 🔼 🟢
Number of hitches 1 0.2 80.0% 🔼 🟢

@Stream-SDK-Bot
Copy link
Collaborator

Stream-SDK-Bot commented Nov 13, 2024

SDK Size

title develop branch diff status
StreamChat 6.92 MB 6.96 MB +38 KB 🟢
StreamChatUI 4.95 MB 4.95 MB 0 KB 🟢

Copy link
Contributor

@martinmitrevski martinmitrevski left a 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/Models/Member.swift Outdated Show resolved Hide resolved
Copy link
Contributor

@martinmitrevski martinmitrevski left a 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.

@nuno-vieira nuno-vieira added the 🤞 Ready For QA A PR that is Ready for QA label Nov 15, 2024
@testableapple testableapple added 🧪 QAing and removed 🤞 Ready For QA A PR that is Ready for QA labels Nov 18, 2024
Copy link

sonarcloud bot commented Nov 18, 2024

@testableapple testableapple added 🟢 QAed A PR that was QAed and removed 🧪 QAing labels Nov 18, 2024
@nuno-vieira nuno-vieira merged commit db89cf7 into develop Nov 18, 2024
1 check passed
@nuno-vieira nuno-vieira deleted the add/channel-members-extra-data branch November 18, 2024 16:43
@Stream-SDK-Bot Stream-SDK-Bot mentioned this pull request Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✅ Feature An issue or PR related to a feature 🟢 QAed A PR that was QAed 🌐 SDK: StreamChat (LLC) Tasks related to the StreamChat LLC SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants