Rely on SPM plugins to consume SwiftLint and SwiftFormat
Use their latest releases and fix some violations and issues. # Conflicts: # .github/workflows/linting.yml # .github/workflows/testing.yml
This commit is contained in:
parent
358908f161
commit
1bdf9d684b
40 changed files with 126 additions and 186 deletions
|
|
@ -1,67 +0,0 @@
|
|||
//
|
||||
// SSHKeyURLImportTableViewController.swift
|
||||
// pass
|
||||
//
|
||||
// Created by Mingshen Sun on 25/1/2017.
|
||||
// Copyright © 2017 Bob Sun. All rights reserved.
|
||||
//
|
||||
|
||||
import passKit
|
||||
import SVProgressHUD
|
||||
|
||||
class SSHKeyURLImportTableViewController: AutoCellHeightUITableViewController {
|
||||
@IBOutlet var privateKeyURLTextField: UITextField!
|
||||
|
||||
var sshPrivateKeyURL: URL?
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
privateKeyURLTextField.text = Defaults.gitSSHPrivateKeyURL?.absoluteString
|
||||
}
|
||||
|
||||
@IBAction
|
||||
private func doneButtonTapped(_: UIButton) {
|
||||
guard let text = privateKeyURLTextField.text,
|
||||
let privateKeyURL = URL(string: text) else {
|
||||
Utils.alert(title: "CannotSave".localize(), message: "SetPrivateKeyUrl.".localize(), controller: self)
|
||||
return
|
||||
}
|
||||
|
||||
if privateKeyURL.scheme?.lowercased() == "http" {
|
||||
let savePassphraseAlert = UIAlertController(title: "HttpNotSecure".localize(), message: "ReallyUseHttp?".localize(), preferredStyle: .alert)
|
||||
savePassphraseAlert.addAction(UIAlertAction(title: "No".localize(), style: .default) { _ in })
|
||||
savePassphraseAlert.addAction(
|
||||
UIAlertAction(title: "Yes".localize(), style: .destructive) { _ in
|
||||
self.sshPrivateKeyURL = privateKeyURL
|
||||
self.performSegue(withIdentifier: "importSSHKeySegue", sender: self)
|
||||
}
|
||||
)
|
||||
present(savePassphraseAlert, animated: true)
|
||||
return
|
||||
}
|
||||
sshPrivateKeyURL = privateKeyURL
|
||||
performSegue(withIdentifier: "importSSHKeySegue", sender: self)
|
||||
}
|
||||
}
|
||||
|
||||
extension SSHKeyURLImportTableViewController: KeyImporter {
|
||||
static let keySource = KeySource.url
|
||||
static let label = "DownloadFromUrl".localize()
|
||||
|
||||
func isReadyToUse() -> Bool {
|
||||
guard let url = sshPrivateKeyURL else {
|
||||
Utils.alert(title: "CannotSave".localize(), message: "SetPrivateKeyUrl.".localize(), controller: self)
|
||||
return false
|
||||
}
|
||||
guard url.scheme == "https" || url.scheme == "http" else {
|
||||
Utils.alert(title: "CannotSave".localize(), message: "UseEitherHttpsOrHttp.".localize(), controller: self)
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func importKeys() throws {
|
||||
Defaults.gitSSHPrivateKeyURL = sshPrivateKeyURL
|
||||
try KeyFileManager.PrivateSSH.importKey(from: Defaults.gitSSHPrivateKeyURL!)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue