From: Felix Weilbach Date: Wed, 3 Nov 2021 12:53:45 +0000 (+0100) Subject: Don't do a connection checks when using push notifications X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~18^2~121^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=d661e91a58dfa690f1909aa41bfe9c33f44d0701;p=nextcloud-desktop.git Don't do a connection checks when using push notifications When using push notifications, it is not necessary to do regular connection checks because the push notifications will take care of it. Signed-off-by: Felix Weilbach --- diff --git a/src/gui/application.cpp b/src/gui/application.cpp index 9a7cd6a22..f153224b2 100644 --- a/src/gui/application.cpp +++ b/src/gui/application.cpp @@ -34,6 +34,7 @@ #include "sharedialog.h" #include "accountmanager.h" #include "creds/abstractcredentials.h" +#include "pushnotifications.h" #if defined(BUILD_UPDATER) #include "updater/ocupdater.h" @@ -459,9 +460,10 @@ void Application::slotCheckConnection() // Don't check if we're manually signed out or // when the error is permanent. - if (state != AccountState::SignedOut - && state != AccountState::ConfigurationError - && state != AccountState::AskingCredentials) { + const auto pushNotifications = accountState->account()->pushNotifications(); + const auto pushNotificationsAvailable = (pushNotifications && pushNotifications->isReady()); + if (state != AccountState::SignedOut && state != AccountState::ConfigurationError + && state != AccountState::AskingCredentials && !pushNotificationsAvailable) { accountState->checkConnectivity(); } }