From 1051241672f94eafd422a2a6e95acd3b142ccb93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20B=C3=B6ttcher?= Date: Thu, 27 Jan 2022 21:54:15 +0100 Subject: [PATCH 1/2] corrected broken display of updated search results --- .../ConversationSearchViewController.swift | 27 ++----------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/Signal/src/ViewControllers/HomeView/ConversationSearchViewController.swift b/Signal/src/ViewControllers/HomeView/ConversationSearchViewController.swift index 464e885d4b..d3d8a8c480 100644 --- a/Signal/src/ViewControllers/HomeView/ConversationSearchViewController.swift +++ b/Signal/src/ViewControllers/HomeView/ConversationSearchViewController.swift @@ -563,17 +563,9 @@ public class ConversationSearchViewController: UITableViewController, ThreadSwip // Discard results from stale search. return } + self.searchResultSet = results - if let candidates = updateCellCandidates { - for cell in candidates { - if let (section, row) = self.getIndexPathFor(threadId: cell.thread?.uniqueId), let configuration = self.cellConfiguration(searchSection: section, row: row) { - cell.reset() - cell.configure(cellContentToken: self.cellContentToken(forConfiguration: configuration, useCache: false)) - } - } - } else { - self.reloadTableData() - } + self.reloadTableData() }) } @@ -590,21 +582,6 @@ public class ConversationSearchViewController: UITableViewController, ThreadSwip return nil } - private func getIndexPathFor(threadId: String?) -> (SearchSection, Int)? { - if let threadId = threadId { - if let row = searchResultSet.contactThreads.map({$0.thread.threadRecord.uniqueId}).firstIndex(of: threadId) { - return (SearchSection.contactThreads, row) - } - if let row = searchResultSet.groupThreads.map({$0.thread.threadRecord.uniqueId}).firstIndex(of: threadId) { - return (SearchSection.groupThreads, row) - } - if let row = searchResultSet.messages.map({$0.thread.threadRecord.uniqueId}).firstIndex(of: threadId) { - return (SearchSection.messages, row) - } - } - return nil - } - private func isBlocked(thread: ThreadViewModel) -> Bool { owsAssertDebug(thread.homeViewInfo != nil) From 42e3b2eb99eadf5ede98d52085ab27349e91bdff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20B=C3=B6ttcher?= Date: Thu, 27 Jan 2022 19:56:01 +0100 Subject: [PATCH 2/2] entering multi select mode if row actions or search results are shown, hides the actions and the disables the search --- .../HomeView/HomeViewController+Multiselect.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Signal/src/ViewControllers/HomeView/HomeViewController+Multiselect.swift b/Signal/src/ViewControllers/HomeView/HomeViewController+Multiselect.swift index 5a42b167c3..bc26f1d992 100644 --- a/Signal/src/ViewControllers/HomeView/HomeViewController+Multiselect.swift +++ b/Signal/src/ViewControllers/HomeView/HomeViewController+Multiselect.swift @@ -24,6 +24,8 @@ extension HomeViewController { return } + // multi selection does not work well with displaying search results, so let's clear the search for now + searchBar.delegate?.searchBarCancelButtonClicked?(searchBar) viewState.multiSelectState.title = title if homeViewMode == .inbox { let doneButton = UIBarButtonItem(title: CommonStrings.cancelButton, style: .plain, target: self, action: #selector(done), accessibilityIdentifier: CommonStrings.cancelButton) @@ -492,6 +494,10 @@ public class MultiSelectState: NSObject { AssertIsOnMainThread() _isActive = active + // turn off current edit mode if necessary (removes leading and trailing actions) + if let tableView = tableView, active && tableView.isEditing { + tableView.setEditing(false, animated: true) + } if active || !actionPerformed { tableView?.setEditing(active, animated: true) } else if let tableView = tableView {