From ffa2d5dc0ebdba554af7affd2861687fad1723ba Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Fri, 10 Nov 2023 11:51:30 -0500 Subject: [PATCH] Fix push notification registration Now it should regularly happen after login --- src/controller.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/controller.cpp b/src/controller.cpp index 54f98c20c..7bb4084c6 100644 --- a/src/controller.cpp +++ b/src/controller.cpp @@ -97,11 +97,9 @@ Controller::Controller(QObject *parent) connect(&m_accountRegistry, &AccountRegistry::accountCountChanged, this, [this]() { if (m_accountRegistry.size() > oldAccountCount) { auto connection = dynamic_cast(m_accountRegistry.accounts()[m_accountRegistry.size() - 1]); - connect(connection, &NeoChatConnection::syncDone, this, [connection]() { - NotificationsManager::instance().handleNotifications(connection); - }); - connectSingleShot(connection, &NeoChatConnection::connected, this, [this, connection]() { + connect(connection, &NeoChatConnection::syncDone, this, [this, connection]() { connection->setupPushNotifications(m_endpoint); + NotificationsManager::instance().handleNotifications(connection); }); } oldAccountCount = m_accountRegistry.size(); @@ -118,6 +116,8 @@ Controller::Controller(QObject *parent) }); connector->registerClient(i18n("Receiving push notifications")); + + m_endpoint = connector->endpoint(); #endif }