Only attempt to setup push notifications on the first syncDone

This commit is contained in:
Joshua Goins
2023-11-12 15:53:15 -05:00
parent 61ad892732
commit 15ba6d58e2

View File

@@ -98,9 +98,11 @@ Controller::Controller(QObject *parent)
if (m_accountRegistry.size() > oldAccountCount) { if (m_accountRegistry.size() > oldAccountCount) {
auto connection = dynamic_cast<NeoChatConnection *>(m_accountRegistry.accounts()[m_accountRegistry.size() - 1]); auto connection = dynamic_cast<NeoChatConnection *>(m_accountRegistry.accounts()[m_accountRegistry.size() - 1]);
connect(connection, &NeoChatConnection::syncDone, this, [this, connection]() { connect(connection, &NeoChatConnection::syncDone, this, [this, connection]() {
connection->setupPushNotifications(m_endpoint);
NotificationsManager::instance().handleNotifications(connection); NotificationsManager::instance().handleNotifications(connection);
}); });
connectSingleShot(connection, &NeoChatConnection::syncDone, this, [this, connection] {
connection->setupPushNotifications(m_endpoint);
});
} }
oldAccountCount = m_accountRegistry.size(); oldAccountCount = m_accountRegistry.size();
}); });