diff --git a/Framework/Dotzu/Dotzu/ManagerListLogViewController.swift b/Framework/Dotzu/Dotzu/ManagerListLogViewController.swift index 514e047..c3ab553 100644 --- a/Framework/Dotzu/Dotzu/ManagerListLogViewController.swift +++ b/Framework/Dotzu/Dotzu/ManagerListLogViewController.swift @@ -21,7 +21,7 @@ class ManagerListLogViewController: UIViewController { } } - private let dataSourceLogs = ListLogDataSource() + fileprivate let dataSourceLogs = ListLogDataSource() fileprivate let dataSourceNetwork = ListLogDataSource() private var firstLaunch = true @@ -250,3 +250,19 @@ extension ManagerListLogViewController: MFMailComposeViewControllerDelegate { controller.dismiss(animated: true, completion: nil) } } + +extension ManagerListLogViewController { + func tableView(_ tableView: UITableView, shouldShowMenuForRowAt indexPath: IndexPath) -> Bool { + return state == .logs + } + + func tableView(_ tableView: UITableView, canPerformAction action: Selector, forRowAt indexPath: IndexPath, withSender sender: Any?) -> Bool { + return action == #selector(copy(_:)) + } + + func tableView(_ tableView: UITableView, performAction action: Selector, forRowAt indexPath: IndexPath, withSender sender: Any?) { + guard let log = dataSourceLogs[indexPath.row] else {return} + let format = LoggerFormat.format(log: log) + UIPasteboard.general.string = format.attr.string + } +}