forked from shadowfacts/Tusker
parent
ff3681627b
commit
43b4976ed7
|
@ -112,12 +112,12 @@ class NotificationsTableViewController: DiffableTimelineLikeTableViewController<
|
||||||
case let .failure(error):
|
case let .failure(error):
|
||||||
completion(.failure(.client(error)))
|
completion(.failure(.client(error)))
|
||||||
|
|
||||||
case let .success(notifications, _):
|
case let .success(notifications, pagination):
|
||||||
let groups = NotificationGroup.createGroups(notifications: notifications, only: self.groupTypes)
|
let groups = NotificationGroup.createGroups(notifications: notifications, only: self.groupTypes)
|
||||||
|
|
||||||
if !notifications.isEmpty {
|
if !notifications.isEmpty {
|
||||||
self.newer = .after(id: notifications.first!.id, count: nil)
|
self.newer = pagination?.newer ?? .after(id: notifications.first!.id, count: nil)
|
||||||
self.older = .before(id: notifications.last!.id, count: nil)
|
self.older = pagination?.older ?? .before(id: notifications.last!.id, count: nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
self.mastodonController.persistentContainer.addAll(notifications: notifications) {
|
self.mastodonController.persistentContainer.addAll(notifications: notifications) {
|
||||||
|
@ -142,9 +142,9 @@ class NotificationsTableViewController: DiffableTimelineLikeTableViewController<
|
||||||
case let .failure(error):
|
case let .failure(error):
|
||||||
completion(.failure(.client(error)))
|
completion(.failure(.client(error)))
|
||||||
|
|
||||||
case let .success(newNotifications, _):
|
case let .success(newNotifications, pagination):
|
||||||
if !newNotifications.isEmpty {
|
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)
|
let olderGroups = NotificationGroup.createGroups(notifications: newNotifications, only: self.groupTypes)
|
||||||
|
@ -173,13 +173,13 @@ class NotificationsTableViewController: DiffableTimelineLikeTableViewController<
|
||||||
case let .failure(error):
|
case let .failure(error):
|
||||||
completion(.failure(.client(error)))
|
completion(.failure(.client(error)))
|
||||||
|
|
||||||
case let .success(newNotifications, _):
|
case let .success(newNotifications, pagination):
|
||||||
guard !newNotifications.isEmpty else {
|
guard !newNotifications.isEmpty else {
|
||||||
completion(.failure(.allCaughtUp))
|
completion(.failure(.allCaughtUp))
|
||||||
return
|
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)
|
let newerGroups = NotificationGroup.createGroups(notifications: newNotifications, only: self.groupTypes)
|
||||||
|
|
||||||
|
|
|
@ -88,10 +88,10 @@ class ProfileStatusesViewController: DiffableTimelineLikeTableViewController<Pro
|
||||||
case let .failure(error):
|
case let .failure(error):
|
||||||
completion(.failure(.client(error)))
|
completion(.failure(.client(error)))
|
||||||
|
|
||||||
case let .success(statuses, _):
|
case let .success(statuses, pagination):
|
||||||
if !statuses.isEmpty {
|
if !statuses.isEmpty {
|
||||||
self.newer = .after(id: statuses.first!.id, count: nil)
|
self.newer = pagination?.newer ?? .after(id: statuses.first!.id, count: nil)
|
||||||
self.older = .before(id: statuses.last!.id, count: nil)
|
self.older = pagination?.older ?? .before(id: statuses.last!.id, count: nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
self.mastodonController.persistentContainer.addAll(statuses: statuses) {
|
self.mastodonController.persistentContainer.addAll(statuses: statuses) {
|
||||||
|
@ -144,13 +144,13 @@ class ProfileStatusesViewController: DiffableTimelineLikeTableViewController<Pro
|
||||||
case let .failure(error):
|
case let .failure(error):
|
||||||
completion(.failure(.client(error)))
|
completion(.failure(.client(error)))
|
||||||
|
|
||||||
case let .success(statuses, _):
|
case let .success(statuses, pagination):
|
||||||
guard !statuses.isEmpty else {
|
guard !statuses.isEmpty else {
|
||||||
completion(.failure(.noOlder))
|
completion(.failure(.noOlder))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
self.older = .before(id: statuses.last!.id, count: nil)
|
self.older = pagination?.older ?? .before(id: statuses.last!.id, count: nil)
|
||||||
|
|
||||||
self.mastodonController.persistentContainer.addAll(statuses: statuses) {
|
self.mastodonController.persistentContainer.addAll(statuses: statuses) {
|
||||||
var snapshot = currentSnapshot()
|
var snapshot = currentSnapshot()
|
||||||
|
@ -173,13 +173,13 @@ class ProfileStatusesViewController: DiffableTimelineLikeTableViewController<Pro
|
||||||
case let .failure(error):
|
case let .failure(error):
|
||||||
completion(.failure(.client(error)))
|
completion(.failure(.client(error)))
|
||||||
|
|
||||||
case let .success(statuses, _):
|
case let .success(statuses, pagination):
|
||||||
guard !statuses.isEmpty else {
|
guard !statuses.isEmpty else {
|
||||||
completion(.failure(.allCaughtUp))
|
completion(.failure(.allCaughtUp))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
self.newer = .after(id: statuses.first!.id, count: nil)
|
self.newer = pagination?.newer ?? .after(id: statuses.first!.id, count: nil)
|
||||||
|
|
||||||
self.mastodonController.persistentContainer.addAll(statuses: statuses) {
|
self.mastodonController.persistentContainer.addAll(statuses: statuses) {
|
||||||
var snapshot = currentSnapshot()
|
var snapshot = currentSnapshot()
|
||||||
|
|
|
@ -142,10 +142,10 @@ class TimelineTableViewController: DiffableTimelineLikeTableViewController<Timel
|
||||||
case let .failure(error):
|
case let .failure(error):
|
||||||
completion(.failure(.client(error)))
|
completion(.failure(.client(error)))
|
||||||
|
|
||||||
case let .success(statuses, _):
|
case let .success(statuses, pagination):
|
||||||
if !statuses.isEmpty {
|
if !statuses.isEmpty {
|
||||||
self.newer = .after(id: statuses.first!.id, count: nil)
|
self.newer = pagination?.newer ?? .after(id: statuses.first!.id, count: nil)
|
||||||
self.older = .before(id: statuses.last!.id, count: nil)
|
self.older = pagination?.older ?? .before(id: statuses.last!.id, count: nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
self.mastodonController.persistentContainer.addAll(statuses: statuses) {
|
self.mastodonController.persistentContainer.addAll(statuses: statuses) {
|
||||||
|
@ -189,9 +189,9 @@ class TimelineTableViewController: DiffableTimelineLikeTableViewController<Timel
|
||||||
case let .failure(error):
|
case let .failure(error):
|
||||||
completion(.failure(.client(error)))
|
completion(.failure(.client(error)))
|
||||||
|
|
||||||
case let .success(statuses, _):
|
case let .success(statuses, pagination):
|
||||||
if !statuses.isEmpty {
|
if !statuses.isEmpty {
|
||||||
self.older = .before(id: statuses.last!.id, count: nil)
|
self.older = pagination?.older ?? .before(id: statuses.last!.id, count: nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
self.mastodonController.persistentContainer.addAll(statuses: statuses) {
|
self.mastodonController.persistentContainer.addAll(statuses: statuses) {
|
||||||
|
@ -216,13 +216,13 @@ class TimelineTableViewController: DiffableTimelineLikeTableViewController<Timel
|
||||||
case let .failure(error):
|
case let .failure(error):
|
||||||
completion(.failure(.client(error)))
|
completion(.failure(.client(error)))
|
||||||
|
|
||||||
case let .success(statuses, _):
|
case let .success(statuses, pagination):
|
||||||
guard !statuses.isEmpty else {
|
guard !statuses.isEmpty else {
|
||||||
completion(.failure(.allCaughtUp))
|
completion(.failure(.allCaughtUp))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
self.newer = .after(id: statuses.first!.id, count: nil)
|
self.newer = pagination?.newer ?? .after(id: statuses.first!.id, count: nil)
|
||||||
|
|
||||||
self.mastodonController.persistentContainer.addAll(statuses: statuses) {
|
self.mastodonController.persistentContainer.addAll(statuses: statuses) {
|
||||||
var snapshot = currentSnapshot()
|
var snapshot = currentSnapshot()
|
||||||
|
|
Loading…
Reference in New Issue