Fix covnerstaion expand/collapse button not working on all statuses

This commit is contained in:
Shadowfacts 2019-11-28 18:58:47 -05:00
parent b47b08fa95
commit 7140590ccf
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
1 changed files with 4 additions and 2 deletions

View File

@ -133,13 +133,15 @@ class ConversationTableViewController: EnhancedTableViewController {
@objc func toggleVisibilityButtonPressed() {
showStatusesAutomatically = !showStatusesAutomatically
for (_, state) in statuses where state.collapsible == true {
state.collapsed = !showStatusesAutomatically
}
for cell in tableView.visibleCells {
guard let cell = cell as? BaseStatusTableViewCell,
cell.collapsible else { continue }
cell.showStatusAutomatically = showStatusesAutomatically
cell.setCollapsed(!showStatusesAutomatically, animated: false)
let indexPath = tableView.indexPath(for: cell)!
statuses[indexPath.row].state.collapsed = !showStatusesAutomatically
}
// recalculate cell heights