mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
This commit is contained in:
@@ -87,6 +87,8 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
|
||||
return updatedItems
|
||||
}
|
||||
|
||||
detectDuplicatesInRoomList(rooms)
|
||||
|
||||
MXLog.info("Finished applying \(diffs.count) diffs")
|
||||
}
|
||||
|
||||
@@ -185,6 +187,25 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
|
||||
|
||||
return CollectionDifference(changes)
|
||||
}
|
||||
|
||||
private func detectDuplicatesInRoomList(_ rooms: [RoomSummary]) {
|
||||
let filteredRooms = rooms.filter {
|
||||
switch $0 {
|
||||
case .empty:
|
||||
return false
|
||||
default:
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
let groupedRooms = Dictionary(grouping: filteredRooms, by: \.id)
|
||||
|
||||
let duplicates = groupedRooms.filter { $1.count > 1 }
|
||||
|
||||
if duplicates.count > 0 {
|
||||
MXLog.error("Found duplicated room room list items: \(duplicates)")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension SlidingSyncViewRoomsListDiff {
|
||||
|
||||
@@ -25,7 +25,7 @@ enum RoomSummaryProviderState {
|
||||
case live
|
||||
}
|
||||
|
||||
enum RoomSummary {
|
||||
enum RoomSummary: CustomStringConvertible {
|
||||
case empty
|
||||
case filled(details: RoomSummaryDetails)
|
||||
case invalidated(details: RoomSummaryDetails)
|
||||
@@ -38,6 +38,17 @@ enum RoomSummary {
|
||||
return details.id
|
||||
}
|
||||
}
|
||||
|
||||
var description: String {
|
||||
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))"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protocol RoomSummaryProviderProtocol {
|
||||
|
||||
Reference in New Issue
Block a user