Utilize default settings values
This commit is contained in:
parent
f9c19b3ca4
commit
c2cd6481fd
6 changed files with 13 additions and 15 deletions
|
|
@ -22,7 +22,7 @@ public extension DefaultsKeys {
|
|||
static let gitURL = DefaultsKey<URL?>("gitURL")
|
||||
static let gitAuthenticationMethod = DefaultsKey<String?>("gitAuthenticationMethod")
|
||||
static let gitUsername = DefaultsKey<String?>("gitUsername")
|
||||
static let gitBranchName = DefaultsKey<String?>("gitBranchName")
|
||||
static let gitBranchName = DefaultsKey<String>("gitBranchName", defaultValue: "master")
|
||||
static let gitSSHPrivateKeyURL = DefaultsKey<URL?>("gitSSHPrivateKeyURL")
|
||||
static let gitSSHKeySource = DefaultsKey<String?>("gitSSHKeySource")
|
||||
static let gitSSHPrivateKeyArmor = DefaultsKey<String?>("gitSSHPrivateKeyArmor")
|
||||
|
|
@ -40,7 +40,7 @@ public extension DefaultsKeys {
|
|||
static let isRememberGitCredentialPassphraseOn = DefaultsKey<Bool>("isRememberGitCredentialPassphraseOn", defaultValue: false)
|
||||
static let isShowFolderOn = DefaultsKey<Bool>("isShowFolderOn", defaultValue: true)
|
||||
static let isHidePasswordImagesOn = DefaultsKey<Bool>("isHidePasswordImagesOn", defaultValue: false)
|
||||
static let isSearchDefaultAll = DefaultsKey<Bool>("isSearchDefaultAll", defaultValue: true)
|
||||
static let searchDefault = DefaultsKey<SearchBarScope>("searchDefault", defaultValue: .all)
|
||||
static let passwordGeneratorFlavor = DefaultsKey<String>("passwordGeneratorFlavor", defaultValue: "Apple")
|
||||
|
||||
static let encryptInArmored = DefaultsKey<Bool>("encryptInArmored", defaultValue: false)
|
||||
|
|
|
|||
23
passKit/Helpers/SearchBarScope.swift
Normal file
23
passKit/Helpers/SearchBarScope.swift
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
//
|
||||
// SearchBarScope.swift
|
||||
// pass
|
||||
//
|
||||
// Created by Danny Moesch on 05.03.19.
|
||||
// Copyright © 2019 Bob Sun. All rights reserved.
|
||||
//
|
||||
|
||||
import SwiftyUserDefaults
|
||||
|
||||
public enum SearchBarScope: Int, CaseIterable, DefaultsSerializable {
|
||||
case current
|
||||
case all
|
||||
|
||||
public var localizedName: String {
|
||||
switch self {
|
||||
case .current:
|
||||
return "Current".localize()
|
||||
case .all:
|
||||
return "All".localize()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -582,7 +582,7 @@ public class PasswordStore {
|
|||
do {
|
||||
let credentialProvider = try credential.credentialProvider(requestGitPassword: requestGitPassword)
|
||||
let options = [GTRepositoryRemoteOptionsCredentialProvider: credentialProvider]
|
||||
if let branch = try getLocalBranch(withName: SharedDefaults[.gitBranchName]!) {
|
||||
if let branch = try getLocalBranch(withName: SharedDefaults[.gitBranchName]) {
|
||||
let remote = try GTRemote(name: "origin", in: storeRepository)
|
||||
try storeRepository.push(branch, to: remote, withOptions: options, progress: transferProgressBlock)
|
||||
}
|
||||
|
|
@ -805,7 +805,7 @@ public class PasswordStore {
|
|||
throw AppError.RepositoryNotSet
|
||||
}
|
||||
// get the remote branch
|
||||
let remoteBranchName = SharedDefaults[.gitBranchName]!
|
||||
let remoteBranchName = SharedDefaults[.gitBranchName]
|
||||
guard let remoteBranch = try storeRepository.remoteBranches().first(where: { $0.shortName == remoteBranchName }) else {
|
||||
throw AppError.RepositoryRemoteBranchNotFound(remoteBranchName)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue