Compare commits

...

2 Commits

2 changed files with 25 additions and 7 deletions

View File

@ -87,6 +87,10 @@ class BaseStatusTableViewCell: UITableViewCell {
accessibilityElements = [displayNameLabel!, contentWarningLabel!, collapseButton!, contentTextView!, attachmentsView!] accessibilityElements = [displayNameLabel!, contentWarningLabel!, collapseButton!, contentTextView!, attachmentsView!]
attachmentsView.isAccessibilityElement = true attachmentsView.isAccessibilityElement = true
if #available(iOS 14.0, *) {
moreButton.showsMenuAsPrimaryAction = true
}
NotificationCenter.default.addObserver(self, selector: #selector(preferencesChanged), name: .preferencesChanged, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(preferencesChanged), name: .preferencesChanged, object: nil)
} }
@ -178,11 +182,6 @@ class BaseStatusTableViewCell: UITableViewCell {
collapsible = state.collapsible! collapsible = state.collapsible!
setCollapsed(state.collapsed!, animated: false) 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) { func updateStatusState(status: StatusMO) {
@ -199,6 +198,11 @@ class BaseStatusTableViewCell: UITableViewCell {
} else { } else {
reblogButton.accessibilityLabel = NSLocalizedString("Reblog", comment: "reblog button accessibility label") 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) { func updateUI(account: AccountMO) {

View File

@ -257,11 +257,25 @@ extension TimelineStatusTableViewCell: TableViewSwipeActionProvider {
} }
reply.image = UIImage(systemName: "arrowshape.turn.up.left.fill") reply.image = UIImage(systemName: "arrowshape.turn.up.left.fill")
reply.backgroundColor = tintColor reply.backgroundColor = tintColor
let more = UIContextualAction(style: .normal, title: "More") { (action, view, completion) in
let moreTitle: String
let moreImage: UIImage
// on iOS 14+, more actions are in the context menu so display this as 'Share'
if #available(iOS 14.0, *) {
moreTitle = "Share"
// Bold to more closely match the other action symbols
let config = UIImage.SymbolConfiguration(weight: .bold)
moreImage = UIImage(systemName: "square.and.arrow.up")!.applyingSymbolConfiguration(config)!
} else {
moreTitle = "More"
moreImage = UIImage(systemName: "ellipsis.circle.fill")!
}
let more = UIContextualAction(style: .normal, title: moreTitle) { (action, view, completion) in
completion(true) completion(true)
self.delegate?.showMoreOptions(forStatus: self.statusID, sourceView: self) self.delegate?.showMoreOptions(forStatus: self.statusID, sourceView: self)
} }
more.image = UIImage(systemName: "ellipsis.circle.fill") more.image = moreImage
more.backgroundColor = .lightGray more.backgroundColor = .lightGray
return UISwipeActionsConfiguration(actions: [reply, more]) return UISwipeActionsConfiguration(actions: [reply, more])
} }