mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
Add back verbose logging for the timeline provider to help debug the event cache and lazy loading.
This commit is contained in:
@@ -85,6 +85,8 @@ class TimelineProvider: TimelineProviderProtocol {
|
|||||||
span.exit()
|
span.exit()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MXLog.verbose("Received diffs: \(diffs)")
|
||||||
|
|
||||||
itemProxies = diffs.reduce(itemProxies) { currentItems, diff in
|
itemProxies = diffs.reduce(itemProxies) { currentItems, diff in
|
||||||
guard let collectionDiff = buildDiff(from: diff, on: currentItems) else {
|
guard let collectionDiff = buildDiff(from: diff, on: currentItems) else {
|
||||||
MXLog.error("Failed building CollectionDifference from \(diff)")
|
MXLog.error("Failed building CollectionDifference from \(diff)")
|
||||||
@@ -222,3 +224,53 @@ private final class RoomTimelineListener: TimelineListener {
|
|||||||
onUpdateClosure(diff)
|
onUpdateClosure(diff)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private extension Array where Element == TimelineDiff {
|
||||||
|
var debugDescription: String {
|
||||||
|
"[" + map(\.debugDescription).joined(separator: ",") + "]"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension TimelineDiff: @retroactive CustomDebugStringConvertible {
|
||||||
|
public var debugDescription: String {
|
||||||
|
switch change() {
|
||||||
|
case .append:
|
||||||
|
guard let update = append() else {
|
||||||
|
fatalError()
|
||||||
|
}
|
||||||
|
return "Append(\(update.count))"
|
||||||
|
case .clear:
|
||||||
|
return "Clear"
|
||||||
|
case .insert:
|
||||||
|
return "Insert"
|
||||||
|
case .set:
|
||||||
|
guard let update = set() else {
|
||||||
|
fatalError()
|
||||||
|
}
|
||||||
|
return "Set(\(update.index))"
|
||||||
|
case .remove:
|
||||||
|
guard let update = remove() else {
|
||||||
|
fatalError()
|
||||||
|
}
|
||||||
|
return "Remove(\(update)"
|
||||||
|
case .pushBack:
|
||||||
|
return "PushBack"
|
||||||
|
case .pushFront:
|
||||||
|
return "PushFront"
|
||||||
|
case .popBack:
|
||||||
|
return "PopBack"
|
||||||
|
case .popFront:
|
||||||
|
return "PopFront"
|
||||||
|
case .truncate:
|
||||||
|
guard let update = truncate() else {
|
||||||
|
fatalError()
|
||||||
|
}
|
||||||
|
return "Truncate(\(update))"
|
||||||
|
case .reset:
|
||||||
|
guard let update = reset() else {
|
||||||
|
fatalError()
|
||||||
|
}
|
||||||
|
return "Reset(\(update.count)@\(update.startIndex)-\(update.endIndex))"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user