Remove not really needed notification capability checks

If the notification daemon doesn't support any of the hints, it will just ignore them
This commit is contained in:
Ilya Fedin 2024-03-11 02:26:16 +04:00 committed by John Preston
parent 5394717ddc
commit abdfa4f785

View file

@ -277,22 +277,18 @@ bool NotificationData::init(
_body = msg.toStdString();
}
if (HasCapability("actions")) {
_actions.push_back("default");
_actions.push_back(tr::lng_open_link(tr::now).toStdString());
if (!options.hideMarkAsRead) {
// icon name according to https://specifications.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html
_actions.push_back("mail-mark-read");
_actions.push_back(
tr::lng_context_mark_read(tr::now).toStdString());
_actions.push_back(tr::lng_context_mark_read(tr::now).toStdString());
}
if (HasCapability("inline-reply")
&& !options.hideReplyButton) {
if (HasCapability("inline-reply") && !options.hideReplyButton) {
_actions.push_back("inline-reply");
_actions.push_back(
tr::lng_notification_reply(tr::now).toStdString());
_actions.push_back(tr::lng_notification_reply(tr::now).toStdString());
_notificationRepliedSignalId =
_interface.signal_notification_replied().connect([=](
@ -309,8 +305,7 @@ bool NotificationData::init(
});
}
_actionInvokedSignalId = _interface.signal_action_invoked().connect(
[=](
_actionInvokedSignalId = _interface.signal_action_invoked().connect([=](
XdgNotifications::Notifications,
uint id,
std::string actionName) {
@ -325,8 +320,8 @@ bool NotificationData::init(
});
});
_activationTokenSignalId =
_interface.signal_activation_token().connect([=](
_activationTokenSignalId = _interface.signal_activation_token().connect(
[=](
XdgNotifications::Notifications,
uint id,
std::string token) {
@ -334,15 +329,11 @@ bool NotificationData::init(
GLib::setenv("XDG_ACTIVATION_TOKEN", token, true);
}
});
}
if (HasCapability("action-icons")) {
_hints.insert_value("action-icons", GLib::Variant::new_boolean(true));
}
// suppress system sound if telegram sound activated,
// otherwise use system sound
if (HasCapability("sound")) {
if (Core::App().settings().soundNotify()) {
_hints.insert_value(
"suppress-sound",
@ -353,13 +344,10 @@ bool NotificationData::init(
"sound-name",
GLib::Variant::new_string("message-new-instant"));
}
}
if (HasCapability("x-canonical-append")) {
_hints.insert_value(
"x-canonical-append",
GLib::Variant::new_string("true"));
}
_hints.insert_value("category", GLib::Variant::new_string("im.received"));