diff --git a/Session/Notifications/AppNotifications.swift b/Session/Notifications/AppNotifications.swift index ac5f8ebf1..ba078de92 100644 --- a/Session/Notifications/AppNotifications.swift +++ b/Session/Notifications/AppNotifications.swift @@ -221,9 +221,7 @@ public class NotificationPresenter: NSObject, NotificationsProtocol { AppNotificationUserInfoKey.threadId: threadId ] - let transaction = transaction as! YapDatabaseReadWriteTransaction - let identifier: String = UUID().uuidString - incomingMessage.setNotificationIdentifier(identifier, transaction: transaction) + let identifier: String = incomingMessage.notificationIdentifier ?? UUID().uuidString DispatchQueue.main.async { notificationBody = MentionUtilities.highlightMentions(in: notificationBody!, threadID: thread.uniqueId!) diff --git a/SessionMessagingKit/Sending & Receiving/MessageReceiver+Handling.swift b/SessionMessagingKit/Sending & Receiving/MessageReceiver+Handling.swift index 0e7967ab8..a6f6b47c6 100644 --- a/SessionMessagingKit/Sending & Receiving/MessageReceiver+Handling.swift +++ b/SessionMessagingKit/Sending & Receiving/MessageReceiver+Handling.swift @@ -305,6 +305,7 @@ extension MessageReceiver { // Notify the user if needed guard (isMainAppAndActive || isBackgroundPoll), let tsIncomingMessage = TSMessage.fetch(uniqueId: tsMessageID, transaction: transaction) as? TSIncomingMessage, let thread = TSThread.fetch(uniqueId: threadID, transaction: transaction) else { return tsMessageID } + tsIncomingMessage.setNotificationIdentifier(UUID().uuidString, transaction: transaction) DispatchQueue.main.async { Storage.read { transaction in SSKEnvironment.shared.notificationsManager!.notifyUser(for: tsIncomingMessage, in: thread, transaction: transaction)