Load more notifications (IOS-272)

This commit is contained in:
Nathan Mattes 2024-05-24 15:30:00 +02:00
parent fe8e0dfdcd
commit bd9d19f8b6
1 changed files with 10 additions and 10 deletions

View File

@ -55,16 +55,6 @@ extension NotificationTimelineViewController {
notificationTableViewCellDelegate: 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 }
self.viewModel.loadOldestStateMachine.enter(NotificationTimelineViewModel.LoadOldestState.Loading.self)
}
.store(in: &disposeBag)
// setup refresh control
tableView.refreshControl = refreshControl
viewModel.didLoadLatest
@ -306,3 +296,13 @@ extension NotificationTimelineViewController: TableViewControllerNavigateable {
}
}
//MARK: - UIScrollViewDelegate
extension NotificationTimelineViewController: UIScrollViewDelegate {
func scrollViewDidScroll(_ scrollView: UIScrollView) {
ListBatchFetchViewModel.scrollViewdidScrollToEnd(scrollView) {
viewModel.loadOldestStateMachine.enter(NotificationTimelineViewModel.LoadOldestState.Loading.self)
}
}
}