Browse Source

Merge pull request #562 from deltachat/contactSearchBugfix

Bugfix for contact list search sync issue
cyBerta 5 years ago
parent
commit
923df85cf9
1 changed files with 8 additions and 2 deletions
  1. 8 2
      deltachat-ios/Controller/NewChatViewController.swift

+ 8 - 2
deltachat-ios/Controller/NewChatViewController.swift

@@ -39,7 +39,7 @@ class NewChatViewController: UITableViewController {
 
     // searchBar active?
     func isFiltering() -> Bool {
-        return searchController.isActive && !searchBarIsEmpty()
+        return !searchBarIsEmpty()
     }
 
     // weak var chatDisplayer: ChatDisplayer?
@@ -300,11 +300,17 @@ class NewChatViewController: UITableViewController {
             self.coordinator?.showNewChat(contactId: contactId)
         }))
         alert.addAction(UIAlertAction(title: String.localized("cancel"), style: .cancel, handler: { _ in
-            self.dismiss(animated: true, completion: nil)
+            self.reactivateSearchBarIfNeeded()
         }))
         present(alert, animated: true, completion: nil)
     }
 
+    private func reactivateSearchBarIfNeeded() {
+        if !searchBarIsEmpty() {
+            searchController.isActive = true
+        }
+    }
+
     private func showChatAt(row: Int) {
         if searchController.isActive {
             // edge case: when searchController is active but searchBar is empty -> filteredContacts is empty, so we fallback to contactIds