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

This commit is contained in:
Nathan Mattes 2024-05-23 15:45:17 +02:00
parent 008691bdf8
commit 6b99c9def3
1 changed files with 11 additions and 11 deletions

View File

@ -95,17 +95,7 @@ extension HashtagTimelineViewController {
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 }
self.viewModel.stateMachine.enter(HashtagTimelineViewModel.State.Loading.self)
}
.store(in: &disposeBag)
viewModel.hashtagEntity
.receive(on: DispatchQueue.main)
.sink { [weak self] tag in
@ -257,3 +247,13 @@ extension HashtagTimelineViewController: StatusTableViewControllerNavigateable {
statusKeyCommandHandler(sender)
}
}
// MARK: - UIScrollViewDelegate
extension HashtagTimelineViewController: UIScrollViewDelegate {
func scrollViewDidScroll(_ scrollView: UIScrollView) {
ListBatchFetchViewModel.scrollViewdidScrollToEnd(scrollView) {
viewModel.stateMachine.enter(HashtagTimelineViewModel.State.Loading.self)
}
}
}