Remove now unneeded waitForInitialItems TimelineProvider method.
This commit is contained in:
committed by
Stefan Ceriu
parent
e375950ba1
commit
22b1ecf6be
@@ -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
|
||||
|
||||
private func updateItemsWithDiffs(_ diffs: [TimelineDiff]) {
|
||||
@@ -101,11 +90,6 @@ class TimelineItemProvider: TimelineItemProviderProtocol {
|
||||
|
||||
return updatedItems
|
||||
}
|
||||
|
||||
if let hasLoadedInitialItemsContinuation {
|
||||
hasLoadedInitialItemsContinuation.resume()
|
||||
self.hasLoadedInitialItemsContinuation = nil
|
||||
}
|
||||
}
|
||||
|
||||
private func buildDiff(from diff: TimelineDiff, on itemProxies: [TimelineItemProxy]) -> CollectionDifference<TimelineItemProxy>? {
|
||||
|
||||
@@ -53,9 +53,6 @@ final class TimelineProxy: TimelineProxyProtocol {
|
||||
await subscribeToPagination()
|
||||
|
||||
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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user