diff --git a/Tusker/Screens/Timeline/TimelineViewController.swift b/Tusker/Screens/Timeline/TimelineViewController.swift index 8ca57ed8f7..50281e0be8 100644 --- a/Tusker/Screens/Timeline/TimelineViewController.swift +++ b/Tusker/Screens/Timeline/TimelineViewController.swift @@ -312,16 +312,24 @@ class TimelineViewController: UIViewController, TimelineLikeCollectionViewContro Task { if case .notLoadedInitial = controller.state { await controller.loadInitial() + #if !targetEnvironment(macCatalyst) + collectionView.refreshControl?.endRefreshing() + #endif } else { + @MainActor + func loadNewerAndEndRefreshing() async { + await controller.loadNewer() + #if !targetEnvironment(macCatalyst) + collectionView.refreshControl?.endRefreshing() + #endif + } + // I'm not sure whether this should move into TimelineLikeController/TimelineLikeCollectionViewController - let (_, presentItems) = await (controller.loadNewer(), try? loadInitial()) + let (_, presentItems) = await (loadNewerAndEndRefreshing(), try? loadInitial()) if let presentItems, !presentItems.isEmpty { insertPresentItemsIfNecessary(presentItems) } } - #if !targetEnvironment(macCatalyst) - collectionView.refreshControl?.endRefreshing() - #endif } }