Don't check present when refreshing timeline

This commit is contained in:
Shadowfacts 2023-02-25 16:39:00 -05:00
parent 0c0180264e
commit 38ac5858a9
1 changed files with 5 additions and 17 deletions

View File

@ -718,27 +718,15 @@ class TimelineViewController: UIViewController, TimelineLikeCollectionViewContro
}
@objc func refresh() {
Task {
Task { @MainActor in
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 (loadNewerAndEndRefreshing(), try? loadInitial())
if let presentItems, !presentItems.isEmpty {
insertPresentItemsAndShowJumpToast(presentItems)
}
await controller.loadNewer()
}
#if !targetEnvironment(macCatalyst)
collectionView.refreshControl?.endRefreshing()
#endif
}
}