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
|
|
|
|
|
2018-07-11 17:33:02 +03:00
|
|
|
NotificationsManager::NotificationsManager(QObject *parent): QObject(parent)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2018-05-05 22:40:24 +03:00
|
|
|
void
|
2018-07-11 17:33:02 +03:00
|
|
|
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
|
|
|
{
|
2018-07-11 17:33:02 +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();
|
2018-07-11 17:33:02 +03:00
|
|
|
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];
|
|
|
|
}
|
2018-07-11 17:33:02 +03:00
|
|
|
|
|
|
|
//unused
|
|
|
|
void
|
|
|
|
NotificationsManager::actionInvoked(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
|
|
|
{}
|
|
|
|
|