Load more entries from user timeline (IOS-272)

This commit is contained in:
Nathan Mattes 2024-05-24 15:46:08 +02:00
parent af650edbb0
commit 622a2fa5c9
1 changed files with 9 additions and 11 deletions

View File

@ -54,17 +54,6 @@ extension UserTimelineViewController {
tableView: tableView, tableView: tableView,
statusTableViewCellDelegate: self statusTableViewCellDelegate: self
) )
// 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(UserTimelineViewModel.State.Loading.self)
}
.store(in: &disposeBag)
} }
override func viewWillAppear(_ animated: Bool) { override func viewWillAppear(_ animated: Bool) {
@ -169,3 +158,12 @@ extension UserTimelineViewController: IndicatorInfoProvider {
return IndicatorInfo(title: viewModel.title) return IndicatorInfo(title: viewModel.title)
} }
} }
//MARK: - UIScrollViewDelegate
extension UserTimelineViewController: UIScrollViewDelegate {
func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
ListBatchFetchViewModel.scrollViewDidScrollToEnd(scrollView) {
viewModel.stateMachine.enter(UserTimelineViewModel.State.Loading.self)
}
}
}