forked from shadowfacts/Tusker
When refreshing timeline, hide activity indicator as soon as loadNewer completes
This commit is contained in:
parent
21299c8eb8
commit
c256fb4cbd
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue