From db304710119cfbb7c827e94a9d8a940a49f9f3a9 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Sun, 5 Jul 2020 16:30:16 -0400 Subject: [PATCH] Fix not being able to refresh timelines --- Tusker/Screens/Timeline/TimelineTableViewController.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Tusker/Screens/Timeline/TimelineTableViewController.swift b/Tusker/Screens/Timeline/TimelineTableViewController.swift index 025c9826..0a1fa3e7 100644 --- a/Tusker/Screens/Timeline/TimelineTableViewController.swift +++ b/Tusker/Screens/Timeline/TimelineTableViewController.swift @@ -213,15 +213,17 @@ class TimelineTableViewController: EnhancedTableViewController { let request = Client.getStatuses(timeline: timeline, range: newer) mastodonController.run(request) { response in guard case let .success(newStatuses, pagination) = response else { fatalError() } - self.newer = pagination?.newer self.timelineSegments[0].insert(contentsOf: newStatuses.map { ($0.id, .unknown) }, at: 0) + // If there is no new newer pagination, don't reset it, so that the user can continue refreshing for more recent statuses + // Otherwise, when no new statuses were loaded, it would get reset and the the user would be unable to refresh if let newer = pagination?.newer { self.newer = newer } self.mastodonController.persistentContainer.addAll(statuses: newStatuses) { DispatchQueue.main.async { + self.timelineSegments[0].insert(contentsOf: newStatuses.map { ($0.id, .unknown) }, at: 0) let newIndexPaths = (0..