🐛 Tries to fix

This commit is contained in:
2025-10-03 22:06:05 +08:00
parent 6df1d96cc9
commit 7db164fda6
3 changed files with 7 additions and 5 deletions

View File

@@ -12,7 +12,7 @@ import UIKit
UNUserNotificationCenter.current().delegate = notifyDelegate
let replyableMessageCategory = UNNotificationCategory(
identifier: "REPLYABLE_MESSAGE",
identifier: "CHAT_MESSAGE",
actions: [
UNTextInputNotificationAction(
identifier: "reply_action",

View File

@@ -47,7 +47,6 @@ class NotificationService: UNNotificationServiceExtension {
private func processNotification(request: UNNotificationRequest, content: UNMutableNotificationContent) throws {
switch content.userInfo["type"] as? String {
case "messages.new":
content.categoryIdentifier = "REPLYABLE_MESSAGE"
try handleMessagingNotification(request: request, content: content)
default:
try handleDefaultNotification(content: content)
@@ -89,7 +88,12 @@ class NotificationService: UNNotificationServiceExtension {
let intent = self.createMessageIntent(with: sender, meta: metaCopy, body: content.body)
self.donateInteraction(for: intent)
let updatedContent = try? request.content.updating(from: intent)
self.contentHandler?(updatedContent ?? content)
if let updatedContent = updatedContent {
updatedContent.categoryIdentifier = "CHAT_MESSAGE"
self.contentHandler?(updatedContent)
} else {
self.contentHandler?(content)
}
})
}