Clear notifications for fully read rooms using the event's timestamp instead of delivery date

This commit is contained in:
Stefan Ceriu
2026-10-06 15:40:24 +03:00
parent fc75f90ef5
commit 2182446684
8 changed files with 48 additions and 3 deletions
@@ -151,7 +151,10 @@ final class NotificationManager: NSObject, NotificationManagerProtocol {
return false
}
return notification.date <= lastMessageDate
// The delivery date is later than the event's so only use it for notifications without an event date.
let notificationDate = notification.request.content.eventDate ?? notification.date
// Truncated to seconds to match `RoomSummary.lastMessageDate`.
return notificationDate.timeIntervalSince1970.rounded(.down) <= lastMessageDate.timeIntervalSince1970
}
.map(\.request.identifier)
@@ -12,6 +12,7 @@ nonisolated enum NotificationConstants {
enum UserInfoKey {
static let roomIdentifier = "room_id"
static let eventIdentifier = "event_id"
static let eventDate = "event_date"
static let threadRootEventIdentifier = "thread_root_event_id"
static let pusherNotificationClientIdentifier = "pusher_notification_client_identifier"
static let receiverIdentifier = "receiver_id"