mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Don't use custom notificaions on Wayland even with TDESKTOP_DISABLE_DBUS_INTEGRATION
This commit is contained in:
parent
a33c9479a5
commit
a726c6411b
3 changed files with 56 additions and 38 deletions
|
@ -8,7 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
*/
|
*/
|
||||||
#include "platform/linux/notifications_manager_linux.h"
|
#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 "base/platform/base_platform_info.h"
|
||||||
#include "platform/linux/specific_linux.h"
|
#include "platform/linux/specific_linux.h"
|
||||||
#include "core/application.h"
|
#include "core/application.h"
|
||||||
|
@ -17,6 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "main/main_session.h"
|
#include "main/main_session.h"
|
||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
|
|
||||||
|
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION
|
||||||
#include <QtCore/QVersionNumber>
|
#include <QtCore/QVersionNumber>
|
||||||
#include <QtDBus/QDBusMessage>
|
#include <QtDBus/QDBusMessage>
|
||||||
#include <QtDBus/QDBusReply>
|
#include <QtDBus/QDBusReply>
|
||||||
|
@ -479,17 +480,67 @@ std::unique_ptr<Window::Notifications::Manager> Create(
|
||||||
Window::Notifications::System *system) {
|
Window::Notifications::System *system) {
|
||||||
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION
|
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION
|
||||||
GetSupported();
|
GetSupported();
|
||||||
|
#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION
|
||||||
|
|
||||||
if ((Core::App().settings().nativeNotifications() && Supported())
|
if ((Core::App().settings().nativeNotifications() && Supported())
|
||||||
|| Platform::IsWayland()) {
|
|| Platform::IsWayland()) {
|
||||||
return std::make_unique<Manager>(system);
|
return std::make_unique<Manager>(system);
|
||||||
}
|
}
|
||||||
#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION
|
|
||||||
|
|
||||||
return nullptr;
|
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*> manager, Type type) {}
|
||||||
|
|
||||||
|
void showNotification(
|
||||||
|
not_null<PeerData*> peer,
|
||||||
|
std::shared_ptr<Data::CloudImageView> &userpicView,
|
||||||
|
MsgId msgId,
|
||||||
|
const QString &title,
|
||||||
|
const QString &subtitle,
|
||||||
|
const QString &msg,
|
||||||
|
bool hideNameAndPhoto,
|
||||||
|
bool hideReplyButton) {}
|
||||||
|
void clearAll() {}
|
||||||
|
void clearFromHistory(not_null<History*> history) {}
|
||||||
|
void clearFromSession(not_null<Main::Session*> 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*> manager, Type type);
|
||||||
|
|
||||||
|
void showNotification(
|
||||||
|
not_null<PeerData*> peer,
|
||||||
|
std::shared_ptr<Data::CloudImageView> &userpicView,
|
||||||
|
MsgId msgId,
|
||||||
|
const QString &title,
|
||||||
|
const QString &subtitle,
|
||||||
|
const QString &msg,
|
||||||
|
bool hideNameAndPhoto,
|
||||||
|
bool hideReplyButton);
|
||||||
|
void clearAll();
|
||||||
|
void clearFromHistory(not_null<History*> history);
|
||||||
|
void clearFromSession(not_null<Main::Session*> session);
|
||||||
|
void clearNotification(NotificationId id);
|
||||||
|
|
||||||
|
~Private();
|
||||||
|
|
||||||
|
private:
|
||||||
|
base::flat_map<
|
||||||
|
FullPeer,
|
||||||
|
base::flat_map<MsgId, Notification>> _notifications;
|
||||||
|
|
||||||
|
Window::Notifications::CachedUserpics _cachedUserpics;
|
||||||
|
base::weak_ptr<Manager> _manager;
|
||||||
|
};
|
||||||
|
|
||||||
Manager::Private::Private(not_null<Manager*> manager, Type type)
|
Manager::Private::Private(not_null<Manager*> manager, Type type)
|
||||||
: _cachedUserpics(type)
|
: _cachedUserpics(type)
|
||||||
, _manager(manager) {
|
, _manager(manager) {
|
||||||
|
@ -636,6 +687,7 @@ void Manager::Private::clearNotification(NotificationId id) {
|
||||||
Manager::Private::~Private() {
|
Manager::Private::~Private() {
|
||||||
clearAll();
|
clearAll();
|
||||||
}
|
}
|
||||||
|
#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION
|
||||||
|
|
||||||
Manager::Manager(not_null<Window::Notifications::System*> system)
|
Manager::Manager(not_null<Window::Notifications::System*> system)
|
||||||
: NativeManager(system)
|
: NativeManager(system)
|
||||||
|
@ -679,7 +731,6 @@ void Manager::doClearFromHistory(not_null<History*> history) {
|
||||||
void Manager::doClearFromSession(not_null<Main::Session*> session) {
|
void Manager::doClearFromSession(not_null<Main::Session*> session) {
|
||||||
_private->clearFromSession(session);
|
_private->clearFromSession(session);
|
||||||
}
|
}
|
||||||
#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION
|
|
||||||
|
|
||||||
} // namespace Notifications
|
} // namespace Notifications
|
||||||
} // namespace Platform
|
} // namespace Platform
|
||||||
|
|
|
@ -8,7 +8,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "platform/platform_notifications_manager.h"
|
#include "platform/platform_notifications_manager.h"
|
||||||
#include "window/notifications_utilities.h"
|
|
||||||
#include "base/weak_ptr.h"
|
#include "base/weak_ptr.h"
|
||||||
|
|
||||||
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION
|
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION
|
||||||
|
@ -79,6 +78,7 @@ QDBusArgument &operator<<(
|
||||||
const QDBusArgument &operator>>(
|
const QDBusArgument &operator>>(
|
||||||
const QDBusArgument &argument,
|
const QDBusArgument &argument,
|
||||||
NotificationData::ImageData &imageData);
|
NotificationData::ImageData &imageData);
|
||||||
|
#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION
|
||||||
|
|
||||||
class Manager
|
class Manager
|
||||||
: public Window::Notifications::NativeManager
|
: public Window::Notifications::NativeManager
|
||||||
|
@ -108,37 +108,6 @@ private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class Manager::Private {
|
|
||||||
public:
|
|
||||||
using Type = Window::Notifications::CachedUserpics::Type;
|
|
||||||
explicit Private(not_null<Manager*> manager, Type type);
|
|
||||||
|
|
||||||
void showNotification(
|
|
||||||
not_null<PeerData*> peer,
|
|
||||||
std::shared_ptr<Data::CloudImageView> &userpicView,
|
|
||||||
MsgId msgId,
|
|
||||||
const QString &title,
|
|
||||||
const QString &subtitle,
|
|
||||||
const QString &msg,
|
|
||||||
bool hideNameAndPhoto,
|
|
||||||
bool hideReplyButton);
|
|
||||||
void clearAll();
|
|
||||||
void clearFromHistory(not_null<History*> history);
|
|
||||||
void clearFromSession(not_null<Main::Session*> session);
|
|
||||||
void clearNotification(NotificationId id);
|
|
||||||
|
|
||||||
~Private();
|
|
||||||
|
|
||||||
private:
|
|
||||||
base::flat_map<
|
|
||||||
FullPeer,
|
|
||||||
base::flat_map<MsgId, Notification>> _notifications;
|
|
||||||
|
|
||||||
Window::Notifications::CachedUserpics _cachedUserpics;
|
|
||||||
base::weak_ptr<Manager> _manager;
|
|
||||||
};
|
|
||||||
#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION
|
|
||||||
|
|
||||||
} // namespace Notifications
|
} // namespace Notifications
|
||||||
} // namespace Platform
|
} // namespace Platform
|
||||||
|
|
||||||
|
|
|
@ -656,9 +656,7 @@ void SetupNotificationsContent(
|
||||||
}();
|
}();
|
||||||
|
|
||||||
const auto advancedSlide = !Platform::IsMac10_8OrGreater()
|
const auto advancedSlide = !Platform::IsMac10_8OrGreater()
|
||||||
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION
|
|
||||||
&& !Platform::IsWayland()
|
&& !Platform::IsWayland()
|
||||||
#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION
|
|
||||||
? container->add(
|
? container->add(
|
||||||
object_ptr<Ui::SlideWrap<Ui::VerticalLayout>>(
|
object_ptr<Ui::SlideWrap<Ui::VerticalLayout>>(
|
||||||
container,
|
container,
|
||||||
|
|
Loading…
Add table
Reference in a new issue