forked from shadowfacts/Tusker
Add default request ranges for when Link header is not returned
This commit is contained in:
parent
bd81c81500
commit
5821a16ca7
|
@ -157,8 +157,8 @@ class ProfileTableViewController: EnhancedTableViewController {
|
|||
|
||||
override func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
|
||||
if timelineSegments.count > 0 && indexPath.section == timelineSegments.count && indexPath.row == timelineSegments[indexPath.section - 1].count - 1 {
|
||||
guard let older = older else { return }
|
||||
|
||||
let older = self.older ?? RequestRange.after(id: timelineSegments.last!.last!, count: nil)
|
||||
|
||||
getStatuses(for: older) { response in
|
||||
guard case let .success(newStatuses, pagination) = response else { fatalError() }
|
||||
|
||||
|
@ -183,8 +183,8 @@ class ProfileTableViewController: EnhancedTableViewController {
|
|||
}
|
||||
|
||||
@objc func refreshStatuses(_ sender: Any) {
|
||||
guard let newer = newer else { return }
|
||||
|
||||
let newer = self.newer ?? RequestRange.after(id: timelineSegments.first!.first!, count: nil)
|
||||
|
||||
getStatuses(for: newer) { response in
|
||||
guard case let .success(newStatuses, pagination) = response else { fatalError() }
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ class TimelineTableViewController: EnhancedTableViewController {
|
|||
|
||||
var newer: RequestRange?
|
||||
var older: RequestRange?
|
||||
|
||||
|
||||
init(for timeline: Timeline) {
|
||||
self.timeline = timeline
|
||||
|
||||
|
@ -105,7 +105,7 @@ class TimelineTableViewController: EnhancedTableViewController {
|
|||
override func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
|
||||
if indexPath.section == timelineSegments.count - 1,
|
||||
indexPath.row == timelineSegments[indexPath.section].count - 1 {
|
||||
guard let older = older else { return }
|
||||
let older = self.older ?? RequestRange.before(id: timelineSegments.last!.last!, count: nil)
|
||||
|
||||
let request = MastodonController.client.getStatuses(timeline: timeline, range: older)
|
||||
MastodonController.client.run(request) { response in
|
||||
|
@ -130,7 +130,7 @@ class TimelineTableViewController: EnhancedTableViewController {
|
|||
}
|
||||
|
||||
@objc func refreshStatuses(_ sender: Any) {
|
||||
guard let newer = newer else { return }
|
||||
let newer = self.newer ?? RequestRange.after(id: timelineSegments.first!.first!, count: nil)
|
||||
|
||||
let request = MastodonController.client.getStatuses(timeline: timeline, range: newer)
|
||||
MastodonController.client.run(request) { response in
|
||||
|
|
Loading…
Reference in New Issue