tombstoned and upgraded rooms implementation

added tests

tombstoned room avatar
This commit is contained in:
Mauro Romito
2025-06-03 12:52:31 +02:00
committed by Mauro
parent b628f5d2c2
commit 155b47e849
76 changed files with 438 additions and 171 deletions
@@ -56,6 +56,8 @@ struct RoomSummary {
let isMarkedUnread: Bool
let isFavourite: Bool
let isTombstoned: Bool
var hasUnreadMessages: Bool { unreadMessagesCount > 0 }
var hasUnreadMentions: Bool { unreadMentionsCount > 0 }
var hasUnreadNotifications: Bool { unreadNotificationsCount > 0 }
@@ -124,14 +126,19 @@ extension RoomSummary {
joinRequestType = nil
isMarkedUnread = false
isFavourite = false
isTombstoned = false
}
// This doesn't have to work properly for DM invites, the heroes are always empty
var avatar: RoomAvatar {
guard !isTombstoned else {
return .tombstoned
}
if isDirect, avatarURL == nil, heroes.count == 1 {
.heroes(heroes)
return .heroes(heroes)
} else {
.room(id: id, name: name, avatarURL: avatarURL)
return .room(id: id, name: name, avatarURL: avatarURL)
}
}
}