QMatrixClient -> Quotient

This commit is contained in:
Black Hat
2019-08-15 22:52:12 +08:00
parent 0067ce7e2e
commit 086891ef4e
7 changed files with 51 additions and 44 deletions

View File

@@ -4,9 +4,7 @@
#include <QApplication>
NotificationsManager::NotificationsManager(QObject* parent) : QObject(parent) {
}
NotificationsManager::NotificationsManager(QObject* parent) : QObject(parent) {}
void NotificationsManager::postNotification(const QString& roomId,
const QString& eventId,
@@ -20,35 +18,40 @@ void NotificationsManager::postNotification(const QString& roomId,
UNUserNotificationCenter* center =
[UNUserNotificationCenter currentNotificationCenter];
UNAuthorizationOptions options = UNAuthorizationOptionAlert + UNAuthorizationOptionSound;
UNAuthorizationOptions options =
UNAuthorizationOptionAlert + UNAuthorizationOptionSound;
[center requestAuthorizationWithOptions:options
completionHandler:^(BOOL granted, NSError * _Nullable error) {
if (!granted) {
NSLog(@"Something went wrong");
}
}];
completionHandler:^(BOOL granted,
NSError* _Nullable error) {
if (!granted) {
NSLog(@"Something went wrong");
}
}];
UNTimeIntervalNotificationTrigger *trigger = [UNTimeIntervalNotificationTrigger triggerWithTimeInterval:300
repeats:NO];
UNTimeIntervalNotificationTrigger* trigger =
[UNTimeIntervalNotificationTrigger triggerWithTimeInterval:0 repeats:NO];
UNMutableNotificationContent *content = [UNMutableNotificationContent new];
UNMutableNotificationContent* content = [UNMutableNotificationContent new];
content.title = roomName.toNSString();
content.subtitle = QString("%1 sent a message").arg(senderName).toNSString();
content.body = text.toNSString();
content.sound = [UNNotificationSound defaultSound];
NSString *identifier = QApplication::applicationName().toNSString();
NSString* identifier = QApplication::applicationName().toNSString();
UNNotificationRequest *request = [UNNotificationRequest requestWithIdentifier:identifier
content:content trigger:trigger];
UNNotificationRequest* request =
[UNNotificationRequest requestWithIdentifier:identifier
content:content
trigger:trigger];
[center addNotificationRequest:request withCompletionHandler:^(NSError * _Nullable error) {
if (error != nil) {
NSLog(@"Something went wrong: %@",error);
}
}];
[center addNotificationRequest:request
withCompletionHandler:^(NSError* _Nullable error) {
if (error != nil) {
NSLog(@"Something went wrong: %@", error);
}
}];
}
// unused