Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions Clip/History/HistoryViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,38 @@ extension HistoryViewController
{
self.showMenu(at: indexPath)
}

override func tableView(_ tableView: UITableView, leadingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration?
{
let copyAction = UIContextualAction(style: .normal, title: "Copy") { (action, view, cb) in
let item = self.dataSource.item(at: indexPath)
self.selectedItem = item
self.copy(action)
cb(true)
}
copyAction.backgroundColor = .systemBlue
return UISwipeActionsConfiguration(actions: [
copyAction,
UIContextualAction(style: .normal, title: "Share…") { (action, view, cb) in
let item = self.dataSource.item(at: indexPath)
self.selectedItem = item
self._share(action)
cb(true)
}
])
}

override func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration?
{
UISwipeActionsConfiguration(actions: [
UIContextualAction(style: .destructive, title: "Delete") { (action, view, cb) in
let item = self.dataSource.item(at: indexPath)
self.selectedItem = item
self.delete(action)
cb(true)
}
])
}
}

extension HistoryViewController: UIPopoverPresentationControllerDelegate
Expand Down