From ef848e0a1bb2344da5aeb9f73f6cf0c6367dc537 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Thu, 16 Apr 2026 20:15:19 +0000 Subject: [PATCH] Port Linux notifications to std::get_if There's no sense to use abstrations calling std::holds_alternative --- .../linux/notifications_manager_linux.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp b/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp index 409659fcb1..116fc7227a 100644 --- a/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp @@ -432,8 +432,8 @@ void Manager::Private::init(XdgNotifications::NotificationsProxy proxy) { Core::Sandbox::Instance().customEnterFromEventLoop([&] { for (const auto &[key, notifications] : _notifications) { for (const auto &[msgId, notification] : notifications) { - const auto &nid = notification->id; - if (v::is(nid) && v::get(nid) == id) { + const auto nid = std::get_if(¬ification->id); + if (nid && id == *nid) { if (actionName == "default") { _manager->notificationActivated({ key, msgId }); } else if (actionName == "mail-mark-read") { @@ -457,8 +457,8 @@ void Manager::Private::init(XdgNotifications::NotificationsProxy proxy) { Core::Sandbox::Instance().customEnterFromEventLoop([&] { for (const auto &[key, notifications] : _notifications) { for (const auto &[msgId, notification] : notifications) { - const auto &nid = notification->id; - if (v::is(nid) && v::get(nid) == id) { + const auto nid = std::get_if(¬ification->id); + if (nid && id == *nid) { _manager->notificationReplied( { key, msgId }, { QString::fromStdString(text), {} }); @@ -479,8 +479,8 @@ void Manager::Private::init(XdgNotifications::NotificationsProxy proxy) { std::string token) { for (const auto &[key, notifications] : _notifications) { for (const auto &[msgId, notification] : notifications) { - const auto &nid = notification->id; - if (v::is(nid) && v::get(nid) == id) { + const auto nid = std::get_if(¬ification->id); + if (nid && id == *nid) { GLib::setenv("XDG_ACTIVATION_TOKEN", token, true); return; } @@ -513,8 +513,8 @@ void Manager::Private::init(XdgNotifications::NotificationsProxy proxy) { * In all other cases we keep the notification reference so that we may clear the notification later from history, * if the message for that notification is read (e.g. chat is opened or read from another device). */ - const auto &nid = notification->id; - if (v::is(nid) && v::get(nid) == id && reason == 2) { + const auto nid = std::get_if(¬ification->id); + if (nid && id == *nid && reason == 2) { clearNotification({ key, msgId }); return; }