]> git.ipfire.org Git - thirdparty/wireguard-apple.git/commitdiff
ErrorPresenter: showErrorAlert takes an onPresentated handler
authorRoopesh Chander <roop@roopc.net>
Sat, 3 Nov 2018 11:56:06 +0000 (17:26 +0530)
committerRoopesh Chander <roop@roopc.net>
Sat, 3 Nov 2018 11:57:07 +0000 (17:27 +0530)
Signed-off-by: Roopesh Chander <roop@roopc.net>
WireGuard/WireGuard/UI/iOS/ErrorPresenter.swift

index a73c0570d11efb7be252caf32f2ff5b478530192..95b5503181140c1c5c61400725586ccee96366fc 100644 (file)
@@ -51,7 +51,8 @@ class ErrorPresenter {
         }
     }
 
-    static func showErrorAlert(error: Error, from sourceVC: UIViewController?, onDismissal: (() -> Void)? = nil) {
+    static func showErrorAlert(error: Error, from sourceVC: UIViewController?,
+                               onDismissal: (() -> Void)? = nil, onPresented: (() -> Void)? = nil) {
         guard let sourceVC = sourceVC else { return }
         guard let (title, message) = ErrorPresenter.errorMessage(for: error) else { return }
         let okAction = UIAlertAction(title: "OK", style: .default) { (_) in
@@ -60,7 +61,7 @@ class ErrorPresenter {
         let alert = UIAlertController(title: title, message: message, preferredStyle: .alert)
         alert.addAction(okAction)
 
-        sourceVC.present(alert, animated: true)
+        sourceVC.present(alert, animated: true, completion: onPresented)
     }
 
     static func showErrorAlert(title: String, message: String, from sourceVC: UIViewController?, onDismissal: (() -> Void)? = nil) {