mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-25 20:48:52 +03:00
Update unread messages for the current room when the app is inactive
This commit is contained in:
parent
e1d48367f8
commit
e680865593
1 changed files with 9 additions and 3 deletions
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
#include <random>
|
#include <random>
|
||||||
|
|
||||||
|
#include <QApplication>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QStackedWidget>
|
#include <QStackedWidget>
|
||||||
|
@ -108,9 +109,14 @@ void HistoryViewManager::sync(const Rooms &rooms)
|
||||||
|
|
||||||
int msgs_added = view->addEvents(events);
|
int msgs_added = view->addEvents(events);
|
||||||
|
|
||||||
// TODO: Take into account window focus
|
if (msgs_added > 0) {
|
||||||
if (msgs_added > 0 && roomid != active_room_.id())
|
// TODO: When window gets active the current
|
||||||
emit unreadMessages(roomid, msgs_added);
|
// unread count (if any) should be cleared.
|
||||||
|
auto isAppActive = QApplication::activeWindow() != nullptr;
|
||||||
|
|
||||||
|
if (roomid != active_room_.id() || !isAppActive)
|
||||||
|
emit unreadMessages(roomid, msgs_added);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue