diff options
author | Roopesh Chander <roop@roopc.net> | 2018-12-29 01:36:46 +0530 |
---|---|---|
committer | Roopesh Chander <roop@roopc.net> | 2019-01-14 14:52:29 +0530 |
commit | 6a27626fc003399b1f542b7ef64ea838001375dc (patch) | |
tree | 97306ad99b7c4fdd429a464068d3caa457f3e47e /WireGuard/WireGuard/UI/iOS/ErrorPresenter.swift | |
parent | macOS: Add tunnel management menu items (diff) | |
download | wireguard-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.swift | 11 |
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?() |