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 Channel List .hasUnread filter #3340

Merged
merged 10 commits into from
Jul 30, 2024

Conversation

nuno-vieira
Copy link
Member

@nuno-vieira nuno-vieira commented Jul 29, 2024

🔗 Issue Links

Resolves https://stream-io.atlassian.net/browse/PBE-5351

🎯 Goal

  • Expose .hasUnread channel list filter option
  • Fix sorting channel list by unread count

🛠 Implementation

In order to support automatic filtering, I had to add a new property to ChannelDTO.currentUserUnreadMessagesCount which is computed from ChannelDTO.reads. Otherwise, it was not possible to create an NSPredicate out of ChannelDTO.reads.

By adding this property, we can now make the sorting of unreadCount work properly, which was not working before as well.

🎨 Showcase

Usage: ChannelListQuery(filter: .hasUnread)

Demo:

Unreads.mov

🧪 Manual Testing Notes

Requirements: Use the SwiftUI API Keys. (The hasUnread is not working on the default keys)

1- Login
2- Tap on filters button (right top corner)
3- Tap on Unread Channels
4- Should see only unread channels and sorted by unread count

☑️ 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 added 🐞 Bug An issue or PR related to a bug 🌐 SDK: StreamChat (LLC) Tasks related to the StreamChat LLC SDK ✅ Feature An issue or PR related to a feature labels Jul 29, 2024
@nuno-vieira nuno-vieira requested a review from a team as a code owner July 29, 2024 15:36
Copy link

github-actions bot commented Jul 29, 2024

1 Warning
⚠️ The changes should be manually QAed before the Pull Request will be merged

Generated by 🚫 Danger

@Stream-SDK-Bot
Copy link
Collaborator

SDK Size

title develop branch diff status
StreamChat 6.8MB 6.8MB 0.0MB 🟢
StreamChatUI 4.4MB 4.4MB 0.0MB 🟢

@Stream-SDK-Bot
Copy link
Collaborator

SDK Performance

target metric benchmark branch performance status
MessageList Hitches total duration 10 ms 6.68 ms 33.2% 🔼 🟢
Duration 2.6 s 2.54 s 2.31% 🔼 🟢
Hitch time ratio 4 ms per s 2.62 ms per s 34.5% 🔼 🟢
Frame rate 75 fps 78.23 fps 4.31% 🔼 🟢
Number of hitches 1 0.6 40.0% 🔼 🟢
ChannelList Hitches total duration 12.5 ms 15.86 ms -26.88% 🔽 🔴
Duration 2.6 s 2.55 s 1.92% 🔼 🟢
Hitch time ratio 5 ms per s 6.23 ms per s -24.6% 🔽 🔴
Frame rate 72 fps 74.21 fps 3.07% 🔼 🟢
Number of hitches 1.2 1.4 -16.67% 🔽 🔴

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 ✅

@Stream-SDK-Bot
Copy link
Collaborator

Stream-SDK-Bot commented Jul 29, 2024

SDK Size

title develop branch diff status
StreamChat 6.76MB 6.76MB 0.0MB 🟢
StreamChatUI 4.41MB 4.41MB 0.0MB 🟢

@nuno-vieira nuno-vieira added the 🤞 Ready For QA A PR that is Ready for QA label Jul 29, 2024
@nuno-vieira nuno-vieira enabled auto-merge (squash) July 29, 2024 16:00
@nuno-vieira nuno-vieira disabled auto-merge July 29, 2024 16:54
Copy link

@testableapple testableapple added 🟢 QAed A PR that was QAed and removed 🤞 Ready For QA A PR that is Ready for QA labels Jul 30, 2024
@nuno-vieira nuno-vieira merged commit 9585540 into develop Jul 30, 2024
16 checks passed
@nuno-vieira nuno-vieira deleted the add/expose-has-unread-channel-list-filter branch July 30, 2024 09:34
@Stream-SDK-Bot Stream-SDK-Bot mentioned this pull request Jul 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 Bug An issue or PR related to a bug ✅ 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.

5 participants