Utilize default settings values
This commit is contained in:
parent
f9c19b3ca4
commit
c2cd6481fd
6 changed files with 13 additions and 15 deletions
|
|
@ -34,10 +34,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
|||
self.perform(#selector(postSearchNotification), with: nil, afterDelay: 0.4)
|
||||
}
|
||||
}
|
||||
|
||||
// Assign default values to global settings.
|
||||
SharedDefaults.register(defaults: [DefaultsKeys.gitBranchName._key: "master"])
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -585,14 +585,14 @@ class PasswordsViewController: UIViewController, UITableViewDataSource, UITableV
|
|||
|
||||
func searchBar(_ searchBar: UISearchBar, selectedScopeButtonIndexDidChange selectedScope: Int) {
|
||||
// update the default search scope
|
||||
SharedDefaults[.isSearchDefaultAll] = SearchBarScope(rawValue: selectedScope) == .all
|
||||
SharedDefaults[.searchDefault] = SearchBarScope(rawValue: selectedScope) ?? .all
|
||||
updateSearchResults(for: searchController)
|
||||
}
|
||||
|
||||
|
||||
func searchBarShouldBeginEditing(_ searchBar: UISearchBar) -> Bool {
|
||||
// set the default search scope to "all"
|
||||
if SharedDefaults[.isShowFolderOn] && SharedDefaults[.isSearchDefaultAll] {
|
||||
if SharedDefaults[.isShowFolderOn] && SharedDefaults[.searchDefault] == .all {
|
||||
searchController.searchBar.selectedScopeButtonIndex = SearchBarScope.all.rawValue
|
||||
} else {
|
||||
searchController.searchBar.selectedScopeButtonIndex = SearchBarScope.current.rawValue
|
||||
|
|
|
|||
|
|
@ -1,21 +0,0 @@
|
|||
//
|
||||
// SearchBarScope.swift
|
||||
// pass
|
||||
//
|
||||
// Created by Danny Moesch on 05.03.19.
|
||||
// Copyright © 2019 Bob Sun. All rights reserved.
|
||||
//
|
||||
|
||||
enum SearchBarScope: Int, CaseIterable {
|
||||
case current
|
||||
case all
|
||||
|
||||
var localizedName: String {
|
||||
switch self {
|
||||
case .current:
|
||||
return "Current".localize()
|
||||
case .all:
|
||||
return "All".localize()
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue