forked from shadowfacts/Tusker
Fix custom emojis in display namesnot showing in conversation main
statuses Caused by the cell updating it's UI multiple times in quick succession. As a workaround, prevent the main cell from being reloaded.
This commit is contained in:
parent
2cebb6bd7d
commit
de02c73957
|
@ -19,13 +19,7 @@ class ConversationTableViewController: EnhancedTableViewController {
|
||||||
|
|
||||||
let mainStatusID: String
|
let mainStatusID: String
|
||||||
let mainStatusState: StatusState
|
let mainStatusState: StatusState
|
||||||
var statuses: [(id: String, state: StatusState)] = [] {
|
var statuses: [(id: String, state: StatusState)] = []
|
||||||
didSet {
|
|
||||||
DispatchQueue.main.async {
|
|
||||||
self.tableView.reloadData()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var showStatusesAutomatically = false
|
var showStatusesAutomatically = false
|
||||||
var visibilityBarButtonItem: UIBarButtonItem!
|
var visibilityBarButtonItem: UIBarButtonItem!
|
||||||
|
@ -69,6 +63,12 @@ class ConversationTableViewController: EnhancedTableViewController {
|
||||||
self.statuses = parents.map { ($0.id, .unknown) } + self.statuses + context.descendants.map { ($0.id, .unknown) }
|
self.statuses = parents.map { ($0.id, .unknown) } + self.statuses + context.descendants.map { ($0.id, .unknown) }
|
||||||
let indexPath = IndexPath(row: parents.count, section: 0)
|
let indexPath = IndexPath(row: parents.count, section: 0)
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
|
let ancestorsIndexPaths = (0..<parents.count).map { IndexPath(row: $0, section: 0) }
|
||||||
|
let descendantsIndexPaths = ((parents.count + 1)..<(self.statuses.count)).map { IndexPath(row: $0, section: 0) }
|
||||||
|
// despite its name, UITableView.RowAnimation.none actually uses the automatic animation, so we force-disable it
|
||||||
|
UIView.performWithoutAnimation {
|
||||||
|
self.tableView.insertRows(at: ancestorsIndexPaths + descendantsIndexPaths, with: .none)
|
||||||
|
}
|
||||||
self.tableView.scrollToRow(at: indexPath, at: .middle, animated: false)
|
self.tableView.scrollToRow(at: indexPath, at: .middle, animated: false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue