diff --git a/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp b/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp index a478847a7a..cf12821ce5 100644 --- a/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp @@ -8,7 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "platform/linux/notifications_manager_linux.h" -#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION +#include "window/notifications_utilities.h" #include "base/platform/base_platform_info.h" #include "platform/linux/specific_linux.h" #include "core/application.h" @@ -17,6 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "main/main_session.h" #include "lang/lang_keys.h" +#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION #include #include #include @@ -479,17 +480,67 @@ std::unique_ptr Create( Window::Notifications::System *system) { #ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION GetSupported(); +#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION if ((Core::App().settings().nativeNotifications() && Supported()) || Platform::IsWayland()) { return std::make_unique(system); } -#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION return nullptr; } -#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION +#ifdef TDESKTOP_DISABLE_DBUS_INTEGRATION +class Manager::Private { +public: + using Type = Window::Notifications::CachedUserpics::Type; + explicit Private(not_null manager, Type type) {} + + void showNotification( + not_null peer, + std::shared_ptr &userpicView, + MsgId msgId, + const QString &title, + const QString &subtitle, + const QString &msg, + bool hideNameAndPhoto, + bool hideReplyButton) {} + void clearAll() {} + void clearFromHistory(not_null history) {} + void clearFromSession(not_null session) {} + void clearNotification(NotificationId id) {} +}; +#else // TDESKTOP_DISABLE_DBUS_INTEGRATION +class Manager::Private { +public: + using Type = Window::Notifications::CachedUserpics::Type; + explicit Private(not_null manager, Type type); + + void showNotification( + not_null peer, + std::shared_ptr &userpicView, + MsgId msgId, + const QString &title, + const QString &subtitle, + const QString &msg, + bool hideNameAndPhoto, + bool hideReplyButton); + void clearAll(); + void clearFromHistory(not_null history); + void clearFromSession(not_null session); + void clearNotification(NotificationId id); + + ~Private(); + +private: + base::flat_map< + FullPeer, + base::flat_map> _notifications; + + Window::Notifications::CachedUserpics _cachedUserpics; + base::weak_ptr _manager; +}; + Manager::Private::Private(not_null manager, Type type) : _cachedUserpics(type) , _manager(manager) { @@ -636,6 +687,7 @@ void Manager::Private::clearNotification(NotificationId id) { Manager::Private::~Private() { clearAll(); } +#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION Manager::Manager(not_null system) : NativeManager(system) @@ -679,7 +731,6 @@ void Manager::doClearFromHistory(not_null history) { void Manager::doClearFromSession(not_null session) { _private->clearFromSession(session); } -#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION } // namespace Notifications } // namespace Platform diff --git a/Telegram/SourceFiles/platform/linux/notifications_manager_linux.h b/Telegram/SourceFiles/platform/linux/notifications_manager_linux.h index bc318111ae..b82abb8ac4 100644 --- a/Telegram/SourceFiles/platform/linux/notifications_manager_linux.h +++ b/Telegram/SourceFiles/platform/linux/notifications_manager_linux.h @@ -8,7 +8,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #pragma once #include "platform/platform_notifications_manager.h" -#include "window/notifications_utilities.h" #include "base/weak_ptr.h" #ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION @@ -79,6 +78,7 @@ QDBusArgument &operator<<( const QDBusArgument &operator>>( const QDBusArgument &argument, NotificationData::ImageData &imageData); +#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION class Manager : public Window::Notifications::NativeManager @@ -108,37 +108,6 @@ private: }; -class Manager::Private { -public: - using Type = Window::Notifications::CachedUserpics::Type; - explicit Private(not_null manager, Type type); - - void showNotification( - not_null peer, - std::shared_ptr &userpicView, - MsgId msgId, - const QString &title, - const QString &subtitle, - const QString &msg, - bool hideNameAndPhoto, - bool hideReplyButton); - void clearAll(); - void clearFromHistory(not_null history); - void clearFromSession(not_null session); - void clearNotification(NotificationId id); - - ~Private(); - -private: - base::flat_map< - FullPeer, - base::flat_map> _notifications; - - Window::Notifications::CachedUserpics _cachedUserpics; - base::weak_ptr _manager; -}; -#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION - } // namespace Notifications } // namespace Platform diff --git a/Telegram/SourceFiles/settings/settings_notifications.cpp b/Telegram/SourceFiles/settings/settings_notifications.cpp index 8e220759a1..2608d57370 100644 --- a/Telegram/SourceFiles/settings/settings_notifications.cpp +++ b/Telegram/SourceFiles/settings/settings_notifications.cpp @@ -656,9 +656,7 @@ void SetupNotificationsContent( }(); const auto advancedSlide = !Platform::IsMac10_8OrGreater() -#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION && !Platform::IsWayland() -#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION ? container->add( object_ptr>( container,