Update unread messages for the current room when the app is inactive
This commit is contained in:
parent
e1d48367f8
commit
e680865593
|
@ -17,6 +17,7 @@
|
|||
|
||||
#include <random>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDebug>
|
||||
#include <QSettings>
|
||||
#include <QStackedWidget>
|
||||
|
@ -108,11 +109,16 @@ void HistoryViewManager::sync(const Rooms &rooms)
|
|||
|
||||
int msgs_added = view->addEvents(events);
|
||||
|
||||
// TODO: Take into account window focus
|
||||
if (msgs_added > 0 && roomid != active_room_.id())
|
||||
if (msgs_added > 0) {
|
||||
// TODO: When window gets active the current
|
||||
// unread count (if any) should be cleared.
|
||||
auto isAppActive = QApplication::activeWindow() != nullptr;
|
||||
|
||||
if (roomid != active_room_.id() || !isAppActive)
|
||||
emit unreadMessages(roomid, msgs_added);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void HistoryViewManager::setHistoryView(const RoomInfo &info)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue