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 additional sorting filter keys for member list query #3535

Merged
merged 2 commits into from
Dec 18, 2024

Conversation

laevandus
Copy link
Contributor

@laevandus laevandus commented Dec 17, 2024

🔗 Issue Links

Resolves: IOS-605

🎯 Goal

No way for filtering by channel_role and sorting by channel_role in member list queries.

📝 Summary

  • Add member list filtering keys: FilterKey.channelRole and FilterKey.email
  • Add member list sorting key: ChannelMemberListSortingKey.channelRole
  • Encode MemberRole.member as channel_member and MemberRole.moderator as channel_moderator

🛠 Implementation

🧪 Manual Testing Notes

Example snippet for testing filtering and sorting (chewbacca)

let query = ChannelMemberListQuery(
    cid: ChannelId(type: .messaging, id: "83100323-A"),
    filter: .equal(.channelRole, to: .member),
    sort: [.init(key: .channelRole)]
)
let memberList = self.makeMemberList(with: query)
do {
    try await memberList.get()
    let members = await memberList.state.members
    print(members.count)
    for member in members {
        print(member.id, member.memberRole.rawValue)
    }
} catch {
    print(error)
}

☑️ 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)

🎁 Meme

Provide a funny gif or image that relates to your work on this pull request. (Optional)

@laevandus laevandus added 🌐 SDK: StreamChat (LLC) Tasks related to the StreamChat LLC SDK 🏗 Missing Feature Parity A feature that is not yet available on the iOS SDK. labels Dec 17, 2024
@laevandus laevandus requested a review from a team as a code owner December 17, 2024 13:08
@laevandus laevandus force-pushed the feature/additional-member-filter-sorting-keys branch from 3e195b3 to b5b91b1 Compare December 17, 2024 13:17
@Stream-SDK-Bot
Copy link
Collaborator

SDK Performance

target metric benchmark branch performance status
MessageList Hitches total duration 10 ms 3.34 ms 66.6% 🔼 🟢
Duration 2.6 s 2.54 s 2.31% 🔼 🟢
Hitch time ratio 4 ms per s 1.32 ms per s 67.0% 🔼 🟢
Frame rate 75 fps 78.26 fps 4.35% 🔼 🟢
Number of hitches 1 0.4 60.0% 🔼 🟢

@Stream-SDK-Bot
Copy link
Collaborator

Stream-SDK-Bot commented Dec 17, 2024

SDK Size

title develop branch diff status
StreamChat 7.03 MB 7.03 MB +1 KB 🟢
StreamChatUI 4.77 MB 4.77 MB 0 KB 🟢

Comment on lines +163 to +173
func encode(to encoder: any Encoder) throws {
var container = encoder.singleValueContainer()
switch self {
case .member:
try container.encode("channel_member")
case .moderator:
try container.encode("channel_moderator")
default:
try container.encode(rawValue)
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

MemberRole must be encoded like this when using it as member list filter or as sorting key. Note that MemberRole.member is used for member and channel_member values (same with moderation).

@laevandus laevandus force-pushed the feature/additional-member-filter-sorting-keys branch from 8e08dac to cf977c5 Compare December 18, 2024 07:54
@laevandus laevandus added the 🤞 Ready For QA A PR that is Ready for QA label Dec 18, 2024
@testableapple testableapple added 🟢 QAed A PR that was QAed and removed 🤞 Ready For QA A PR that is Ready for QA labels Dec 18, 2024
@laevandus laevandus merged commit c665547 into develop Dec 18, 2024
14 checks passed
@laevandus laevandus deleted the feature/additional-member-filter-sorting-keys branch December 18, 2024 10:44
@Stream-SDK-Bot Stream-SDK-Bot mentioned this pull request Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏗 Missing Feature Parity A feature that is not yet available on the iOS SDK. 🟢 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