Fix menu state getting out of sync with bookmarked/muted state

This commit is contained in:
Shadowfacts 2020-06-27 13:13:04 -04:00
parent 8bbc572fa7
commit 40a742139b
1 changed files with 9 additions and 5 deletions

View File

@ -87,6 +87,10 @@ class BaseStatusTableViewCell: UITableViewCell {
accessibilityElements = [displayNameLabel!, contentWarningLabel!, collapseButton!, contentTextView!, attachmentsView!]
attachmentsView.isAccessibilityElement = true
if #available(iOS 14.0, *) {
moreButton.showsMenuAsPrimaryAction = true
}
NotificationCenter.default.addObserver(self, selector: #selector(preferencesChanged), name: .preferencesChanged, object: nil)
}
@ -178,11 +182,6 @@ class BaseStatusTableViewCell: UITableViewCell {
collapsible = state.collapsible!
setCollapsed(state.collapsed!, animated: false)
}
if #available(iOS 14.0, *) {
moreButton.showsMenuAsPrimaryAction = true
moreButton.menu = UIMenu(title: "", image: nil, identifier: nil, options: [], children: actionsForStatus(statusID: statusID, sourceView: moreButton))
}
}
func updateStatusState(status: StatusMO) {
@ -199,6 +198,11 @@ class BaseStatusTableViewCell: UITableViewCell {
} else {
reblogButton.accessibilityLabel = NSLocalizedString("Reblog", comment: "reblog button accessibility label")
}
if #available(iOS 14.0, *) {
// keep menu in sync with changed states e.g. bookmarked, muted
moreButton.menu = UIMenu(title: "", image: nil, identifier: nil, options: [], children: actionsForStatus(statusID: statusID, sourceView: moreButton))
}
}
func updateUI(account: AccountMO) {