forked from shadowfacts/Tusker
Fix loading additional statuses on profiles not working
This was a regression introduced in
d27bddb2ca
which removed the didSet
handlers which called reloadData on the pinnedStatuses/timelineSegments
property without adding the appropriate insertRows calls where they were
modified.
This commit is contained in:
parent
c3c19b1994
commit
6e27399e10
|
@ -209,9 +209,16 @@ class ProfileTableViewController: EnhancedTableViewController {
|
|||
guard case let .success(newStatuses, pagination) = response else { fatalError() }
|
||||
|
||||
self.mastodonController.persistentContainer.addAll(statuses: newStatuses) {
|
||||
self.timelineSegments[indexPath.section - 2].append(contentsOf: newStatuses.map { ($0.id, .unknown) })
|
||||
|
||||
self.older = pagination?.older
|
||||
|
||||
DispatchQueue.main.async {
|
||||
let start = self.timelineSegments[indexPath.section - 2].count
|
||||
let indexPaths = (0..<newStatuses.count).map { IndexPath(row: start + $0, section: indexPath.section) }
|
||||
self.timelineSegments[indexPath.section - 2].append(contentsOf: newStatuses.map { ($0.id, .unknown) })
|
||||
UIView.performWithoutAnimation {
|
||||
self.tableView.insertRows(at: indexPaths, with: .none)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -236,13 +243,17 @@ class ProfileTableViewController: EnhancedTableViewController {
|
|||
guard case let .success(newStatuses, pagination) = response else { fatalError() }
|
||||
|
||||
self.mastodonController.persistentContainer.addAll(statuses: newStatuses) {
|
||||
self.timelineSegments[0].insert(contentsOf: newStatuses.map { ($0.id, .unknown) }, at: 0)
|
||||
|
||||
if let newer = pagination?.newer {
|
||||
self.newer = newer
|
||||
}
|
||||
|
||||
let indexPaths = (0..<newStatuses.count).map { IndexPath(row: $0, section: 2) }
|
||||
DispatchQueue.main.async {
|
||||
self.timelineSegments[0].insert(contentsOf: newStatuses.map { ($0.id, .unknown) }, at: 0)
|
||||
UIView.performWithoutAnimation {
|
||||
self.tableView.insertRows(at: indexPaths, with: .none)
|
||||
}
|
||||
|
||||
self.refreshControl?.endRefreshing()
|
||||
}
|
||||
}
|
||||
|
@ -262,7 +273,12 @@ class ProfileTableViewController: EnhancedTableViewController {
|
|||
}
|
||||
pinnedStatuses.append((status.id, state))
|
||||
}
|
||||
DispatchQueue.main.async {
|
||||
self.pinnedStatuses = pinnedStatuses
|
||||
UIView.performWithoutAnimation {
|
||||
self.tableView.reloadSections(IndexSet(integer: 1), with: .none)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue