Эх сурвалжийг харах

when search active - no swipe actions on cells

nayooti 5 жил өмнө
parent
commit
2d00f7c3b3

+ 6 - 0
deltachat-ios/Controller/ChatListController.swift

@@ -225,9 +225,15 @@ extension ChatListController: UITableViewDataSource, UITableViewDelegate {
     }
 
     func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? {
+        if viewModel.searchActive {
+            // no actions when search active
+            return []
+        }
+
         guard let chatId = viewModel.chatIdFor(indexPath: indexPath) else {
             return []
         }
+
         if chatId==DC_CHAT_ID_ARCHIVED_LINK || chatId==DC_CHAT_ID_DEADDROP {
             return []
             // returning nil may result in a default delete action,

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

@@ -1,6 +1,7 @@
 import UIKit
 
 protocol ChatListViewModelProtocol: class, UISearchResultsUpdating {
+    var searchActive: Bool { get }
     var numberOfSections: Int { get }
     var onChatListUpdate: VoidFunction? { get set }
     var showArchive: Bool { get }