Remember the last search choice between search current/all (issue #198)
This commit is contained in:
parent
5b9ffe9b7e
commit
29b8313be5
2 changed files with 18 additions and 1 deletions
|
|
@ -577,13 +577,29 @@ class PasswordsViewController: UIViewController, UITableViewDataSource, UITableV
|
||||||
backAction(self)
|
backAction(self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func searchBar(_ searchBar: UISearchBar, selectedScopeButtonIndexDidChange selectedScope: Int) {
|
func searchBar(_ searchBar: UISearchBar, selectedScopeButtonIndexDidChange selectedScope: Int) {
|
||||||
|
// update the default search scope
|
||||||
|
SharedDefaults[.isSearchDefaultAll] = searchController.searchBar.scopeButtonTitles![selectedScope] == "All"
|
||||||
updateSearchResults(for: searchController)
|
updateSearchResults(for: searchController)
|
||||||
}
|
}
|
||||||
|
|
||||||
func searchBarCancelButtonClicked(_ searchBar: UISearchBar) {
|
|
||||||
|
func searchBarShouldBeginEditing(_ searchBar: UISearchBar) -> Bool {
|
||||||
|
// set the default search scope to "all"
|
||||||
|
if SharedDefaults[.isShowFolderOn] && SharedDefaults[.isSearchDefaultAll] {
|
||||||
|
searchController.searchBar.selectedScopeButtonIndex = searchController.searchBar.scopeButtonTitles?.index(of: "All") ?? 0
|
||||||
|
} else {
|
||||||
|
searchController.searchBar.selectedScopeButtonIndex = 0
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func searchBarShouldEndEditing(_ searchBar: UISearchBar) -> Bool {
|
||||||
|
// set the default search scope to "current"
|
||||||
searchController.searchBar.selectedScopeButtonIndex = 0
|
searchController.searchBar.selectedScopeButtonIndex = 0
|
||||||
updateSearchResults(for: searchController)
|
updateSearchResults(for: searchController)
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
private func requestGitPassword(credential: GitCredential.Credential, lastPassword: String?) -> String? {
|
private func requestGitPassword(credential: GitCredential.Credential, lastPassword: String?) -> String? {
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@ public extension DefaultsKeys {
|
||||||
static let isRememberPGPPassphraseOn = DefaultsKey<Bool>("isRememberPGPPassphraseOn")
|
static let isRememberPGPPassphraseOn = DefaultsKey<Bool>("isRememberPGPPassphraseOn")
|
||||||
static let isRememberGitCredentialPassphraseOn = DefaultsKey<Bool>("isRememberGitCredentialPassphraseOn")
|
static let isRememberGitCredentialPassphraseOn = DefaultsKey<Bool>("isRememberGitCredentialPassphraseOn")
|
||||||
static let isShowFolderOn = DefaultsKey<Bool>("isShowFolderOn")
|
static let isShowFolderOn = DefaultsKey<Bool>("isShowFolderOn")
|
||||||
|
static let isSearchDefaultAll = DefaultsKey<Bool>("isSearchDefaultAll")
|
||||||
static let passwordGeneratorFlavor = DefaultsKey<String>("passwordGeneratorFlavor")
|
static let passwordGeneratorFlavor = DefaultsKey<String>("passwordGeneratorFlavor")
|
||||||
|
|
||||||
static let encryptInArmored = DefaultsKey<Bool>("encryptInArmored")
|
static let encryptInArmored = DefaultsKey<Bool>("encryptInArmored")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue