From 43b4976ed7a7e2d94e61cd12147888f304f1fc43 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Thu, 15 Sep 2022 20:54:28 -0400 Subject: [PATCH] Maybe fix timeline discontinuities See #174 --- .../NotificationsTableViewController.swift | 14 +++++++------- .../Profile/ProfileStatusesViewController.swift | 14 +++++++------- .../Timeline/TimelineTableViewController.swift | 14 +++++++------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Tusker/Screens/Notifications/NotificationsTableViewController.swift b/Tusker/Screens/Notifications/NotificationsTableViewController.swift index 81564d43..f7fbe1d3 100644 --- a/Tusker/Screens/Notifications/NotificationsTableViewController.swift +++ b/Tusker/Screens/Notifications/NotificationsTableViewController.swift @@ -112,12 +112,12 @@ class NotificationsTableViewController: DiffableTimelineLikeTableViewController< case let .failure(error): completion(.failure(.client(error))) - case let .success(notifications, _): + case let .success(notifications, pagination): let groups = NotificationGroup.createGroups(notifications: notifications, only: self.groupTypes) if !notifications.isEmpty { - self.newer = .after(id: notifications.first!.id, count: nil) - self.older = .before(id: notifications.last!.id, count: nil) + self.newer = pagination?.newer ?? .after(id: notifications.first!.id, count: nil) + self.older = pagination?.older ?? .before(id: notifications.last!.id, count: nil) } self.mastodonController.persistentContainer.addAll(notifications: notifications) { @@ -142,9 +142,9 @@ class NotificationsTableViewController: DiffableTimelineLikeTableViewController< case let .failure(error): completion(.failure(.client(error))) - case let .success(newNotifications, _): + case let .success(newNotifications, pagination): if !newNotifications.isEmpty { - self.older = .before(id: newNotifications.last!.id, count: nil) + self.older = pagination?.older ?? .before(id: newNotifications.last!.id, count: nil) } let olderGroups = NotificationGroup.createGroups(notifications: newNotifications, only: self.groupTypes) @@ -173,13 +173,13 @@ class NotificationsTableViewController: DiffableTimelineLikeTableViewController< case let .failure(error): completion(.failure(.client(error))) - case let .success(newNotifications, _): + case let .success(newNotifications, pagination): guard !newNotifications.isEmpty else { completion(.failure(.allCaughtUp)) return } - self.newer = .after(id: newNotifications.first!.id, count: nil) + self.newer = pagination?.newer ?? .after(id: newNotifications.first!.id, count: nil) let newerGroups = NotificationGroup.createGroups(notifications: newNotifications, only: self.groupTypes) diff --git a/Tusker/Screens/Profile/ProfileStatusesViewController.swift b/Tusker/Screens/Profile/ProfileStatusesViewController.swift index d5df51e4..23ee8119 100644 --- a/Tusker/Screens/Profile/ProfileStatusesViewController.swift +++ b/Tusker/Screens/Profile/ProfileStatusesViewController.swift @@ -88,10 +88,10 @@ class ProfileStatusesViewController: DiffableTimelineLikeTableViewController