From 1cf10ebdf23dd4ff2c86c8b008859b018c5b39e6 Mon Sep 17 00:00:00 2001 From: sojuz151 <36378873+sojuz151@users.noreply.github.com> Date: Wed, 22 Sep 2021 15:51:54 +0200 Subject: [PATCH] Small notification fixes (#1077) --- main/src/ui/notifier_freedesktop.vala | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/main/src/ui/notifier_freedesktop.vala b/main/src/ui/notifier_freedesktop.vala index 78ed2d1e..634f331b 100644 --- a/main/src/ui/notifier_freedesktop.vala +++ b/main/src/ui/notifier_freedesktop.vala @@ -10,6 +10,7 @@ public class Dino.Ui.FreeDesktopNotifier : NotificationProvider, Object { private StreamInteractor stream_interactor; private DBusNotifications dbus_notifications; private bool supports_body_markup = false; + private bool supports_body_hyperlinks = false; private HashMap content_notifications = new HashMap(Conversation.hash_func, Conversation.equals_func); private HashMap> conversation_notifications = new HashMap>(Conversation.hash_func, Conversation.equals_func); @@ -31,6 +32,9 @@ public class Dino.Ui.FreeDesktopNotifier : NotificationProvider, Object { case "body-markup": supports_body_markup = true; break; + case "body-hyperlinks": + supports_body_hyperlinks = true; + break; } } @@ -65,7 +69,14 @@ public class Dino.Ui.FreeDesktopNotifier : NotificationProvider, Object { } public async void notify_message(Message message, Conversation conversation, string conversation_display_name, string? participant_display_name) { - string body = supports_body_markup ? Markup.escape_text(message.body) : message.body; + string body = ""; + if (supports_body_hyperlinks) { + body = Util.parse_add_markup(message.body, null, true, false); + } else if (supports_body_markup) { + body = Markup.escape_text(message.body); + } else { + body = message.body; + } yield notify_content_item(conversation, conversation_display_name, participant_display_name, body); } @@ -119,6 +130,7 @@ public class Dino.Ui.FreeDesktopNotifier : NotificationProvider, Object { hash_table["image-path"] = "call-start-symbolic"; hash_table["sound-name"] = new Variant.string("phone-incoming-call"); hash_table["urgency"] = new Variant.byte(2); + hash_table["desktop-entry"] = new Variant.string(Dino.Application.get_default().get_application_id()); string[] actions = new string[] {"default", "Open conversation", "reject", _("Reject"), "accept", _("Accept")}; try { uint32 notification_id = dbus_notifications.notify("Dino", 0, "", summary, body, actions, hash_table, 0); @@ -305,4 +317,4 @@ public class Dino.Ui.FreeDesktopNotifier : NotificationProvider, Object { this.func = (owned) func; } } -} \ No newline at end of file +}