|
@@ -141,12 +141,7 @@ class ChatViewControllerNew: UITableViewController {
|
|
|
object: nil)
|
|
|
notificationCenter.addObserver(self, selector: #selector(keyboardWillShow(_:)), name: UIResponder.keyboardWillShowNotification, object: nil)
|
|
|
notificationCenter.addObserver(self, selector: #selector(keyboardWillHide(_:)), name: UIResponder.keyboardWillHideNotification, object: nil)
|
|
|
- UIMenuController.shared.menuItems = [
|
|
|
- UIMenuItem(title: String.localized("info"), action: #selector(BaseMessageCell.messageInfo)),
|
|
|
- UIMenuItem(title: String.localized("delete"), action: #selector(BaseMessageCell.messageDelete)),
|
|
|
- UIMenuItem(title: String.localized("forward"), action: #selector(BaseMessageCell.messageForward))
|
|
|
- ]
|
|
|
- UIMenuController.shared.update()
|
|
|
+ prepareContextMenu()
|
|
|
}
|
|
|
|
|
|
@objc func keyboardWillShow(_ notification: Notification) {
|
|
@@ -908,10 +903,24 @@ class ChatViewControllerNew: UITableViewController {
|
|
|
}
|
|
|
|
|
|
// MARK: - Context menu
|
|
|
+ private func prepareContextMenu() {
|
|
|
+ UIMenuController.shared.menuItems = [
|
|
|
+ UIMenuItem(title: String.localized("info"), action: #selector(BaseMessageCell.messageInfo)),
|
|
|
+ UIMenuItem(title: String.localized("delete"), action: #selector(BaseMessageCell.messageDelete)),
|
|
|
+ UIMenuItem(title: String.localized("forward"), action: #selector(BaseMessageCell.messageForward))
|
|
|
+ ]
|
|
|
+ UIMenuController.shared.update()
|
|
|
+ NotificationCenter.default.addObserver(self, selector: #selector(ChatViewControllerNew.menuWillShow),
|
|
|
+ name: UIMenuController.willShowMenuNotification, object: nil)
|
|
|
+ }
|
|
|
+
|
|
|
override func tableView(_ tableView: UITableView, shouldShowMenuForRowAt indexPath: IndexPath) -> Bool {
|
|
|
return true
|
|
|
}
|
|
|
|
|
|
+ @objc func menuWillShow(notification: NSNotification) {
|
|
|
+ }
|
|
|
+
|
|
|
override func tableView(_ tableView: UITableView, canPerformAction action: Selector, forRowAt indexPath: IndexPath, withSender sender: Any?) -> Bool {
|
|
|
return action == #selector(UIResponderStandardEditActions.copy(_:))
|
|
|
|| action == #selector(BaseMessageCell.messageInfo)
|