NotificationManager rework

Rework notifications manager to no longer be a singleton, but a component of controller.

The dependency on it for neochat room and connection is also removed.
This commit is contained in:
James Graham
2024-10-06 17:14:18 +00:00
parent 71468e453c
commit 1237e9d4bd
9 changed files with 107 additions and 91 deletions

View File

@@ -10,7 +10,6 @@
#include "jobs/neochatdeactivateaccountjob.h"
#include "neochatconfig.h"
#include "neochatroom.h"
#include "notificationsmanager.h"
#include "spacehierarchycache.h"
#include <Quotient/jobs/basejob.h>
@@ -66,10 +65,6 @@ void NeoChatConnection::connectSignals()
});
connect(this, &NeoChatConnection::syncDone, this, [this] {
setIsOnline(true);
connect(this, &NeoChatConnection::syncDone, this, [this]() {
NotificationsManager::instance().handleNotifications(this);
});
});
connect(this, &NeoChatConnection::networkError, this, [this]() {
setIsOnline(false);
@@ -114,6 +109,10 @@ void NeoChatConnection::connectSignals()
Q_EMIT homeHaveHighlightNotificationsChanged();
});
});
connect(this, &NeoChatConnection::invitedRoom, this, [this](Quotient::Room *room) {
auto r = dynamic_cast<NeoChatRoom *>(room);
connect(r, &NeoChatRoom::showInviteNotification, this, &NeoChatConnection::showInviteNotification);
});
connect(this, &NeoChatConnection::leftRoom, this, [this](Room *room, Room *prev) {
Q_UNUSED(room)
if (prev && prev->isDirectChat()) {