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:
Stefan Ceriu
2025-04-17 15:01:01 +03:00
committed by Stefan Ceriu
parent e14672e1f6
commit 899c33a5ad
12 changed files with 128 additions and 29 deletions
@@ -79,6 +79,7 @@ extension RoomSummary {
avatarURL: nil,
heroes: [],
lastMessage: AttributedString("I do not wish to take the trouble to understand mysticism"),
lastMessageDate: nil,
lastMessageFormattedTimestamp: "14:56",
unreadMessagesCount: 0,
unreadMentionsCount: 0,
@@ -102,6 +103,7 @@ extension Array where Element == RoomSummary {
avatarURL: nil,
heroes: [],
lastMessage: AttributedString("I do not wish to take the trouble to understand mysticism"),
lastMessageDate: nil,
lastMessageFormattedTimestamp: "14:56",
unreadMessagesCount: 0,
unreadMentionsCount: 0,
@@ -120,6 +122,7 @@ extension Array where Element == RoomSummary {
avatarURL: .mockMXCAvatar,
heroes: [],
lastMessage: AttributedString("How do you see the Emperor then? You think he keeps office hours?"),
lastMessageDate: nil,
lastMessageFormattedTimestamp: "2:56 PM",
unreadMessagesCount: 2,
unreadMentionsCount: 0,
@@ -138,6 +141,7 @@ extension Array where Element == RoomSummary {
avatarURL: nil,
heroes: [],
lastMessage: try? AttributedString(markdown: "He certainly seemed no *mental genius* to me"),
lastMessageDate: nil,
lastMessageFormattedTimestamp: "Some time ago",
unreadMessagesCount: 3,
unreadMentionsCount: 0,
@@ -156,6 +160,7 @@ extension Array where Element == RoomSummary {
avatarURL: nil,
heroes: [],
lastMessage: AttributedString("There's an archaic measure of time that's called the month"),
lastMessageDate: nil,
lastMessageFormattedTimestamp: "Just now",
unreadMessagesCount: 2,
unreadMentionsCount: 2,
@@ -174,6 +179,7 @@ extension Array where Element == RoomSummary {
avatarURL: nil,
heroes: [],
lastMessage: AttributedString("Clearly, if Earth is powerful enough to do that, it might also be capable of adjusting minds in order to force belief in its radioactivity"),
lastMessageDate: nil,
lastMessageFormattedTimestamp: "1986",
unreadMessagesCount: 1,
unreadMentionsCount: 1,
@@ -192,6 +198,7 @@ extension Array where Element == RoomSummary {
avatarURL: nil,
heroes: [],
lastMessage: AttributedString("Are you groping for the word 'paranoia'?"),
lastMessageDate: nil,
lastMessageFormattedTimestamp: "きょうはじゅういちがつじゅういちにちです",
unreadMessagesCount: 6,
unreadMentionsCount: 0,
@@ -210,6 +217,7 @@ extension Array where Element == RoomSummary {
avatarURL: nil,
heroes: [],
lastMessage: nil,
lastMessageDate: nil,
lastMessageFormattedTimestamp: nil,
unreadMessagesCount: 0,
unreadMentionsCount: 0,
@@ -261,6 +269,7 @@ extension Array where Element == RoomSummary {
avatarURL: .mockMXCAvatar,
heroes: [],
lastMessage: nil,
lastMessageDate: nil,
lastMessageFormattedTimestamp: nil,
unreadMessagesCount: 0,
unreadMentionsCount: 0,
@@ -279,6 +288,7 @@ extension Array where Element == RoomSummary {
avatarURL: nil,
heroes: [],
lastMessage: nil,
lastMessageDate: nil,
lastMessageFormattedTimestamp: nil,
unreadMessagesCount: 0,
unreadMentionsCount: 0,