mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 10:33:45 +00:00
Fix back pagination (#432)
* Use pagination and start items for view state. isBackPaginating and canBackPaginate are updated each time the timeline is rebuilt * Update some timeline snapshots The top section has gone, which has altered the layout slightly.
This commit is contained in:
@@ -61,6 +61,9 @@ class TimelineTableViewController: UIViewController {
|
||||
}
|
||||
}
|
||||
|
||||
/// Whether or not the timeline has more messages to back paginate.
|
||||
var canBackPaginate = true
|
||||
|
||||
/// Whether or not the timeline is waiting for more messages to be added to the top.
|
||||
var isBackPaginating = false {
|
||||
didSet {
|
||||
@@ -334,7 +337,8 @@ class TimelineTableViewController: UIViewController {
|
||||
///
|
||||
/// Prefer not to call this directly, instead using ``paginateBackwardsPublisher`` to throttle requests.
|
||||
private func paginateBackwardsIfNeeded() {
|
||||
guard !isBackPaginating,
|
||||
guard canBackPaginate,
|
||||
!isBackPaginating,
|
||||
!hasPendingUpdates,
|
||||
tableView.contentOffset.y < tableView.visibleSize.height * 2.0
|
||||
else { return }
|
||||
|
||||
@@ -59,6 +59,9 @@ struct TimelineView: UIViewControllerRepresentable {
|
||||
if tableViewController.timelineItems != context.viewState.items {
|
||||
tableViewController.timelineItems = context.viewState.items
|
||||
}
|
||||
if tableViewController.canBackPaginate != context.viewState.canBackPaginate {
|
||||
tableViewController.canBackPaginate = context.viewState.canBackPaginate
|
||||
}
|
||||
if tableViewController.isBackPaginating != context.viewState.isBackPaginating {
|
||||
tableViewController.isBackPaginating = context.viewState.isBackPaginating
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user