mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 12:07:55 +00:00
Remove delivered notifications for rooms that have meantime become fully read and have messages newer than what's delivered
- this is a best effort solution to cleanup outdated notifications when using multiple clients and reading them elsewhere
This commit is contained in:
committed by
Stefan Ceriu
parent
e14672e1f6
commit
899c33a5ad
@@ -12026,6 +12026,47 @@ class NotificationManagerMock: NotificationManagerProtocol, @unchecked Sendable
|
||||
}
|
||||
await removeDeliveredMessageNotificationsForClosure?(roomID)
|
||||
}
|
||||
//MARK: - removeDeliveredNotificationsForFullyReadRooms
|
||||
|
||||
var removeDeliveredNotificationsForFullyReadRoomsUnderlyingCallsCount = 0
|
||||
var removeDeliveredNotificationsForFullyReadRoomsCallsCount: Int {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return removeDeliveredNotificationsForFullyReadRoomsUnderlyingCallsCount
|
||||
} else {
|
||||
var returnValue: Int? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = removeDeliveredNotificationsForFullyReadRoomsUnderlyingCallsCount
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
}
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
removeDeliveredNotificationsForFullyReadRoomsUnderlyingCallsCount = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
removeDeliveredNotificationsForFullyReadRoomsUnderlyingCallsCount = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var removeDeliveredNotificationsForFullyReadRoomsCalled: Bool {
|
||||
return removeDeliveredNotificationsForFullyReadRoomsCallsCount > 0
|
||||
}
|
||||
var removeDeliveredNotificationsForFullyReadRoomsReceivedRooms: [RoomSummary]?
|
||||
var removeDeliveredNotificationsForFullyReadRoomsReceivedInvocations: [[RoomSummary]] = []
|
||||
var removeDeliveredNotificationsForFullyReadRoomsClosure: (([RoomSummary]) async -> Void)?
|
||||
|
||||
func removeDeliveredNotificationsForFullyReadRooms(_ rooms: [RoomSummary]) async {
|
||||
removeDeliveredNotificationsForFullyReadRoomsCallsCount += 1
|
||||
removeDeliveredNotificationsForFullyReadRoomsReceivedRooms = rooms
|
||||
DispatchQueue.main.async {
|
||||
self.removeDeliveredNotificationsForFullyReadRoomsReceivedInvocations.append(rooms)
|
||||
}
|
||||
await removeDeliveredNotificationsForFullyReadRoomsClosure?(rooms)
|
||||
}
|
||||
}
|
||||
class NotificationSettingsProxyMock: NotificationSettingsProxyProtocol, @unchecked Sendable {
|
||||
var callbacks: PassthroughSubject<NotificationSettingsProxyCallback, Never> {
|
||||
|
||||
Reference in New Issue
Block a user