Enable all room summary provider logs to track down duplicated room list item problems

This commit is contained in:
Stefan Ceriu 2023-07-31 13:35:30 +03:00 committed by Stefan Ceriu
parent 3c8daebfe1
commit d1421f555b
2 changed files with 14 additions and 14 deletions

View File

@ -299,7 +299,7 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
}
}
// The SwiftUI scroll view needs special handling, see `selectivellyUpdateTimelineItems`
// The SwiftUI scroll view needs special handling, see `selectivelyUpdateTimelineItems`
if state.swiftUITimelineEnabled {
selectivelyUpdateTimelineItems(timelineItemsDictionary: timelineItemsDictionary)
} else {

View File

@ -75,7 +75,7 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
do {
let listUpdatesSubscriptionResult = try roomList.entries(listener: RoomListEntriesListenerProxy { [weak self] updates in
guard let self else { return }
MXLog.verbose("\(name): Received list update")
MXLog.info("\(name): Received list update")
diffsPublisher.send(updates)
})
@ -119,7 +119,7 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
span.exit()
}
MXLog.verbose("\(name): Received \(diffs.count) diffs, current room list \(rooms.compactMap { $0.id ?? "Empty" })")
MXLog.info("\(name): Received \(diffs.count) diffs, current room list \(rooms.compactMap { $0.id ?? "Empty" })")
rooms = diffs
.reduce(rooms) { currentItems, diff in
@ -138,7 +138,7 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
detectDuplicatesInRoomList(rooms)
MXLog.verbose("\(name): Finished applying \(diffs.count) diffs, new room list \(rooms.compactMap { $0.id ?? "Empty" })")
MXLog.info("\(name): Finished applying \(diffs.count) diffs, new room list \(rooms.compactMap { $0.id ?? "Empty" })")
}
private func fetchLastMessage(roomListItem: RoomListItemProtocol) -> EventTimelineItem? {
@ -212,36 +212,36 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
switch diff {
case .pushFront(let value):
MXLog.verbose("\(name): Push Front \(value.debugIdentifier)")
MXLog.info("\(name): Push Front \(value.debugIdentifier)")
let summary = buildSummaryForRoomListEntry(value)
changes.append(.insert(offset: 0, element: summary, associatedWith: nil))
case .pushBack(let value):
MXLog.verbose("\(name): Push Back \(value.debugIdentifier)")
MXLog.info("\(name): Push Back \(value.debugIdentifier)")
let summary = buildSummaryForRoomListEntry(value)
changes.append(.insert(offset: rooms.count, element: summary, associatedWith: nil))
case .append(values: let values):
let debugIdentifiers = values.map(\.debugIdentifier)
MXLog.verbose("\(name): Append \(debugIdentifiers)")
MXLog.info("\(name): Append \(debugIdentifiers)")
for (index, value) in values.enumerated() {
let summary = buildSummaryForRoomListEntry(value)
changes.append(.insert(offset: rooms.count + index, element: summary, associatedWith: nil))
}
case .set(let index, let value):
MXLog.verbose("\(name): Update \(value.debugIdentifier) at \(index)")
MXLog.info("\(name): Update \(value.debugIdentifier) at \(index)")
let summary = buildSummaryForRoomListEntry(value)
changes.append(.remove(offset: Int(index), element: summary, associatedWith: nil))
changes.append(.insert(offset: Int(index), element: summary, associatedWith: nil))
case .insert(let index, let value):
MXLog.verbose("\(name): Insert at \(value.debugIdentifier) at \(index)")
MXLog.info("\(name): Insert at \(value.debugIdentifier) at \(index)")
let summary = buildSummaryForRoomListEntry(value)
changes.append(.insert(offset: Int(index), element: summary, associatedWith: nil))
case .remove(let index):
let summary = rooms[Int(index)]
MXLog.verbose("\(name): Remove \(summary.id ?? "") from \(index)")
MXLog.info("\(name): Remove \(summary.id ?? "") from \(index)")
changes.append(.remove(offset: Int(index), element: summary, associatedWith: nil))
case .reset(let values):
let debugIdentifiers = values.map(\.debugIdentifier)
MXLog.verbose("\(name): Replace all items with \(debugIdentifiers)")
MXLog.info("\(name): Replace all items with \(debugIdentifiers)")
for (index, summary) in rooms.enumerated() {
changes.append(.remove(offset: index, element: summary, associatedWith: nil))
}
@ -250,16 +250,16 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
changes.append(.insert(offset: index, element: buildSummaryForRoomListEntry(value), associatedWith: nil))
}
case .clear:
MXLog.verbose("\(name): Clear all items")
MXLog.info("\(name): Clear all items")
for (index, value) in rooms.enumerated() {
changes.append(.remove(offset: index, element: value, associatedWith: nil))
}
case .popFront:
MXLog.verbose("\(name): Pop Front")
MXLog.info("\(name): Pop Front")
let summary = rooms[0]
changes.append(.remove(offset: 0, element: summary, associatedWith: nil))
case .popBack:
MXLog.verbose("\(name): Pop Back")
MXLog.info("\(name): Pop Back")
guard let value = rooms.last else {
fatalError()
}