Add 'Archive' token in search bar when searching in archive

This commit is contained in:
Ilya Laktyushin
2021-12-10 17:35:52 +04:00
parent 6630833866
commit 54cd578656
10 changed files with 154 additions and 13 deletions

View File

@@ -70,15 +70,18 @@ public final class SearchDisplayController {
self.contentNode.dismissInput = { [weak self] in
self?.searchBar.deactivate(clear: false)
}
var isFirstTime = true
self.contentNode.setQuery = { [weak self] prefix, tokens, query in
if let strongSelf = self {
strongSelf.searchBar.prefixString = prefix
let previousTokens = strongSelf.searchBar.tokens
strongSelf.searchBar.tokens = tokens
strongSelf.searchBar.text = query
if previousTokens.count < tokens.count {
if previousTokens.count < tokens.count && !isFirstTime {
strongSelf.searchBar.selectLastToken()
}
isFirstTime = false
}
}
if let placeholder = placeholder {