mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-01-11 01:10:13 +00:00
Fix inactive window notifications clearing.
This commit is contained in:
parent
8000dfac01
commit
ca2692473d
@ -2694,21 +2694,25 @@ void HistoryWidget::visibleAreaUpdated() {
|
||||
const auto scrollTop = _scroll->scrollTop();
|
||||
const auto scrollBottom = scrollTop + _scroll->height();
|
||||
_list->visibleAreaUpdated(scrollTop, scrollBottom);
|
||||
controller()->floatPlayerAreaUpdated().notify(true);
|
||||
|
||||
const auto atBottom = (scrollTop >= _scroll->scrollTopMax());
|
||||
if (_history->loadedAtBottom() && (_history->unreadCount() > 0 || (_migrated && _migrated->unreadCount() > 0))) {
|
||||
if (_history->loadedAtBottom()
|
||||
&& atBottom
|
||||
&& App::wnd()->doWeReadServerHistory()) {
|
||||
// Clear possible scheduled messages notifications.
|
||||
session().api().readServerHistory(_history);
|
||||
session().notifications().clearFromHistory(_history);
|
||||
} else if (_history->loadedAtBottom()
|
||||
&& (_history->unreadCount() > 0
|
||||
|| (_migrated && _migrated->unreadCount() > 0))) {
|
||||
const auto unread = firstUnreadMessage();
|
||||
const auto unreadVisible = unread
|
||||
&& (scrollBottom > _list->itemTop(unread));
|
||||
if ((unreadVisible || atBottom)
|
||||
&& App::wnd()->doWeReadServerHistory()) {
|
||||
if (unreadVisible && App::wnd()->doWeReadServerHistory()) {
|
||||
session().api().readServerHistory(_history);
|
||||
}
|
||||
}
|
||||
if (_history->loadedAtBottom() && atBottom) {
|
||||
// Clear possible scheduled messages notifications.
|
||||
session().notifications().clearFromHistory(_history);
|
||||
}
|
||||
controller()->floatPlayerAreaUpdated().notify(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user