diff options
| author | Xavier Del Campo Romero <xavi.dcr@tutanota.com> | 2023-10-05 14:24:03 +0200 |
|---|---|---|
| committer | Xavier Del Campo Romero <xavi.dcr@tutanota.com> | 2023-10-09 16:38:03 +0200 |
| commit | 9214e31b98d69d2c8ad56f8634345aeb98b234cc (patch) | |
| tree | 7e5f5a96f4f66d6863b5d72ffabaa3511bcfa0f1 | |
| parent | bfff1a2e519a3799f6e633947d4249985921a81c (diff) | |
| download | dino-9214e31b98d69d2c8ad56f8634345aeb98b234cc.tar.gz | |
WIP call notifications
| -rw-r--r-- | libdino/src/service/notification_events.vala | 3 | ||||
| -rw-r--r-- | plugins/notification-sound/src/plugin.vala | 30 |
2 files changed, 30 insertions, 3 deletions
diff --git a/libdino/src/service/notification_events.vala b/libdino/src/service/notification_events.vala index 8771b5a9..c9f2647c 100644 --- a/libdino/src/service/notification_events.vala +++ b/libdino/src/service/notification_events.vala @@ -96,7 +96,8 @@ public class NotificationEvents : StreamInteractionModule, Object { } break; case CallItem.TYPE: - // handled in `on_call_incoming` + // Also handled in `on_call_incoming` + notify_content_item(item, conversation); break; } } diff --git a/plugins/notification-sound/src/plugin.vala b/plugins/notification-sound/src/plugin.vala index 081fd1c3..e014d106 100644 --- a/plugins/notification-sound/src/plugin.vala +++ b/plugins/notification-sound/src/plugin.vala @@ -8,9 +8,35 @@ public class Plugin : RootInterface, Object { public void registered(Dino.Application app) { this.app = app; Canberra.Context.create(out sound_context); + string sound_id = "", + description = "Unknown notification"; - app.stream_interactor.get_module(NotificationEvents.IDENTITY).notify_content_item.connect((item, conversation) => { - sound_context.play(0, Canberra.PROP_EVENT_ID, "message-new-instant", Canberra.PROP_EVENT_DESCRIPTION, "New Dino message"); + var? module = app.stream_interactor.get_module(NotificationEvents.IDENTITY); + + if (module == null) + return; + + module.notify_content_item.connect((item, conversation) => { + switch (item.type_) { + case MessageItem.TYPE: + description = "New Dino message"; + sound_id = "message-new-instant"; + break; + case CallItem.TYPE: + description = "Incoming call"; + sound_id = "phone-incoming-call"; + break; + case FileItem.TYPE: + description = "Incoming file"; + sound_id = "message-new-instant"; + break; + } + + sound_context.play(0, + Canberra.PROP_EVENT_ID, + sound_id, + Canberra.PROP_EVENT_DESCRIPTION, + description); }); } |
