diff options
author | Nicolas Werner <nicolas.werner@hotmail.de> | 2023-05-29 00:51:24 +0200 |
---|---|---|
committer | Nicolas Werner <nicolas.werner@hotmail.de> | 2023-05-29 03:11:58 +0200 |
commit | 43df8f3501cde8e1e1358475fd16e0fc8953a746 (patch) | |
tree | 9bc4ff4d9070bb566a530c401f3f39f8edf2af02 /src | |
parent | Merge branch 'dont-send-notifications-on-first-sync' of github.com:LcsTen/nhe... (diff) | |
download | nheko-43df8f3501cde8e1e1358475fd16e0fc8953a746.tar.xz |
Fix duplicate notification category identifier
Diffstat (limited to 'src')
-rw-r--r-- | src/notifications/ManagerMac.mm | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/notifications/ManagerMac.mm b/src/notifications/ManagerMac.mm index 6da5d006..0d6c7cb4 100644 --- a/src/notifications/ManagerMac.mm +++ b/src/notifications/ManagerMac.mm @@ -3,9 +3,9 @@ // // SPDX-License-Identifier: GPL-3.0-or-later -#include "notifications/NotificationManagerProxy.h" #include "notifications/MacNotificationDelegate.h" #include "notifications/Manager.h" +#include "notifications/NotificationManagerProxy.h" #include "ChatPage.h" @@ -106,18 +106,14 @@ void NotificationsManager::objCxxPostNotification( textInputButtonTitle:sendStr.toNSString() textInputPlaceholder:placeholder.toNSString()]; - UNNotificationCategory* category; - if(!room_id.isEmpty()){ - category = [UNNotificationCategory categoryWithIdentifier:@"ReplyCategory" - actions:@[ replyAction ] - intentIdentifiers:@[] - options:UNNotificationCategoryOptionNone]; - }else{ - category = [UNNotificationCategory categoryWithIdentifier:@"ReplyCategory" - actions:@[] - intentIdentifiers:@[] - options:UNNotificationCategoryOptionNone]; - } + UNNotificationCategory* replyCategory = [UNNotificationCategory categoryWithIdentifier:@"ReplyCategory" + actions:@[ replyAction ] + intentIdentifiers:@[] + options:UNNotificationCategoryOptionNone]; + UNNotificationCategory* summaryCategory = [UNNotificationCategory categoryWithIdentifier:@"SummaryCategory" + actions:@[] + intentIdentifiers:@[] + options:UNNotificationCategoryOptionNone]; NSString* title = room_name.toNSString(); NSString* sub = subtitle.toNSString(); @@ -126,7 +122,7 @@ void NotificationsManager::objCxxPostNotification( NSString* identifier = event_id.toNSString(); NSString* imgUrl = bodyImagePath.toNSString(); - NSSet* categories = [NSSet setWithObject:category]; + NSSet* categories = [NSSet setWithObjects:summaryCategory, replyCategory, nil]; [center setNotificationCategories:categories]; [center getNotificationSettingsWithCompletionHandler:^( UNNotificationSettings* _Nonnull settings) { @@ -140,8 +136,12 @@ void NotificationsManager::objCxxPostNotification( if (enableSound) { content.sound = [UNNotificationSound defaultSound]; } - content.threadIdentifier = threadIdentifier; - content.categoryIdentifier = @"ReplyCategory"; + if (!room_id.isEmpty()) { + content.threadIdentifier = threadIdentifier; + content.categoryIdentifier = @"ReplyCategory"; + } else { + content.categoryIdentifier = @"SummaryCategory"; + } if ([imgUrl length] != 0) { NSURL* imageURL = [NSURL fileURLWithPath:imgUrl]; |