matrixion/src/notifications/ManagerMac.mm

59 lines
1.3 KiB
Text
Raw Normal View History

2018-05-05 22:40:24 +03:00
#include "notifications/Manager.h"
#include <Foundation/Foundation.h>
#include <QtMac>
@interface NSUserNotification (CFIPrivate)
- (void)set_identityImage:(NSImage *)image;
@end
NotificationsManager::NotificationsManager(QObject *parent): QObject(parent)
{
}
2018-05-05 22:40:24 +03:00
void
NotificationsManager::postNotification(
const QString &roomId,
const QString &eventId,
const QString &roomName,
const QString &senderName,
const QString &text,
const QImage &icon)
2018-05-05 22:40:24 +03:00
{
Q_UNUSED(roomId);
Q_UNUSED(eventId);
Q_UNUSED(icon);
2018-05-05 22:40:24 +03:00
NSUserNotification * notif = [[NSUserNotification alloc] init];
notif.title = roomName.toNSString();
notif.subtitle = QString("%1 sent a message").arg(senderName).toNSString();
notif.informativeText = text.toNSString();
2018-05-05 22:40:24 +03:00
notif.soundName = NSUserNotificationDefaultSoundName;
[[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification: notif];
[notif autorelease];
}
//unused
void
NotificationsManager::actionInvoked(uint, QString)
{
}
void
NotificationsManager::notificationReplied(uint, QString)
{
}
void
NotificationsManager::notificationClosed(uint, uint)
{
}
2020-04-09 21:52:50 +03:00
void
2020-04-13 18:01:57 +03:00
NotificationsManager::removeNotification(const QString &, const QString &)
2020-04-09 21:52:50 +03:00
{}