WIP call notifications

This commit is contained in:
Xavier Del Campo Romero 2023-10-05 14:24:03 +02:00
parent bfff1a2e51
commit 9214e31b98
Signed by: xavi
GPG Key ID: 84FF3612A9BF43F2
2 changed files with 30 additions and 3 deletions

View File

@ -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;
}
}

View File

@ -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);
});
}