mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-23 03:18:49 +03:00
Fix duplicate notification category identifier
This commit is contained in:
parent
3f4d384220
commit
43df8f3501
1 changed files with 16 additions and 16 deletions
|
@ -3,9 +3,9 @@
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
#include "notifications/NotificationManagerProxy.h"
|
|
||||||
#include "notifications/MacNotificationDelegate.h"
|
#include "notifications/MacNotificationDelegate.h"
|
||||||
#include "notifications/Manager.h"
|
#include "notifications/Manager.h"
|
||||||
|
#include "notifications/NotificationManagerProxy.h"
|
||||||
|
|
||||||
#include "ChatPage.h"
|
#include "ChatPage.h"
|
||||||
|
|
||||||
|
@ -106,18 +106,14 @@ void NotificationsManager::objCxxPostNotification(
|
||||||
textInputButtonTitle:sendStr.toNSString()
|
textInputButtonTitle:sendStr.toNSString()
|
||||||
textInputPlaceholder:placeholder.toNSString()];
|
textInputPlaceholder:placeholder.toNSString()];
|
||||||
|
|
||||||
UNNotificationCategory* category;
|
UNNotificationCategory* replyCategory = [UNNotificationCategory categoryWithIdentifier:@"ReplyCategory"
|
||||||
if(!room_id.isEmpty()){
|
|
||||||
category = [UNNotificationCategory categoryWithIdentifier:@"ReplyCategory"
|
|
||||||
actions:@[ replyAction ]
|
actions:@[ replyAction ]
|
||||||
intentIdentifiers:@[]
|
intentIdentifiers:@[]
|
||||||
options:UNNotificationCategoryOptionNone];
|
options:UNNotificationCategoryOptionNone];
|
||||||
}else{
|
UNNotificationCategory* summaryCategory = [UNNotificationCategory categoryWithIdentifier:@"SummaryCategory"
|
||||||
category = [UNNotificationCategory categoryWithIdentifier:@"ReplyCategory"
|
|
||||||
actions:@[]
|
actions:@[]
|
||||||
intentIdentifiers:@[]
|
intentIdentifiers:@[]
|
||||||
options:UNNotificationCategoryOptionNone];
|
options:UNNotificationCategoryOptionNone];
|
||||||
}
|
|
||||||
|
|
||||||
NSString* title = room_name.toNSString();
|
NSString* title = room_name.toNSString();
|
||||||
NSString* sub = subtitle.toNSString();
|
NSString* sub = subtitle.toNSString();
|
||||||
|
@ -126,7 +122,7 @@ void NotificationsManager::objCxxPostNotification(
|
||||||
NSString* identifier = event_id.toNSString();
|
NSString* identifier = event_id.toNSString();
|
||||||
NSString* imgUrl = bodyImagePath.toNSString();
|
NSString* imgUrl = bodyImagePath.toNSString();
|
||||||
|
|
||||||
NSSet* categories = [NSSet setWithObject:category];
|
NSSet* categories = [NSSet setWithObjects:summaryCategory, replyCategory, nil];
|
||||||
[center setNotificationCategories:categories];
|
[center setNotificationCategories:categories];
|
||||||
[center getNotificationSettingsWithCompletionHandler:^(
|
[center getNotificationSettingsWithCompletionHandler:^(
|
||||||
UNNotificationSettings* _Nonnull settings) {
|
UNNotificationSettings* _Nonnull settings) {
|
||||||
|
@ -140,8 +136,12 @@ void NotificationsManager::objCxxPostNotification(
|
||||||
if (enableSound) {
|
if (enableSound) {
|
||||||
content.sound = [UNNotificationSound defaultSound];
|
content.sound = [UNNotificationSound defaultSound];
|
||||||
}
|
}
|
||||||
|
if (!room_id.isEmpty()) {
|
||||||
content.threadIdentifier = threadIdentifier;
|
content.threadIdentifier = threadIdentifier;
|
||||||
content.categoryIdentifier = @"ReplyCategory";
|
content.categoryIdentifier = @"ReplyCategory";
|
||||||
|
} else {
|
||||||
|
content.categoryIdentifier = @"SummaryCategory";
|
||||||
|
}
|
||||||
|
|
||||||
if ([imgUrl length] != 0) {
|
if ([imgUrl length] != 0) {
|
||||||
NSURL* imageURL = [NSURL fileURLWithPath:imgUrl];
|
NSURL* imageURL = [NSURL fileURLWithPath:imgUrl];
|
||||||
|
|
Loading…
Reference in a new issue