mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 01:20:12 +00:00
tombstoned and upgraded rooms implementation
added tests tombstoned room avatar
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -281,7 +281,8 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
|
||||
alternativeAliases: .init(roomInfo.alternativeAliases),
|
||||
hasOngoingCall: roomInfo.hasRoomCall,
|
||||
isMarkedUnread: roomInfo.isMarkedUnread,
|
||||
isFavourite: roomInfo.isFavourite)
|
||||
isFavourite: roomInfo.isFavourite,
|
||||
isTombstoned: roomInfo.successorRoom != nil)
|
||||
}
|
||||
|
||||
private func buildDiff(from diff: RoomListEntriesUpdate, on rooms: [RoomSummary]) -> CollectionDifference<RoomSummary>? {
|
||||
|
||||
Reference in New Issue
Block a user