Fix refreshes after no-result refresh not working

Fixes #117
This commit is contained in:
Shadowfacts 2021-01-12 22:32:14 -05:00
parent d7aa3f1617
commit 27b39b79e6
3 changed files with 11 additions and 3 deletions

View File

@ -98,7 +98,9 @@ class NotificationsTableViewController: TimelineLikeTableViewController<Notifica
mastodonController.run(request) { (response) in
guard case let .success(newNotifications, pagination) = response else { fatalError() }
self.newer = pagination?.newer
if let newer = pagination?.newer {
self.newer = newer
}
let groups = NotificationGroup.createGroups(notifications: newNotifications, only: self.groupTypes)

View File

@ -145,7 +145,9 @@ class ProfileStatusesViewController: TimelineLikeTableViewController<TimelineEnt
return
}
self.newer = pagination?.newer
if let newer = pagination?.newer {
self.newer = newer
}
self.mastodonController.persistentContainer.addAll(statuses: statuses) {
completion(statuses.map { ($0.id, .unknown) })

View File

@ -113,7 +113,11 @@ class TimelineTableViewController: TimelineLikeTableViewController<TimelineEntry
mastodonController.run(request) { (response) in
guard case let .success(statuses, pagination) = response else { fatalError() }
self.newer = pagination?.newer
// if there are no new statuses, pagination is nil
// if we were to then overwrite self.newer, future refreshes would fail
if let newer = pagination?.newer {
self.newer = newer
}
self.mastodonController?.persistentContainer.addAll(statuses: statuses) {
completion(statuses.map { ($0.id, .unknown) })