Load more statuses from discover-posts-timeline right away (IOS-272)

This commit is contained in:
Nathan Mattes 2024-05-23 15:57:38 +02:00
parent a86fc70828
commit 7d446c5fc7
1 changed files with 10 additions and 11 deletions

View File

@ -74,17 +74,6 @@ extension DiscoveryPostsViewController {
self.refreshControl.endRefreshing()
}
.store(in: &disposeBag)
// setup batch fetch
viewModel.listBatchFetchViewModel.setup(scrollView: tableView)
viewModel.listBatchFetchViewModel.shouldFetch
.receive(on: DispatchQueue.main)
.sink { [weak self] _ in
guard let self = self else { return }
guard self.view.window != nil else { return }
self.viewModel.stateMachine.enter(DiscoveryPostsViewModel.State.Loading.self)
}
.store(in: &disposeBag)
}
override func viewWillAppear(_ animated: Bool) {
@ -171,3 +160,13 @@ extension DiscoveryPostsViewController: StatusTableViewControllerNavigateable {
statusKeyCommandHandler(sender)
}
}
//MARK: - UIScrollViewDelegate
extension DiscoveryPostsViewController: UIScrollViewDelegate {
func scrollViewDidScroll(_ scrollView: UIScrollView) {
ListBatchFetchViewModel.scrollViewdidScrollToEnd(scrollView) {
viewModel.stateMachine.enter(DiscoveryPostsViewModel.State.Loading.self)
}
}
}