Adjust notification service extension for recording notifications

Signed-off-by: Marcel Müller <marcel-mueller@gmx.de>
This commit is contained in:
Marcel Müller 2023-02-23 23:28:46 +01:00
Родитель 4a822e6715
Коммит bf43ffb0cc
1 изменённых файлов: 16 добавлений и 2 удалений

Просмотреть файл

@ -175,17 +175,31 @@
[apiSessionManager GET:URLString parameters:nil progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
NSDictionary *notification = [[responseObject objectForKey:@"ocs"] objectForKey:@"data"];
NCNotification *serverNotification = [NCNotification notificationWithDictionary:notification];
if (serverNotification && serverNotification.notificationType == kNCNotificationTypeChat) {
if (!serverNotification) {
self.contentHandler(self.bestAttemptContent);
}
// Add the serverNotification as userInfo as well -> this can later be used to access the actions directly
[userInfo setObject:notification forKey:@"serverNotification"];
self.bestAttemptContent.userInfo = userInfo;
if (serverNotification.notificationType == kNCNotificationTypeChat) {
self.bestAttemptContent.title = serverNotification.chatMessageTitle;
self.bestAttemptContent.body = serverNotification.message;
self.bestAttemptContent.summaryArgument = serverNotification.chatMessageAuthor;
} else if (serverNotification.notificationType == kNCNotificationTypeRecording) {
self.bestAttemptContent.categoryIdentifier = @"CATEGORY_RECORDING";
self.bestAttemptContent.title = @"";
self.bestAttemptContent.body = serverNotification.subject;
self.bestAttemptContent.summaryArgument = serverNotification.objectId;
}
if (@available(iOS 15.0, *)) {
NCRoom *room = [self roomWithToken:pushNotification.roomToken forAccountId:pushNotification.accountId];
if (room) {
[[NCIntentController sharedInstance] getInteractionForRoom:room withTitle:serverNotification.chatMessageTitle withCompletionBlock:^(INSendMessageIntent *sendMessageIntent) {
[[NCIntentController sharedInstance] getInteractionForRoom:room withTitle:self.bestAttemptContent.title withCompletionBlock:^(INSendMessageIntent *sendMessageIntent) {
__block NSError *error;
if (sendMessageIntent) {