aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard
diff options
context:
space:
mode:
authorRoopesh Chander <roop@roopc.net>2018-12-12 19:17:06 +0530
committerRoopesh Chander <roop@roopc.net>2018-12-12 19:17:06 +0530
commit7ef12d93a740b2eb6d1feee3605ecf7d7b0164ef (patch)
tree847cd6aacf46feb6d26e30079616b16bb820c3ae /WireGuard/WireGuard
parentZip importing: Handle spaces in filenames correctly (diff)
downloadwireguard-apple-7ef12d93a740b2eb6d1feee3605ecf7d7b0164ef.tar.xz
wireguard-apple-7ef12d93a740b2eb6d1feee3605ecf7d7b0164ef.zip
ErrorPresenter: Support onPresented for showErrorAlert(title:,message:)
Signed-off-by: Roopesh Chander <roop@roopc.net>
Diffstat (limited to 'WireGuard/WireGuard')
-rw-r--r--WireGuard/WireGuard/UI/iOS/ErrorPresenter.swift7
1 files changed, 4 insertions, 3 deletions
diff --git a/WireGuard/WireGuard/UI/iOS/ErrorPresenter.swift b/WireGuard/WireGuard/UI/iOS/ErrorPresenter.swift
index c613d67..6cae1e6 100644
--- a/WireGuard/WireGuard/UI/iOS/ErrorPresenter.swift
+++ b/WireGuard/WireGuard/UI/iOS/ErrorPresenter.swift
@@ -6,7 +6,7 @@ import os.log
class ErrorPresenter {
static func showErrorAlert(error: WireGuardAppError, from sourceVC: UIViewController?,
- onDismissal: (() -> Void)? = nil, onPresented: (() -> Void)? = nil) {
+ onPresented: (() -> Void)? = nil, onDismissal: (() -> Void)? = nil) {
guard let sourceVC = sourceVC else { return }
guard let (title, message) = error.alertText() else { return }
let okAction = UIAlertAction(title: "OK", style: .default) { (_) in
@@ -18,7 +18,8 @@ class ErrorPresenter {
sourceVC.present(alert, animated: true, completion: onPresented)
}
- static func showErrorAlert(title: String, message: String, from sourceVC: UIViewController?, onDismissal: (() -> Void)? = nil) {
+ static func showErrorAlert(title: String, message: String, from sourceVC: UIViewController?,
+ onPresented: (() -> Void)? = nil, onDismissal: (() -> Void)? = nil) {
guard let sourceVC = sourceVC else { return }
let okAction = UIAlertAction(title: "OK", style: .default) { (_) in
onDismissal?()
@@ -26,6 +27,6 @@ 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)
}
}