diff --git a/Tusker/Screens/Notifications/NotificationsTableViewController.swift b/Tusker/Screens/Notifications/NotificationsTableViewController.swift index e5f1061a..70142897 100644 --- a/Tusker/Screens/Notifications/NotificationsTableViewController.swift +++ b/Tusker/Screens/Notifications/NotificationsTableViewController.swift @@ -127,6 +127,33 @@ class NotificationsTableViewController: EnhancedTableViewController { // MARK: - Table view delegate override func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) { + // see TimelineTableViewController.tableView(_:willDisplay:forRowAt:) + if !isCurrentlyScrollingToTop, scrollViewDirection < 0 { + let pageSize = 20 + if groups.count > 2 * pageSize, + indexPath.row < groups.count - (2 * pageSize) { + let groupsToRemove = groups[groups.count - pageSize.. Bool { if let offset = prevScrollToTopOffset { @@ -37,7 +41,15 @@ class EnhancedTableViewController: UITableViewController { prevScrollToTopOffset = nil } + override func scrollViewDidScroll(_ scrollView: UIScrollView) { + if let prev = prevScrollViewContentOffset { + scrollViewDirection = scrollView.contentOffset.y - prev.y + } + prevScrollViewContentOffset = scrollView.contentOffset + } + // MARK: Table View Delegate + override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { if let cell = tableView.cellForRow(at: indexPath) as? SelectableTableViewCell { cell.didSelectCell()