Refactor GitCredential to simplify it and to add tests

This commit is contained in:
Danny Moesch 2020-08-23 01:15:23 +02:00 committed by Mingshen Sun
parent 56b7b24fce
commit 6044098278
11 changed files with 295 additions and 225 deletions

View file

@ -16,16 +16,12 @@ extension UIAlertAction {
}
}
public static func cancel(handler: ((UIAlertAction) -> Void)? = nil) -> UIAlertAction {
cancel(with: "Cancel", handler: handler)
public static func cancel(title: String = "Cancel".localize(), handler: ((UIAlertAction) -> Void)? = nil) -> UIAlertAction {
UIAlertAction(title: title, style: .cancel, handler: handler)
}
public static func dismiss(handler: ((UIAlertAction) -> Void)? = nil) -> UIAlertAction {
cancel(with: "Dismiss", handler: handler)
}
public static func cancel(with _: String, handler: ((UIAlertAction) -> Void)? = nil) -> UIAlertAction {
UIAlertAction(title: "Cancel".localize(), style: .cancel, handler: handler)
cancel(title: "Dismiss".localize(), handler: handler)
}
public static func ok(handler: ((UIAlertAction) -> Void)? = nil) -> UIAlertAction {