stream-chat-flutter icon indicating copy to clipboard operation
stream-chat-flutter copied to clipboard

totalUnreadCount is always 0

Open Jonny1987 opened this issue 1 year ago • 3 comments

Which packages are you using?

stream_chat_flutter

On what platforms did you experience the issue?

Android

What version are you using?

7.1.0 flutter 3.22.0

What happened?

When I log the totalUnreadCount it's always 0 even when the user hasn't read the messages

Steps to reproduce

  1. with either of the following:
    streamChatClient.state.totalUnreadCountStream.listen((count) {
      logger().w('count: ${count.toString()}');
    });
    streamChatClient.on().listen((event) {
      if (event.type == 'message.new') {
        final unreadCount = streamChatClient.state.totalUnreadCount;
        logger().w('unread messages count is now: $unreadCount');
      }
    });
  1. Create two instances of the app

  2. Send a message from one user

  3. With the second user ensure no channel pages have yet been opened

Supporting info to reproduce

No response

Relevant log output

No response

Flutter analyze output

No issues

Flutter doctor output

[✓] Flutter (Channel stable, 3.22.0, on Ubuntu 22.04.4 LTS 6.5.0-28-generic, locale en_US.UTF-8)
    • Flutter version 3.22.0 on channel stable at /home/john/dev/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 5dcb86f68f (3 weeks ago), 2024-05-09 07:39:20 -0500
    • Engine revision f6344b75dc
    • Dart version 3.4.0
    • DevTools version 2.34.3

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /home/john/Android/Sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /opt/android-studio/jbr/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop
    • Ubuntu clang version 14.0.0-1ubuntu1.1
    • cmake version 3.22.1
    • ninja version 1.10.1
    • pkg-config version 0.29.2

[✓] Android Studio (version 2023.3)
    • Android Studio at /opt/android-studio
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160)

[✓] VS Code (version 1.88.1)
    • VS Code at /usr/share/code
    • Flutter extension version 3.90.0

[✓] Connected device (3 available)
    • sdk gphone x86 64 (mobile) • emulator-5554 • android-x64    • Android 13 (API 33) (emulator)
    • Linux (desktop)            • linux         • linux-x64      • Ubuntu 22.04.4 LTS 6.5.0-28-generic
    • Chrome (web)               • chrome        • web-javascript • Google Chrome 123.0.6312.86

[✓] Network resources
    • All expected network resources are available.

• No issues found!

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

Jonny1987 avatar May 30 '24 17:05 Jonny1987

This issue is stale because it has been open for 20 days with no activity.

github-actions[bot] avatar Jun 27 '24 18:06 github-actions[bot]

Has anyone looked into this? I want to show an unread message count and can't until this is fixed

Jonny1987 avatar Jun 27 '24 19:06 Jonny1987

Hey @Jonny1987, we were finalising the 7.3.0 issue so this got a bit delayed. Investigating this now.

d3xvn avatar Jul 03 '24 14:07 d3xvn

This issue is stale because it has been open for 20 days with no activity.

github-actions[bot] avatar Jul 23 '24 18:07 github-actions[bot]

Hi, is this still being looked into?

Jonny1987 avatar Jul 24 '24 14:07 Jonny1987

Hey @Jonny1987, apologies for the delay on this.

Can you confirm that read events are on for your channel type on the dashboard?

Screenshot 2024-08-02 at 2 48 40 PM

d3xvn avatar Aug 02 '24 12:08 d3xvn

Hi @deven98 We have the same issue on 7.2.0 The toggle is on on dashboard

sasha-bezpalchuk avatar Aug 08 '24 08:08 sasha-bezpalchuk

@sasha-bezpalchuk somehow the count works fine for me. Can you give me a minimal reproducible example so I can make sure the same works for me?

d3xvn avatar Aug 20 '24 12:08 d3xvn

@deven98 I've double-checked and it works now. I assume you can close the issue, thanks

sasha-bezpalchuk avatar Aug 20 '24 14:08 sasha-bezpalchuk

Perfect, thanks!

d3xvn avatar Aug 20 '24 14:08 d3xvn