Recover search status back from the password detail
This commit is contained in:
parent
5a91db4f76
commit
9ec7073e84
1 changed files with 14 additions and 0 deletions
|
|
@ -32,6 +32,7 @@ class PasswordNavigationViewController: UIViewController {
|
||||||
|
|
||||||
var viewingUnsyncedPasswords = false
|
var viewingUnsyncedPasswords = false
|
||||||
var tapTabBarTime: TimeInterval = 0
|
var tapTabBarTime: TimeInterval = 0
|
||||||
|
var searchText: String?
|
||||||
|
|
||||||
lazy var passwordManager = PasswordManager(viewController: self)
|
lazy var passwordManager = PasswordManager(viewController: self)
|
||||||
|
|
||||||
|
|
@ -109,6 +110,16 @@ class PasswordNavigationViewController: UIViewController {
|
||||||
configureNavigationBar()
|
configureNavigationBar()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override func viewDidAppear(_ animated: Bool) {
|
||||||
|
super.viewDidAppear(animated)
|
||||||
|
if searchText != nil {
|
||||||
|
DispatchQueue.main.async {
|
||||||
|
self.searchBar.text = self.searchText
|
||||||
|
self.searchController.isActive = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private func configureSearchBar() {
|
private func configureSearchBar() {
|
||||||
if Defaults.isShowFolderOn {
|
if Defaults.isShowFolderOn {
|
||||||
searchBar.scopeButtonTitles = SearchBarScope.allCases.map(\.localizedName)
|
searchBar.scopeButtonTitles = SearchBarScope.allCases.map(\.localizedName)
|
||||||
|
|
@ -388,6 +399,7 @@ extension PasswordNavigationViewController {
|
||||||
|
|
||||||
extension PasswordNavigationViewController: UISearchBarDelegate {
|
extension PasswordNavigationViewController: UISearchBarDelegate {
|
||||||
func search(matching text: String) {
|
func search(matching text: String) {
|
||||||
|
searchText = text
|
||||||
dataSource?.showTableEntries(matching: text)
|
dataSource?.showTableEntries(matching: text)
|
||||||
tableView.reloadData()
|
tableView.reloadData()
|
||||||
}
|
}
|
||||||
|
|
@ -414,6 +426,7 @@ extension PasswordNavigationViewController: UISearchBarDelegate {
|
||||||
searchBar.selectedScopeButtonIndex = SearchBarScope.current.rawValue
|
searchBar.selectedScopeButtonIndex = SearchBarScope.current.rawValue
|
||||||
}
|
}
|
||||||
activateSearch(searchBar.selectedScopeButtonIndex)
|
activateSearch(searchBar.selectedScopeButtonIndex)
|
||||||
|
search(matching: searchBar.text ?? "")
|
||||||
}
|
}
|
||||||
|
|
||||||
func searchBar(_: UISearchBar, textDidChange searchText: String) {
|
func searchBar(_: UISearchBar, textDidChange searchText: String) {
|
||||||
|
|
@ -431,6 +444,7 @@ extension PasswordNavigationViewController: UISearchBarDelegate {
|
||||||
func cancelSearch() {
|
func cancelSearch() {
|
||||||
configureTableView(in: parentPasswordEntity)
|
configureTableView(in: parentPasswordEntity)
|
||||||
dataSource?.isSearchActive = false
|
dataSource?.isSearchActive = false
|
||||||
|
searchText = nil
|
||||||
tableView.reloadData()
|
tableView.reloadData()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue