diff --git a/client/cmake/sources.cmake b/client/cmake/sources.cmake index 13e15def4..48e5ec90b 100644 --- a/client/cmake/sources.cmake +++ b/client/cmake/sources.cmake @@ -86,6 +86,7 @@ if(NOT ANDROID) ) else() set(HEADERS ${HEADERS} + ${CLIENT_ROOT_DIR}/ui/utils/notificationHandler.h ${CLIENT_ROOT_DIR}/platforms/android/android_notificationhandler.h ) endif() @@ -180,6 +181,7 @@ if(NOT ANDROID) ) else() set(SOURCES ${SOURCES} + ${CLIENT_ROOT_DIR}/ui/utils/notificationHandler.cpp ${CLIENT_ROOT_DIR}/platforms/android/android_notificationhandler.cpp ) endif() diff --git a/client/core/controllers/coreController.h b/client/core/controllers/coreController.h index 0d77c5167..20d101980 100644 --- a/client/core/controllers/coreController.h +++ b/client/core/controllers/coreController.h @@ -72,9 +72,7 @@ #include "ui/models/ipSplitTunnelingModel.h" #include "ui/models/newsModel.h" -#if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS) - #include "ui/utils/notificationHandler.h" -#endif +class NotificationHandler; class CoreSignalHandlers; class TestMultipleImports; @@ -141,9 +139,7 @@ private: SecureServersRepository* m_serversRepository; SecureAppSettingsRepository* m_appSettingsRepository; -#if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS) - NotificationHandler* m_notificationHandler; -#endif + NotificationHandler* m_notificationHandler {}; QMetaObject::Connection m_reloadConfigErrorOccurredConnection; diff --git a/client/core/controllers/coreSignalHandlers.cpp b/client/core/controllers/coreSignalHandlers.cpp index 46d91207c..46d81abed 100644 --- a/client/core/controllers/coreSignalHandlers.cpp +++ b/client/core/controllers/coreSignalHandlers.cpp @@ -36,8 +36,8 @@ #include "ui/models/containersModel.h" #include "core/utils/containerEnum.h" +#include "ui/utils/notificationHandler.h" #if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS) - #include "ui/utils/notificationHandler.h" #include "ui/utils/systemTrayNotificationHandler.h" #endif @@ -394,25 +394,23 @@ void CoreSignalHandlers::initIosSettingsHandler() void CoreSignalHandlers::initNotificationHandler() { -#if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS) m_coreController->m_notificationHandler = NotificationHandler::create(m_coreController); connect(m_coreController->m_connectionController, &ConnectionController::connectionStateChanged, m_coreController->m_notificationHandler, &NotificationHandler::setConnectionState); + connect(m_coreController, &CoreController::translationsUpdated, m_coreController->m_notificationHandler, &NotificationHandler::onTranslationsUpdated); +#if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS) connect(m_coreController->m_notificationHandler, &NotificationHandler::raiseRequested, m_coreController->m_pageController, &PageController::raiseMainWindow); connect(m_coreController->m_notificationHandler, &NotificationHandler::connectRequested, m_coreController->m_connectionUiController, static_cast(&ConnectionUiController::openConnection)); connect(m_coreController->m_notificationHandler, &NotificationHandler::disconnectRequested, m_coreController->m_connectionUiController, &ConnectionUiController::closeConnection); - connect(m_coreController, &CoreController::translationsUpdated, m_coreController->m_notificationHandler, &NotificationHandler::onTranslationsUpdated); -#if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS) if (auto *trayHandler = qobject_cast(m_coreController->m_notificationHandler)) { connect(m_coreController, &CoreController::websiteUrlChanged, trayHandler, &SystemTrayNotificationHandler::updateWebsiteUrl); } #endif -#endif } void CoreSignalHandlers::initUpdateFoundHandler()