Use SwiftFormat version 0.47.x
This commit is contained in:
parent
e8389eb262
commit
49c6b25611
18 changed files with 69 additions and 49 deletions
20
.swiftformat
20
.swiftformat
|
|
@ -22,6 +22,8 @@
|
||||||
duplicateImports, \
|
duplicateImports, \
|
||||||
elseOnSameLine, \
|
elseOnSameLine, \
|
||||||
emptyBraces, \
|
emptyBraces, \
|
||||||
|
enumNamespaces, \
|
||||||
|
extensionAccessControl, \
|
||||||
fileHeader, \
|
fileHeader, \
|
||||||
hoistPatternLet, \
|
hoistPatternLet, \
|
||||||
indent, \
|
indent, \
|
||||||
|
|
@ -31,6 +33,7 @@
|
||||||
linebreakAtEndOfFile, \
|
linebreakAtEndOfFile, \
|
||||||
linebreaks, \
|
linebreaks, \
|
||||||
modifierOrder, \
|
modifierOrder, \
|
||||||
|
# markTypes, \
|
||||||
numberFormatting, \
|
numberFormatting, \
|
||||||
# organizeDeclarations, \
|
# organizeDeclarations, \
|
||||||
preferKeyPath, \
|
preferKeyPath, \
|
||||||
|
|
@ -53,6 +56,7 @@
|
||||||
redundantVoidReturnType, \
|
redundantVoidReturnType, \
|
||||||
semicolons, \
|
semicolons, \
|
||||||
sortedImports, \
|
sortedImports, \
|
||||||
|
sortedSwitchCases, \
|
||||||
spaceAroundBraces, \
|
spaceAroundBraces, \
|
||||||
spaceAroundBrackets, \
|
spaceAroundBrackets, \
|
||||||
spaceAroundComments, \
|
spaceAroundComments, \
|
||||||
|
|
@ -88,6 +92,10 @@
|
||||||
|
|
||||||
--allman false
|
--allman false
|
||||||
|
|
||||||
|
### Color/image literal width. "actual-width" or "visual-width"
|
||||||
|
|
||||||
|
--assetliterals visual-width
|
||||||
|
|
||||||
### Binary grouping,threshold (default: 4,8) or "none", "ignore"
|
### Binary grouping,threshold (default: 4,8) or "none", "ignore"
|
||||||
|
|
||||||
--binarygrouping 4,8
|
--binarygrouping 4,8
|
||||||
|
|
@ -116,6 +124,10 @@
|
||||||
|
|
||||||
--exponentgrouping disabled
|
--exponentgrouping disabled
|
||||||
|
|
||||||
|
### Place ACL "on-extension" (default) or "on-declarations"
|
||||||
|
|
||||||
|
--extensionacl on-extension
|
||||||
|
|
||||||
### Group digits after '.': "enabled" or "disabled" (default)
|
### Group digits after '.': "enabled" or "disabled" (default)
|
||||||
|
|
||||||
--fractiongrouping disabled
|
--fractiongrouping disabled
|
||||||
|
|
@ -244,10 +256,18 @@
|
||||||
|
|
||||||
--wrapcollections preserve
|
--wrapcollections preserve
|
||||||
|
|
||||||
|
### Wrap conditions: "before-first", "after-first", "preserve"
|
||||||
|
|
||||||
|
--wrapconditions preserve
|
||||||
|
|
||||||
### Wrap func params: "before-first", "after-first", "preserve"
|
### Wrap func params: "before-first", "after-first", "preserve"
|
||||||
|
|
||||||
--wrapparameters preserve
|
--wrapparameters preserve
|
||||||
|
|
||||||
|
### Wrap return type: "if-multiline", "preserve" (default)
|
||||||
|
|
||||||
|
--wrapreturntype preserve
|
||||||
|
|
||||||
### Xcode indent guard/enum: "enabled" or "disabled" (default)
|
### Xcode indent guard/enum: "enabled" or "disabled" (default)
|
||||||
|
|
||||||
--xcodeindentation disabled
|
--xcodeindentation disabled
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ class AdvancedSettingsTableViewController: UITableViewController {
|
||||||
private func saveGitConfigSetting(segue: UIStoryboardSegue) {
|
private func saveGitConfigSetting(segue: UIStoryboardSegue) {
|
||||||
if let controller = segue.source as? GitConfigSettingsTableViewController {
|
if let controller = segue.source as? GitConfigSettingsTableViewController {
|
||||||
if let gitSignatureName = controller.nameTextField.text,
|
if let gitSignatureName = controller.nameTextField.text,
|
||||||
let gitSignatureEmail = controller.emailTextField.text {
|
let gitSignatureEmail = controller.emailTextField.text {
|
||||||
Defaults.gitSignatureName = gitSignatureName.isEmpty ? nil : gitSignatureName
|
Defaults.gitSignatureName = gitSignatureName.isEmpty ? nil : gitSignatureName
|
||||||
Defaults.gitSignatureEmail = gitSignatureEmail.isEmpty ? nil : gitSignatureEmail
|
Defaults.gitSignatureEmail = gitSignatureEmail.isEmpty ? nil : gitSignatureEmail
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,9 +25,9 @@ class PGPKeyUrlImportTableViewController: AutoCellHeightUITableViewController {
|
||||||
@IBAction
|
@IBAction
|
||||||
private func save(_: Any) {
|
private func save(_: Any) {
|
||||||
guard let publicKeyURLText = pgpPublicKeyURLTextField.text,
|
guard let publicKeyURLText = pgpPublicKeyURLTextField.text,
|
||||||
let publicKeyURL = URL(string: publicKeyURLText),
|
let publicKeyURL = URL(string: publicKeyURLText),
|
||||||
let privateKeyURLText = pgpPrivateKeyURLTextField.text,
|
let privateKeyURLText = pgpPrivateKeyURLTextField.text,
|
||||||
let privateKeyURL = URL(string: privateKeyURLText) else {
|
let privateKeyURL = URL(string: privateKeyURLText) else {
|
||||||
Utils.alert(title: "CannotSavePgpKey".localize(), message: "SetPgpKeyUrlsFirst.".localize(), controller: self)
|
Utils.alert(title: "CannotSavePgpKey".localize(), message: "SetPgpKeyUrlsFirst.".localize(), controller: self)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -146,10 +146,10 @@ class PasswordDetailTableViewController: UITableViewController, UIGestureRecogni
|
||||||
Timer.scheduledTimer(withTimeInterval: 1, repeats: true) { [weak self] _ in
|
Timer.scheduledTimer(withTimeInterval: 1, repeats: true) { [weak self] _ in
|
||||||
// bail out of the timer code if the object has been freed
|
// bail out of the timer code if the object has been freed
|
||||||
guard let strongSelf = self,
|
guard let strongSelf = self,
|
||||||
let otpType = strongSelf.password?.otpType,
|
let otpType = strongSelf.password?.otpType,
|
||||||
otpType != .none,
|
otpType != .none,
|
||||||
let indexPath = strongSelf.oneTimePasswordIndexPath,
|
let indexPath = strongSelf.oneTimePasswordIndexPath,
|
||||||
let cell = strongSelf.tableView.cellForRow(at: indexPath) as? LabelTableViewCell else {
|
let cell = strongSelf.tableView.cellForRow(at: indexPath) as? LabelTableViewCell else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
switch otpType {
|
switch otpType {
|
||||||
|
|
|
||||||
|
|
@ -363,7 +363,7 @@ class PasswordEditorTableViewController: UITableViewController {
|
||||||
|
|
||||||
// the name field should be a valid url
|
// the name field should be a valid url
|
||||||
guard let path = name.stringByAddingPercentEncodingForRFC3986(),
|
guard let path = name.stringByAddingPercentEncodingForRFC3986(),
|
||||||
var passwordURL = URL(string: path) else {
|
var passwordURL = URL(string: path) else {
|
||||||
Utils.alert(title: "CannotSave".localize(), message: "PasswordNameInvalid.".localize(), controller: self, completion: nil)
|
Utils.alert(title: "CannotSave".localize(), message: "PasswordNameInvalid.".localize(), controller: self, completion: nil)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ class SSHKeyUrlImportTableViewController: AutoCellHeightUITableViewController {
|
||||||
@IBAction
|
@IBAction
|
||||||
private func doneButtonTapped(_: UIButton) {
|
private func doneButtonTapped(_: UIButton) {
|
||||||
guard let text = privateKeyURLTextField.text,
|
guard let text = privateKeyURLTextField.text,
|
||||||
let privateKeyURL = URL(string: text) else {
|
let privateKeyURL = URL(string: text) else {
|
||||||
Utils.alert(title: "CannotSave".localize(), message: "SetPrivateKeyUrl.".localize(), controller: self)
|
Utils.alert(title: "CannotSave".localize(), message: "SetPrivateKeyUrl.".localize(), controller: self)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -219,8 +219,8 @@ class SettingsTableViewController: UITableViewController, UITabBarControllerDele
|
||||||
func alertTextFieldDidChange(_ sender: UITextField) {
|
func alertTextFieldDidChange(_ sender: UITextField) {
|
||||||
// check whether we should enable the Save button in setPasscodeLockAlert
|
// check whether we should enable the Save button in setPasscodeLockAlert
|
||||||
if let setPasscodeLockAlert = self.setPasscodeLockAlert,
|
if let setPasscodeLockAlert = self.setPasscodeLockAlert,
|
||||||
let setPasscodeLockAlertTextFields0 = setPasscodeLockAlert.textFields?[0],
|
let setPasscodeLockAlertTextFields0 = setPasscodeLockAlert.textFields?[0],
|
||||||
let setPasscodeLockAlertTextFields1 = setPasscodeLockAlert.textFields?[1] {
|
let setPasscodeLockAlertTextFields1 = setPasscodeLockAlert.textFields?[1] {
|
||||||
if sender == setPasscodeLockAlertTextFields0 || sender == setPasscodeLockAlertTextFields1 {
|
if sender == setPasscodeLockAlertTextFields0 || sender == setPasscodeLockAlertTextFields1 {
|
||||||
// two passwords should be the same, and length >= 4
|
// two passwords should be the same, and length >= 4
|
||||||
let passcodeText = setPasscodeLockAlertTextFields0.text!
|
let passcodeText = setPasscodeLockAlertTextFields0.text!
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ struct GopenPGPInterface: PGPInterface {
|
||||||
|
|
||||||
func decrypt(encryptedData: Data, keyID: String, passphrase: String) throws -> Data? {
|
func decrypt(encryptedData: Data, keyID: String, passphrase: String) throws -> Data? {
|
||||||
guard let key = privateKeys.first(where: { key, _ in key.hasSuffix(keyID.lowercased()) }),
|
guard let key = privateKeys.first(where: { key, _ in key.hasSuffix(keyID.lowercased()) }),
|
||||||
let privateKey = privateKeys[key.key] else {
|
let privateKey = privateKeys[key.key] else {
|
||||||
throw AppError.decryption
|
throw AppError.decryption
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -96,7 +96,7 @@ struct GopenPGPInterface: PGPInterface {
|
||||||
|
|
||||||
func encrypt(plainData: Data, keyID: String) throws -> Data {
|
func encrypt(plainData: Data, keyID: String) throws -> Data {
|
||||||
guard let key = publicKeys.first(where: { key, _ in key.hasSuffix(keyID.lowercased()) }),
|
guard let key = publicKeys.first(where: { key, _ in key.hasSuffix(keyID.lowercased()) }),
|
||||||
let publicKey = publicKeys[key.key] else {
|
let publicKey = publicKeys[key.key] else {
|
||||||
throw AppError.encryption
|
throw AppError.encryption
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ public class PGPAgent {
|
||||||
|
|
||||||
public func initKeys() throws {
|
public func initKeys() throws {
|
||||||
guard let publicKey: String = keyStore.get(for: PgpKey.PUBLIC.getKeychainKey()),
|
guard let publicKey: String = keyStore.get(for: PgpKey.PUBLIC.getKeychainKey()),
|
||||||
let privateKey: String = keyStore.get(for: PgpKey.PRIVATE.getKeychainKey()) else {
|
let privateKey: String = keyStore.get(for: PgpKey.PRIVATE.getKeychainKey()) else {
|
||||||
pgpInterface = nil
|
pgpInterface = nil
|
||||||
throw AppError.keyImport
|
throw AppError.keyImport
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,21 +6,21 @@
|
||||||
// Copyright © 2019 Bob Sun. All rights reserved.
|
// Copyright © 2019 Bob Sun. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
extension String {
|
public extension String {
|
||||||
public func localize() -> String {
|
func localize() -> String {
|
||||||
// swiftlint:disable:next nslocalizedstring_key
|
// swiftlint:disable:next nslocalizedstring_key
|
||||||
NSLocalizedString(self, bundle: Bundle.main, value: "#\(self)#", comment: "")
|
NSLocalizedString(self, bundle: Bundle.main, value: "#\(self)#", comment: "")
|
||||||
}
|
}
|
||||||
|
|
||||||
public func localize(_ firstValue: CVarArg) -> String {
|
func localize(_ firstValue: CVarArg) -> String {
|
||||||
String(format: localize(), firstValue)
|
String(format: localize(), firstValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func localize(_ firstValue: CVarArg, _ secondValue: CVarArg) -> String {
|
func localize(_ firstValue: CVarArg, _ secondValue: CVarArg) -> String {
|
||||||
String(format: localize(), firstValue, secondValue)
|
String(format: localize(), firstValue, secondValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func localize(_ error: Error) -> String {
|
func localize(_ error: Error) -> String {
|
||||||
localize(error.localizedDescription)
|
localize(error.localizedDescription)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,25 +6,25 @@
|
||||||
// Copyright © 2018 Bob Sun. All rights reserved.
|
// Copyright © 2018 Bob Sun. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
extension String {
|
public extension String {
|
||||||
public var trimmed: String {
|
var trimmed: String {
|
||||||
trimmingCharacters(in: .whitespacesAndNewlines)
|
trimmingCharacters(in: .whitespacesAndNewlines)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func stringByAddingPercentEncodingForRFC3986() -> String? {
|
func stringByAddingPercentEncodingForRFC3986() -> String? {
|
||||||
let unreserved = "-._~/?"
|
let unreserved = "-._~/?"
|
||||||
var allowed = CharacterSet.alphanumerics
|
var allowed = CharacterSet.alphanumerics
|
||||||
allowed.insert(charactersIn: unreserved)
|
allowed.insert(charactersIn: unreserved)
|
||||||
return addingPercentEncoding(withAllowedCharacters: allowed)
|
return addingPercentEncoding(withAllowedCharacters: allowed)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func splitByNewline() -> [String] {
|
func splitByNewline() -> [String] {
|
||||||
split(omittingEmptySubsequences: false) { $0 == "\n" || $0 == "\r\n" }.map(String.init)
|
split(omittingEmptySubsequences: false) { $0 == "\n" || $0 == "\r\n" }.map(String.init)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension String {
|
public extension String {
|
||||||
public static func | (left: String, right: String) -> String {
|
static func | (left: String, right: String) -> String {
|
||||||
right.isEmpty ? left : left + "\n" + right
|
right.isEmpty ? left : left + "\n" + right
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,32 +9,32 @@
|
||||||
import Foundation
|
import Foundation
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
extension UIAlertAction {
|
public extension UIAlertAction {
|
||||||
public static func cancelAndPopView(controller: UIViewController) -> UIAlertAction {
|
static func cancelAndPopView(controller: UIViewController) -> UIAlertAction {
|
||||||
cancel { _ in
|
cancel { _ in
|
||||||
controller.navigationController?.popViewController(animated: true)
|
controller.navigationController?.popViewController(animated: true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func cancel(title: String = "Cancel".localize(), handler: ((UIAlertAction) -> Void)? = nil) -> UIAlertAction {
|
static func cancel(title: String = "Cancel".localize(), handler: ((UIAlertAction) -> Void)? = nil) -> UIAlertAction {
|
||||||
UIAlertAction(title: title, style: .cancel, handler: handler)
|
UIAlertAction(title: title, style: .cancel, handler: handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func dismiss(handler: ((UIAlertAction) -> Void)? = nil) -> UIAlertAction {
|
static func dismiss(handler: ((UIAlertAction) -> Void)? = nil) -> UIAlertAction {
|
||||||
cancel(title: "Dismiss".localize(), handler: handler)
|
cancel(title: "Dismiss".localize(), handler: handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func ok(handler: ((UIAlertAction) -> Void)? = nil) -> UIAlertAction {
|
static func ok(handler: ((UIAlertAction) -> Void)? = nil) -> UIAlertAction {
|
||||||
UIAlertAction(title: "Ok".localize(), style: .default, handler: handler)
|
UIAlertAction(title: "Ok".localize(), style: .default, handler: handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func okAndPopView(controller: UIViewController) -> UIAlertAction {
|
static func okAndPopView(controller: UIViewController) -> UIAlertAction {
|
||||||
ok { _ in
|
ok { _ in
|
||||||
controller.navigationController?.popViewController(animated: true)
|
controller.navigationController?.popViewController(animated: true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func selectKey(controller: UIViewController, handler: ((UIAlertAction) -> Void)?) -> UIAlertAction {
|
static func selectKey(controller: UIViewController, handler: ((UIAlertAction) -> Void)?) -> UIAlertAction {
|
||||||
UIAlertAction(title: "Select Key", style: .default) { _ in
|
UIAlertAction(title: "Select Key", style: .default) { _ in
|
||||||
let selectKeyAlert = UIAlertController(title: "Select from imported keys", message: nil, preferredStyle: .actionSheet)
|
let selectKeyAlert = UIAlertController(title: "Select from imported keys", message: nil, preferredStyle: .actionSheet)
|
||||||
try? PGPAgent.shared.getShortKeyID().forEach { keyID in
|
try? PGPAgent.shared.getShortKeyID().forEach { keyID in
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,9 @@
|
||||||
// Copyright © 2017 Yishi Lin. All rights reserved.
|
// Copyright © 2017 Yishi Lin. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
extension UIViewController {
|
public extension UIViewController {
|
||||||
@objc
|
@objc
|
||||||
public func textFieldShouldReturn(_ textField: UITextField) -> Bool {
|
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
|
||||||
if textField.nextField != nil {
|
if textField.nextField != nil {
|
||||||
textField.nextField?.becomeFirstResponder()
|
textField.nextField?.becomeFirstResponder()
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -9,19 +9,19 @@
|
||||||
import Foundation
|
import Foundation
|
||||||
import SwiftyUserDefaults
|
import SwiftyUserDefaults
|
||||||
|
|
||||||
extension PasswordEntity {
|
public extension PasswordEntity {
|
||||||
public var nameWithCategory: String {
|
var nameWithCategory: String {
|
||||||
if let path = path, path.hasSuffix(".gpg") {
|
if let path = path, path.hasSuffix(".gpg") {
|
||||||
return String(path.prefix(upTo: path.index(path.endIndex, offsetBy: -4)))
|
return String(path.prefix(upTo: path.index(path.endIndex, offsetBy: -4)))
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
public func getCategoryText() -> String {
|
func getCategoryText() -> String {
|
||||||
getCategoryArray().joined(separator: " > ")
|
getCategoryArray().joined(separator: " > ")
|
||||||
}
|
}
|
||||||
|
|
||||||
public func getCategoryArray() -> [String] {
|
func getCategoryArray() -> [String] {
|
||||||
var parentEntity = parent
|
var parentEntity = parent
|
||||||
var passwordCategoryArray: [String] = []
|
var passwordCategoryArray: [String] = []
|
||||||
while parentEntity != nil {
|
while parentEntity != nil {
|
||||||
|
|
@ -32,7 +32,7 @@ extension PasswordEntity {
|
||||||
return passwordCategoryArray
|
return passwordCategoryArray
|
||||||
}
|
}
|
||||||
|
|
||||||
public func getURL() throws -> URL {
|
func getURL() throws -> URL {
|
||||||
if let path = getPath().stringByAddingPercentEncodingForRFC3986(), let url = URL(string: path) {
|
if let path = getPath().stringByAddingPercentEncodingForRFC3986(), let url = URL(string: path) {
|
||||||
return url
|
return url
|
||||||
}
|
}
|
||||||
|
|
@ -42,16 +42,16 @@ extension PasswordEntity {
|
||||||
// XXX: define some getters to get core data, we need to consider
|
// XXX: define some getters to get core data, we need to consider
|
||||||
// manually write models instead auto generation.
|
// manually write models instead auto generation.
|
||||||
|
|
||||||
public func getImage() -> Data? {
|
func getImage() -> Data? {
|
||||||
image
|
image
|
||||||
}
|
}
|
||||||
|
|
||||||
public func getName() -> String {
|
func getName() -> String {
|
||||||
// unwrap non-optional core data
|
// unwrap non-optional core data
|
||||||
name ?? ""
|
name ?? ""
|
||||||
}
|
}
|
||||||
|
|
||||||
public func getPath() -> String {
|
func getPath() -> String {
|
||||||
// unwrap non-optional core data
|
// unwrap non-optional core data
|
||||||
path ?? ""
|
path ?? ""
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -645,8 +645,8 @@ public class PasswordStore {
|
||||||
}
|
}
|
||||||
// get the oldest local commit
|
// get the oldest local commit
|
||||||
guard let firstLocalCommit = localCommits.last,
|
guard let firstLocalCommit = localCommits.last,
|
||||||
firstLocalCommit.parents.count == 1,
|
firstLocalCommit.parents.count == 1,
|
||||||
let newHead = firstLocalCommit.parents.first else {
|
let newHead = firstLocalCommit.parents.first else {
|
||||||
throw AppError.gitReset
|
throw AppError.gitReset
|
||||||
}
|
}
|
||||||
try storeRepository.reset(to: newHead, resetType: .hard)
|
try storeRepository.reset(to: newHead, resetType: .hard)
|
||||||
|
|
@ -707,7 +707,7 @@ public class PasswordStore {
|
||||||
public func findGPGID(from url: URL) -> String {
|
public func findGPGID(from url: URL) -> String {
|
||||||
var path = url
|
var path = url
|
||||||
while !FileManager.default.fileExists(atPath: path.appendingPathComponent(".gpg-id").path),
|
while !FileManager.default.fileExists(atPath: path.appendingPathComponent(".gpg-id").path),
|
||||||
path.path != "file:///" {
|
path.path != "file:///" {
|
||||||
path = path.deletingLastPathComponent()
|
path = path.deletingLastPathComponent()
|
||||||
}
|
}
|
||||||
path = path.appendingPathComponent(".gpg-id")
|
path = path.appendingPathComponent(".gpg-id")
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ public struct PasswordGenerator: Codable {
|
||||||
return ["eff_long_wordlist", "eff_short_wordlist"]
|
return ["eff_long_wordlist", "eff_short_wordlist"]
|
||||||
.map { name -> String in
|
.map { name -> String in
|
||||||
guard let asset = NSDataAsset(name: name, bundle: bundle),
|
guard let asset = NSDataAsset(name: name, bundle: bundle),
|
||||||
let data = String(data: asset.data, encoding: .utf8) else {
|
let data = String(data: asset.data, encoding: .utf8) else {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
return data
|
return data
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ class CryptoFrameworkTest: XCTestCase {
|
||||||
].forEach { testKeyInfo in
|
].forEach { testKeyInfo in
|
||||||
var error: NSError?
|
var error: NSError?
|
||||||
guard let publicKey = CryptoNewKeyFromArmored(testKeyInfo.publicKey, &error),
|
guard let publicKey = CryptoNewKeyFromArmored(testKeyInfo.publicKey, &error),
|
||||||
let privateKey = CryptoNewKeyFromArmored(testKeyInfo.privateKey, &error) else {
|
let privateKey = CryptoNewKeyFromArmored(testKeyInfo.privateKey, &error) else {
|
||||||
XCTFail("Keys cannot be initialized.")
|
XCTFail("Keys cannot be initialized.")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
SWIFTFORMAT_VERSION="0.46.*"
|
SWIFTFORMAT_VERSION="0.47.*"
|
||||||
|
|
||||||
if [[ -f "${SRCROOT}/.ci-env" ]]; then
|
if [[ -f "${SRCROOT}/.ci-env" ]]; then
|
||||||
echo "Running in a Continuous Integration environment. Formatting is skipped."
|
echo "Running in a Continuous Integration environment. Formatting is skipped."
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue