Merge pull request #2071 from stuartbreckenridge/issue-2018

Key commands work with action sheets
This commit is contained in:
Maurice Parker
2020-05-14 07:14:57 -05:00
committed by GitHub

View File

@@ -117,12 +117,20 @@ class MasterTimelineViewController: UITableViewController, UndoableCommandRunner
@IBAction func markAllAsRead(_ sender: Any) {
let title = NSLocalizedString("Mark All as Read", comment: "Mark All as Read")
guard let barButtonItem = sender as? UIBarButtonItem else {
return
if let source = sender as? UIBarButtonItem {
MarkAsReadAlertController.confirm(self, coordinator: coordinator, confirmTitle: title, sourceType: source) { [weak self] in
self?.coordinator.markAllAsReadInTimeline()
}
}
MarkAsReadAlertController.confirm(self, coordinator: coordinator, confirmTitle: title, sourceType: barButtonItem) { [weak self] in
self?.coordinator.markAllAsReadInTimeline()
if let _ = sender as? UIKeyCommand {
guard let indexPath = tableView.indexPathForSelectedRow, let contentView = tableView.cellForRow(at: indexPath)?.contentView else {
return
}
MarkAsReadAlertController.confirm(self, coordinator: coordinator, confirmTitle: title, sourceType: contentView) { [weak self] in
self?.coordinator.markAllAsReadInTimeline()
}
}
}