Skip to content

Conversation

@VelikovPetar
Copy link
Contributor

🎯 Goal

We are incorrectly increasing the channel unread count locally for muted channels on message.new and notification.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 after QueryChannels.

Resolves: https://linear.app/stream/issue/AND-736/analyse-wrong-unread-count-for-muted-channels

🛠 Implementation details

  • Prevents increasing of the local unread count for the channel if the channel is muted
  • Syncs the mute state when the ChannelLogicState is initialised, to ensure that the correct state is present at all times

🎨 UI Changes

Before After
before.mov
after.mov

🧪 Testing

  1. Mute a channel
  2. Write messages in the same channel from a different user
  3. Ensure the unread count is not increased (verify by reloading the channel list)

@VelikovPetar VelikovPetar requested a review from Copilot October 3, 2025 16:32
@VelikovPetar VelikovPetar marked this pull request as ready for review October 3, 2025 16:32
@VelikovPetar VelikovPetar requested a review from a team as a code owner October 3, 2025 16:32
Copy link
Contributor

Copilot AI left a 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.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 3, 2025

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 3.22 MB 3.22 MB 0.00 MB 🟢
stream-chat-android-offline 3.45 MB 3.45 MB 0.00 MB 🟢
stream-chat-android-ui-components 10.54 MB 10.54 MB 0.00 MB 🟢
stream-chat-android-compose 12.75 MB 12.75 MB 0.00 MB 🟢

@andremion andremion enabled auto-merge (squash) October 8, 2025 13:29
@sonarqubecloud
Copy link

sonarqubecloud bot commented Oct 8, 2025

@andremion andremion merged commit 7af6b97 into develop Oct 8, 2025
13 checks passed
@andremion andremion deleted the bug/fix-increasing-unread-count-for-muted-channels branch October 8, 2025 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants