2020-10-24 22:05:35 +00:00
|
|
|
using Dino.Entities;
|
2021-02-18 09:24:53 +00:00
|
|
|
using Dino.Plugins.WindowsNotification.Vapi;
|
2021-02-24 01:05:02 +00:00
|
|
|
using winrt.Windows.UI.Notifications;
|
2021-02-26 11:31:07 +00:00
|
|
|
using Xmpp;
|
2020-10-24 22:05:35 +00:00
|
|
|
|
|
|
|
namespace Dino.Plugins.WindowsNotification {
|
2021-02-27 17:42:07 +00:00
|
|
|
public class Plugin : RootInterface, Object {
|
2020-10-24 22:05:35 +00:00
|
|
|
|
2021-02-27 17:42:07 +00:00
|
|
|
private static string AUMID = "org.dino.Dino";
|
2021-02-26 11:31:07 +00:00
|
|
|
|
2021-02-27 17:42:07 +00:00
|
|
|
public void registered(Dino.Application app) {
|
2021-03-26 11:22:55 +00:00
|
|
|
|
2021-02-27 17:42:07 +00:00
|
|
|
if (!winrt.InitApartment())
|
|
|
|
{
|
|
|
|
// log error, return
|
|
|
|
}
|
2021-03-26 11:22:55 +00:00
|
|
|
|
2021-03-05 22:15:09 +00:00
|
|
|
if (!Win32Api.SetProcessAumid(AUMID))
|
2021-02-27 17:42:07 +00:00
|
|
|
{
|
|
|
|
// log error, return
|
|
|
|
}
|
|
|
|
|
2021-03-05 22:15:09 +00:00
|
|
|
if (!ShortcutCreator.EnsureAumiddedShortcutExists(AUMID))
|
2021-02-27 17:42:07 +00:00
|
|
|
{
|
|
|
|
// log error, return
|
|
|
|
}
|
2021-03-26 11:22:55 +00:00
|
|
|
|
2021-02-27 17:42:07 +00:00
|
|
|
app.stream_interactor.get_module(NotificationEvents.IDENTITY)
|
|
|
|
.register_notification_provider(new WindowsNotificationProvider(app, new ToastNotifier(AUMID)));
|
2021-02-21 20:03:24 +00:00
|
|
|
}
|
2020-10-24 22:05:35 +00:00
|
|
|
|
2021-02-27 17:42:07 +00:00
|
|
|
public void shutdown() {
|
|
|
|
}
|
2020-10-25 11:07:31 +00:00
|
|
|
}
|
2020-10-24 22:05:35 +00:00
|
|
|
}
|