Ver código fonte

no delete/pin/archive swipe for messasge results

even though message results have a chatId,
delete is ambiguous as ppl may think,
a single message gets deleted, not a whole chat;
better leave out this option therefore.

for pin/archive, this is discussion-worthy and not that clear,
however, for now, leave out these options as well
to be in sync with desktop and android here.
B. Petersen 2 anos atrás
pai
commit
deb94497b2

+ 1 - 1
deltachat-ios/Controller/ChatListController.swift

@@ -503,7 +503,7 @@ class ChatListController: UITableViewController {
             return []
         }
 
-        if chatId==DC_CHAT_ID_ARCHIVED_LINK {
+        if chatId==DC_CHAT_ID_ARCHIVED_LINK || viewModel.isMessageSearchResult(indexPath: indexPath) {
             return []
             // returning nil may result in a default delete action,
             // see https://forums.developer.apple.com/thread/115030

+ 12 - 0
deltachat-ios/ViewModel/ChatListViewModel.swift

@@ -160,6 +160,18 @@ class ChatListViewModel: NSObject {
         }
     }
 
+    func isMessageSearchResult(indexPath: IndexPath) -> Bool {
+        if searchActive {
+            switch searchResultSections[indexPath.section] {
+            case .messages:
+                return true
+            case .contacts, .chats:
+                return false
+            }
+        }
+        return false
+    }
+
     func chatIdsFor(indexPaths: [IndexPath]?) -> [Int] {
         guard let indexPaths = indexPaths else { return [] }
         var chatIds: [Int] = []