mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 10:33:45 +00:00
Add back custom identifiers for invalidated room, avoid duplicates and gaps on the room list
This commit is contained in:
committed by
Stefan Ceriu
parent
ee643f7a69
commit
d120a53ebd
@@ -141,7 +141,7 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
|
||||
MXLog.verbose("\(name): Finished applying \(diffs.count) diffs, new room list \(rooms.compactMap { $0.id ?? "Empty" })")
|
||||
}
|
||||
|
||||
private func buildRoomSummaryForIdentifier(_ identifier: String) -> RoomSummary {
|
||||
private func buildRoomSummaryForIdentifier(_ identifier: String, invalidated: Bool) -> RoomSummary {
|
||||
guard let roomListItem = try? roomListService.room(roomId: identifier) else {
|
||||
MXLog.error("\(name): Failed finding room with id: \(identifier)")
|
||||
return .empty
|
||||
@@ -167,7 +167,7 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
|
||||
unreadNotificationCount: UInt(roomListItem.unreadNotifications().notificationCount()),
|
||||
canonicalAlias: room.canonicalAlias())
|
||||
|
||||
return .filled(details: details)
|
||||
return invalidated ? .invalidated(details: details) : .filled(details: details)
|
||||
}
|
||||
|
||||
private func buildSummaryForRoomListEntry(_ entry: RoomListEntry) -> RoomSummary {
|
||||
@@ -175,9 +175,9 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
|
||||
case .empty:
|
||||
return .empty
|
||||
case .filled(let roomId):
|
||||
return buildRoomSummaryForIdentifier(roomId)
|
||||
return buildRoomSummaryForIdentifier(roomId, invalidated: false)
|
||||
case .invalidated(let roomId):
|
||||
return buildRoomSummaryForIdentifier(roomId)
|
||||
return buildRoomSummaryForIdentifier(roomId, invalidated: true)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,12 +28,13 @@ enum RoomSummaryProviderState {
|
||||
enum RoomSummary: CustomStringConvertible {
|
||||
case empty
|
||||
case filled(details: RoomSummaryDetails)
|
||||
case invalidated(details: RoomSummaryDetails)
|
||||
|
||||
var id: String? {
|
||||
switch self {
|
||||
case .empty:
|
||||
return nil
|
||||
case .filled(let details):
|
||||
case .invalidated(let details), .filled(let details):
|
||||
return details.id
|
||||
}
|
||||
}
|
||||
@@ -42,7 +43,7 @@ enum RoomSummary: CustomStringConvertible {
|
||||
switch self {
|
||||
case .empty:
|
||||
return nil
|
||||
case .filled(let details):
|
||||
case .invalidated(let details), .filled(let details):
|
||||
return details.name
|
||||
}
|
||||
}
|
||||
@@ -51,6 +52,8 @@ enum RoomSummary: CustomStringConvertible {
|
||||
switch self {
|
||||
case .empty:
|
||||
return "\(String(describing: Self.self)): Empty"
|
||||
case .invalidated(let details):
|
||||
return "\(String(describing: Self.self)): Invalidated(\(details.id))"
|
||||
case .filled(let details):
|
||||
return "\(String(describing: Self.self)): Filled(\(details.id))"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user