Fix bug that was removing unread notifications by checking the status. Fixes #2786

This commit is contained in:
Maurice Parker 2021-02-07 17:46:24 -06:00
parent 69ce88af06
commit cf73fb5bd3

View File

@ -33,10 +33,10 @@ final class UserNotificationManager: NSObject {
}
@objc func statusesDidChange(_ note: Notification) {
guard let articleIDs = note.userInfo?[Account.UserInfoKey.articleIDs] as? Set<String>, !articleIDs.isEmpty else {
guard let statuses = note.userInfo?[Account.UserInfoKey.statuses] as? Set<ArticleStatus>, !statuses.isEmpty else {
return
}
let identifiers = articleIDs.map { "articleID:\($0)" }
let identifiers = statuses.filter({ $0.read }).map { "articleID:\($0.articleID)" }
UNUserNotificationCenter.current().removeDeliveredNotifications(withIdentifiers: identifiers)
}