2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Count all accounts in Core::App().unreadBadge.

This commit is contained in:
John Preston
2020-06-18 15:17:58 +04:00
parent 357caf8007
commit 3a5ede534e
34 changed files with 255 additions and 175 deletions

View File

@@ -236,8 +236,8 @@ Session::Session(not_null<Main::Session*> session)
setupUserIsContactViewer();
_chatsList.unreadStateChanges(
) | rpl::start_with_next([] {
Notify::unreadCounterUpdated();
) | rpl::start_with_next([=] {
notifyUnreadBadgeChanged();
}, _lifetime);
}
@@ -2082,6 +2082,14 @@ int Session::unreadOnlyMutedBadge() const {
: state.chatsMuted;
}
rpl::producer<> Session::unreadBadgeChanges() const {
return _unreadBadgeChanges.events();
}
void Session::notifyUnreadBadgeChanged() {
_unreadBadgeChanges.fire({});
}
int Session::computeUnreadBadge(const Dialogs::UnreadState &state) const {
const auto all = _session->settings().includeMutedCounter();
return std::max(state.marks - (all ? 0 : state.marksMuted), 0)