Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions SignalServiceKit/Notifications/UserNotificationsPresenter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ public class UserNotificationPresenter {
}

public func clearNotificationsForAppActivate() {
Logger.info("Clearing notifications for app activate.")
Logger.info("Clearing pending notifications for app activate.")

Task {
let shouldRemoveNotificationRequestPredicate: (UNNotificationRequest) -> Bool = { request in
Expand All @@ -346,12 +346,12 @@ public class UserNotificationPresenter {
.filter { shouldRemoveNotificationRequestPredicate($0) }
.map(\.identifier)

let deliveredNotificationIDsToRemove = await Self.notificationCenter.deliveredNotifications()
.filter { shouldRemoveNotificationRequestPredicate($0.request) }
.map(\.request.identifier)
// Do not remove delivered notifications on app activate.
// Delivered notifications should remain visible in Notification Center
// until the related conversation is actually opened/read and canceled
// through the normal thread/message-specific cancellation paths.

Self.notificationCenter.removePendingNotificationRequests(withIdentifiers: pendingNotificationIDsToRemove)
Self.notificationCenter.removeDeliveredNotifications(withIdentifiers: deliveredNotificationIDsToRemove)
}
}

Expand Down