소스 검색

Merge pull request #398 from deltachat/cleanup-contact-requests

do not show double items for startChat and block
cyBerta 5 년 전
부모
커밋
029d4fe603
1개의 변경된 파일5개의 추가작업 그리고 55개의 파일을 삭제
  1. 5 55
      deltachat-ios/Controller/ChatViewController.swift

+ 5 - 55
deltachat-ios/Controller/ChatViewController.swift

@@ -265,19 +265,10 @@ class ChatViewController: MessagesViewController {
     private func configureMessageMenu() {
         var menuItems: [UIMenuItem]
 
-        if disableWriting {
-            menuItems = [
-                UIMenuItem(title: String.localized("start_chat"), action: #selector(MessageCollectionViewCell.messageStartChat(_:))),
-                UIMenuItem(title: String.localized("delete"), action: #selector(MessageCollectionViewCell.messageDelete(_:))),
-                UIMenuItem(title: String.localized("menu_block_contact"), action: #selector(MessageCollectionViewCell.messageBlock(_:))),
-            ]
-        } else {
-            // Configures the UIMenu which is shown when selecting a message
-            menuItems = [
-                UIMenuItem(title: String.localized("info"), action: #selector(MessageCollectionViewCell.messageInfo(_:))),
-                UIMenuItem(title: String.localized("delete"), action: #selector(MessageCollectionViewCell.messageDelete(_:)))
-            ]
-        }
+        menuItems = [
+            UIMenuItem(title: String.localized("info"), action: #selector(MessageCollectionViewCell.messageInfo(_:))),
+            UIMenuItem(title: String.localized("delete"), action: #selector(MessageCollectionViewCell.messageDelete(_:)))
+        ]
 
         UIMenuController.shared.menuItems = menuItems
     }
@@ -442,9 +433,7 @@ class ChatViewController: MessagesViewController {
 
     override func collectionView(_ collectionView: UICollectionView, canPerformAction action: Selector, forItemAt indexPath: IndexPath, withSender sender: Any?) -> Bool {
         if action == NSSelectorFromString("messageInfo:") ||
-            action == NSSelectorFromString("messageDelete:") ||
-            action == NSSelectorFromString("messageBlock:") ||
-            action == NSSelectorFromString("messageStartChat:") {
+            action == NSSelectorFromString("messageDelete:") {
             return true
         } else {
             return super.collectionView(collectionView, canPerformAction: action, forItemAt: indexPath, withSender: sender)
@@ -465,19 +454,6 @@ class ChatViewController: MessagesViewController {
             let msg = messageList[indexPath.section]
             logger.info("message: delete \(msg.messageId)")
             askToDeleteMessage(id: msg.id)
-        case NSSelectorFromString("messageStartChat:"):
-            let msg = messageList[indexPath.section]
-            logger.info("message: Start Chat \(msg.messageId)")
-            let chat = msg.createChat()
-            // TODO: figure out how to properly show the chat after creation
-            refreshMessages()
-            coordinator?.showChat(chatId: chat.id)
-        case NSSelectorFromString("messageBlock:"):
-            let msg = messageList[indexPath.section]
-            logger.info("message: Block \(msg.messageId)")
-            msg.fromContact.block()
-
-            refreshMessages()
         default:
             super.collectionView(collectionView, performAction: action, forItemAt: indexPath, withSender: sender)
         }
@@ -1138,30 +1114,4 @@ extension MessageCollectionViewCell {
             }
         }
     }
-
-    @objc func messageBlock(_ sender: Any?) {
-        // Get the collectionView
-        if let collectionView = self.superview as? UICollectionView {
-            // Get indexPath
-            if let indexPath = collectionView.indexPath(for: self) {
-                // Trigger action
-                collectionView.delegate?.collectionView?(collectionView,
-                    performAction: #selector(MessageCollectionViewCell.messageBlock(_:)),
-                    forItemAt: indexPath, withSender: sender)
-            }
-        }
-    }
-
-    @objc func messageStartChat(_ sender: Any?) {
-        // Get the collectionView
-        if let collectionView = self.superview as? UICollectionView {
-            // Get indexPath
-            if let indexPath = collectionView.indexPath(for: self) {
-                // Trigger action
-                collectionView.delegate?.collectionView?(collectionView,
-                    performAction: #selector(MessageCollectionViewCell.messageStartChat(_:)),
-                    forItemAt: indexPath, withSender: sender)
-            }
-        }
-    }
 }