mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Merge branch 'performance-in-conversation-search' into bug-fixes-on-1.12.8
This commit is contained in:
commit
9a2046ea81
1 changed files with 6 additions and 2 deletions
|
@ -32,6 +32,8 @@ public class ConversationSearchController : NSObject {
|
|||
|
||||
@objc
|
||||
public let resultsBar: SearchResultsBar = SearchResultsBar()
|
||||
|
||||
private var lastSearchText: String?
|
||||
|
||||
// MARK: Initializer
|
||||
|
||||
|
@ -88,8 +90,10 @@ extension ConversationSearchController : UISearchResultsUpdating {
|
|||
return
|
||||
}
|
||||
let searchText = FullTextSearchFinder.normalize(text: rawSearchText)
|
||||
lastSearchText = searchText
|
||||
|
||||
guard searchText.count >= ConversationSearchController.kMinimumSearchTextLength else {
|
||||
lastSearchText = nil
|
||||
self.resultsBar.updateResults(resultSet: nil)
|
||||
self.delegate?.conversationSearchController(self, didUpdateSearchResults: nil)
|
||||
return
|
||||
|
@ -102,7 +106,7 @@ extension ConversationSearchController : UISearchResultsUpdating {
|
|||
}
|
||||
resultSet = self.dbSearcher.searchWithinConversation(thread: self.thread, searchText: searchText, transaction: transaction)
|
||||
}, completionBlock: { [weak self] in
|
||||
guard let self = self else {
|
||||
guard let self = self, searchText == self.lastSearchText else {
|
||||
return
|
||||
}
|
||||
self.resultsBar.updateResults(resultSet: resultSet)
|
||||
|
@ -121,7 +125,7 @@ extension ConversationSearchController : SearchResultsBarDelegate {
|
|||
return
|
||||
}
|
||||
|
||||
BenchEventStart(title: "Conversation Search Nav", eventId: "Conversation Search Nav: \(searchResult.messageId)")
|
||||
// BenchEventStart(title: "Conversation Search Nav", eventId: "Conversation Search Nav: \(searchResult.messageId)")
|
||||
self.delegate?.conversationSearchController(self, didSelectMessageId: searchResult.messageId)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue