mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-05 20:09:04 +00:00
Remove now unneeded waitForInitialItems TimelineProvider method.
This commit is contained in:
committed by
Stefan Ceriu
parent
5984001720
commit
e66bbab63c
@@ -66,17 +66,6 @@ class TimelineItemProvider: TimelineItemProviderProtocol {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A continuation to signal whether the initial timeline items have been loaded and processed.
|
|
||||||
private var hasLoadedInitialItemsContinuation: CheckedContinuation<Void, Never>?
|
|
||||||
/// A method that allows `await`ing the first update of timeline items from the listener, as the items
|
|
||||||
/// aren't added directly to the provider upon initialisation and may take some time to come in.
|
|
||||||
func waitForInitialItems() async {
|
|
||||||
guard itemProxies.isEmpty else { return }
|
|
||||||
return await withCheckedContinuation { continuation in
|
|
||||||
hasLoadedInitialItemsContinuation = continuation
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: - Private
|
// MARK: - Private
|
||||||
|
|
||||||
private func updateItemsWithDiffs(_ diffs: [TimelineDiff]) {
|
private func updateItemsWithDiffs(_ diffs: [TimelineDiff]) {
|
||||||
@@ -101,11 +90,6 @@ class TimelineItemProvider: TimelineItemProviderProtocol {
|
|||||||
|
|
||||||
return updatedItems
|
return updatedItems
|
||||||
}
|
}
|
||||||
|
|
||||||
if let hasLoadedInitialItemsContinuation {
|
|
||||||
hasLoadedInitialItemsContinuation.resume()
|
|
||||||
self.hasLoadedInitialItemsContinuation = nil
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private func buildDiff(from diff: TimelineDiff, on itemProxies: [TimelineItemProxy]) -> CollectionDifference<TimelineItemProxy>? {
|
private func buildDiff(from diff: TimelineDiff, on itemProxies: [TimelineItemProxy]) -> CollectionDifference<TimelineItemProxy>? {
|
||||||
|
|||||||
@@ -53,9 +53,6 @@ final class TimelineProxy: TimelineProxyProtocol {
|
|||||||
await subscribeToPagination()
|
await subscribeToPagination()
|
||||||
|
|
||||||
let provider = await TimelineItemProvider(timeline: timeline, kind: kind, paginationStatePublisher: paginationStatePublisher)
|
let provider = await TimelineItemProvider(timeline: timeline, kind: kind, paginationStatePublisher: paginationStatePublisher)
|
||||||
// Make sure the existing items are built so that we have content in the timeline before
|
|
||||||
// determining whether or not the timeline should paginate to load more items.
|
|
||||||
await provider.waitForInitialItems()
|
|
||||||
|
|
||||||
innerTimelineItemProvider = provider
|
innerTimelineItemProvider = provider
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user