Use visibility bar button item selection state instead of changing icon

This commit is contained in:
Shadowfacts 2021-06-08 14:55:47 -04:00
parent 1a5b958b1a
commit 91f1a5195c
1 changed files with 9 additions and 0 deletions

View File

@ -304,7 +304,16 @@ class ConversationTableViewController: EnhancedTableViewController {
} }
@objc func toggleVisibilityButtonPressed() { @objc func toggleVisibilityButtonPressed() {
#if SDK_IOS_15
if #available(iOS 15.0, *) {
visibilityBarButtonItem.isSelected = !visibilityBarButtonItem.isSelected
showStatusesAutomatically = visibilityBarButtonItem.isSelected
} else {
showStatusesAutomatically = !showStatusesAutomatically
}
#else
showStatusesAutomatically = !showStatusesAutomatically showStatusesAutomatically = !showStatusesAutomatically
#endif
let snapshot = dataSource.snapshot() let snapshot = dataSource.snapshot()
for case let .status(id: _, state: state) in snapshot.itemIdentifiers where state.collapsible == true { for case let .status(id: _, state: state) in snapshot.itemIdentifiers where state.collapsible == true {