-
Notifications
You must be signed in to change notification settings - Fork 301
Fix increasing unread count for muted channels #5947
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
base: develop
Are you sure you want to change the base?
Fix increasing unread count for muted channels #5947
Conversation
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.
Pull Request Overview
This PR fixes incorrect behavior where unread counts were being increased for muted channels, aligning Android behavior with iOS and documentation. It prevents local unread count increases for muted channels and ensures proper mute state initialization.
- Prevents unread count increases for muted channels in
updateCurrentUserRead
- Adds initialization of mute state in
ChannelStateLogic
constructor - Renames and improves mute state synchronization method
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
ChannelStateLogic.kt | Main fix to prevent unread count increases for muted channels and initialize mute state |
ChannelLogic.kt | Updates method call to use renamed syncMuteState method |
ChannelStateLogicTest.kt | Adds comprehensive test coverage for muted channel behavior |
CHANGELOG.md | Documents the bug fix in changelog |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
mutableState.read.value | ||
?.takeUnless { it.lastReceivedEventDate.after(eventReceivedDate) } | ||
?.takeUnless { processedMessageIds.get(message.id) == true } | ||
?.takeUnless { processedMessageIds[message.id] == true } |
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.
[nitpick] This change from .get(message.id)
to [message.id]
is functionally equivalent but the original .get()
method was more explicit about the operation being performed on what appears to be a cache/map structure.
?.takeUnless { processedMessageIds[message.id] == true } | |
?.takeUnless { processedMessageIds.get(message.id) == true } |
Copilot uses AI. Check for mistakes.
SDK Size Comparison 📏
|
|
🎯 Goal
We are incorrectly increasing the channel unread count locally for muted channels on
message.new
andnotification.message_new
events. This PR fixes that behaviour and aligns the behaviour to iOS and follows the documentation: https://getstream.io/chat/docs/android/muting_channels/Additionally, it fixes a bug where the
channelState.muted
state was not initially set properly afterQueryChannels
.Resolves: https://linear.app/stream/issue/AND-736/analyse-wrong-unread-count-for-muted-channels
🛠 Implementation details
ChannelLogicState
is initialised, to ensure that the correct state is present at all times🎨 UI Changes
before.mov
after.mov
🧪 Testing