mirror of
https://github.com/passepartoutvpn/wireguard-apple.git
synced 2025-02-22 15:52:05 +00:00
A bit overdue, but better late than never. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
20 lines
715 B
Swift
20 lines
715 B
Swift
// SPDX-License-Identifier: MIT
|
|
// Copyright © 2018-2020 WireGuard LLC. All Rights Reserved.
|
|
|
|
import UIKit
|
|
import os.log
|
|
|
|
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?()
|
|
}
|
|
let alert = UIAlertController(title: title, message: message, preferredStyle: .alert)
|
|
alert.addAction(okAction)
|
|
|
|
sourceVC.present(alert, animated: true, completion: onPresented)
|
|
}
|
|
}
|