aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard/UI/iOS/ErrorPresenter.swift
diff options
context:
space:
mode:
authorRoopesh Chander <roop@roopc.net>2018-12-29 01:36:46 +0530
committerRoopesh Chander <roop@roopc.net>2019-01-14 14:52:29 +0530
commit6a27626fc003399b1f542b7ef64ea838001375dc (patch)
tree97306ad99b7c4fdd429a464068d3caa457f3e47e /WireGuard/WireGuard/UI/iOS/ErrorPresenter.swift
parentmacOS: Add tunnel management menu items (diff)
downloadwireguard-apple-6a27626fc003399b1f542b7ef64ea838001375dc.tar.xz
wireguard-apple-6a27626fc003399b1f542b7ef64ea838001375dc.zip
iOS: Refactor importFromFile
So that it can be used in macOS as well Signed-off-by: Roopesh Chander <roop@roopc.net>
Diffstat (limited to '')
-rw-r--r--WireGuard/WireGuard/UI/iOS/ErrorPresenter.swift11
1 files changed, 3 insertions, 8 deletions
diff --git a/WireGuard/WireGuard/UI/iOS/ErrorPresenter.swift b/WireGuard/WireGuard/UI/iOS/ErrorPresenter.swift
index 1746c81..7d134de 100644
--- a/WireGuard/WireGuard/UI/iOS/ErrorPresenter.swift
+++ b/WireGuard/WireGuard/UI/iOS/ErrorPresenter.swift
@@ -4,14 +4,9 @@
import UIKit
import os.log
-class ErrorPresenter {
- static func showErrorAlert(error: WireGuardAppError, from sourceVC: UIViewController?, onPresented: (() -> Void)? = nil, onDismissal: (() -> Void)? = nil) {
- let (title, message) = error.alertText
- showErrorAlert(title: title, message: message, from: sourceVC, onPresented: onPresented, onDismissal: onDismissal)
- }
-
- static func showErrorAlert(title: String, message: String, from sourceVC: UIViewController?, onPresented: (() -> Void)? = nil, onDismissal: (() -> Void)? = nil) {
- guard let sourceVC = sourceVC else { return }
+class ErrorPresenter: ErrorPresenterProtocol {
+ static func showErrorAlert(title: String, message: String, from sourceVC: AnyObject?, onPresented: (() -> Void)?, onDismissal: (() -> Void)?) {
+ guard let sourceVC = sourceVC as? UIViewController else { return }
let okAction = UIAlertAction(title: "OK", style: .default) { _ in
onDismissal?()