Format code with SwiftFormat automatically in every build

This commit is contained in:
Danny Moesch 2020-06-28 21:25:40 +02:00 committed by Mingshen Sun
parent f167ab7549
commit 7f9f0e43b2
100 changed files with 1124 additions and 1063 deletions

View file

@ -7,12 +7,12 @@
//
import Foundation
import SVProgressHUD
import passKit
import SVProgressHUD
public func requestGitCredentialPassword(credential: GitCredential.Credential,
lastPassword: String?,
controller: UIViewController) -> String? {
lastPassword: String?,
controller: UIViewController) -> String? {
let sem = DispatchSemaphore(value: 0)
var password: String?
let message: String = {
@ -27,21 +27,21 @@ public func requestGitCredentialPassword(credential: GitCredential.Credential,
DispatchQueue.main.async {
SVProgressHUD.dismiss()
let alert = UIAlertController(title: "Password".localize(), message: message, preferredStyle: .alert)
alert.addTextField() {
alert.addTextField {
$0.text = lastPassword ?? ""
$0.isSecureTextEntry = true
}
alert.addAction(UIAlertAction.ok() { _ in
alert.addAction(UIAlertAction.ok { _ in
password = alert.textFields?.first?.text
sem.signal()
})
alert.addAction(UIAlertAction.cancel() { _ in
alert.addAction(UIAlertAction.cancel { _ in
password = nil
sem.signal()
})
controller.present(alert, animated: true)
}
let _ = sem.wait(timeout: .distantFuture)
_ = sem.wait(timeout: .distantFuture)
return password
}

View file

@ -25,7 +25,7 @@ class SecurePasteboard {
// exit the existing background task, if any
if backgroundTaskID != UIBackgroundTaskIdentifier.invalid {
UIApplication.shared.endBackgroundTask(UIBackgroundTaskIdentifier.invalid)
self.backgroundTaskID = UIBackgroundTaskIdentifier.invalid
backgroundTaskID = UIBackgroundTaskIdentifier.invalid
}
backgroundTaskID = UIApplication.shared.beginBackgroundTask(expirationHandler: { [weak self] in
@ -40,5 +40,4 @@ class SecurePasteboard {
self?.backgroundTaskID = UIBackgroundTaskIdentifier.invalid
}
}
}

View file

@ -7,8 +7,8 @@
//
import Foundation
import SVProgressHUD
import passKit
import SVProgressHUD
extension Utils {
static func alert(title: String, message: String, controller: UIViewController, handler: ((UIAlertAction) -> Void)? = nil, completion: (() -> Void)? = nil) {