aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard
diff options
context:
space:
mode:
authorRoopesh Chander <roop@roopc.net>2018-11-03 17:26:06 +0530
committerRoopesh Chander <roop@roopc.net>2018-11-03 17:27:07 +0530
commit2f5e83cf99613946d03fd7166c752fb00eea475d (patch)
treee45766c7df158fa715be860c2861fa3bbbba0b1a /WireGuard
parentTunnels list: Should deselect the row when handling the selection (diff)
downloadwireguard-apple-2f5e83cf99613946d03fd7166c752fb00eea475d.tar.xz
wireguard-apple-2f5e83cf99613946d03fd7166c752fb00eea475d.zip
ErrorPresenter: showErrorAlert takes an onPresentated handler
Signed-off-by: Roopesh Chander <roop@roopc.net>
Diffstat (limited to 'WireGuard')
-rw-r--r--WireGuard/WireGuard/UI/iOS/ErrorPresenter.swift5
1 files changed, 3 insertions, 2 deletions
diff --git a/WireGuard/WireGuard/UI/iOS/ErrorPresenter.swift b/WireGuard/WireGuard/UI/iOS/ErrorPresenter.swift
index a73c057..95b5503 100644
--- a/WireGuard/WireGuard/UI/iOS/ErrorPresenter.swift
+++ b/WireGuard/WireGuard/UI/iOS/ErrorPresenter.swift
@@ -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) {