Replace more with share button for timeline status swipe actions

This commit is contained in:
Shadowfacts 2020-06-27 10:47:31 -04:00
parent 2a8e970738
commit 8bbc572fa7
1 changed files with 16 additions and 2 deletions

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])
} }