aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard/UI/iOS/ViewController/TunnelsListTableViewController.swift
diff options
context:
space:
mode:
authorRoopesh Chander <roop@roopc.net>2019-03-19 01:24:06 +0530
committerJason A. Donenfeld <Jason@zx2c4.com>2019-03-18 14:54:05 -0600
commitfc163fc9ff8e6408cfe262d758c402aada920cc1 (patch)
tree237a5a93e9966919b2a8adc8fe2590f0f0ba0791 /WireGuard/WireGuard/UI/iOS/ViewController/TunnelsListTableViewController.swift
parentiOS: Tunnels list: Ability to remove multiple tunnels at a time (diff)
downloadwireguard-apple-fc163fc9ff8e6408cfe262d758c402aada920cc1.tar.xz
wireguard-apple-fc163fc9ff8e6408cfe262d758c402aada920cc1.zip
iOS: Consolidate all showConfirmationAlert()s into one place
Signed-off-by: Roopesh Chander <roop@roopc.net>
Diffstat (limited to 'WireGuard/WireGuard/UI/iOS/ViewController/TunnelsListTableViewController.swift')
-rw-r--r--WireGuard/WireGuard/UI/iOS/ViewController/TunnelsListTableViewController.swift17
1 files changed, 2 insertions, 15 deletions
diff --git a/WireGuard/WireGuard/UI/iOS/ViewController/TunnelsListTableViewController.swift b/WireGuard/WireGuard/UI/iOS/ViewController/TunnelsListTableViewController.swift
index c09bb34..d54d7a1 100644
--- a/WireGuard/WireGuard/UI/iOS/ViewController/TunnelsListTableViewController.swift
+++ b/WireGuard/WireGuard/UI/iOS/ViewController/TunnelsListTableViewController.swift
@@ -238,7 +238,8 @@ class TunnelsListTableViewController: UIViewController {
tr(format: "deleteTunnelConfirmationAlertButtonMessage (%d)", selectedTunnels.count) :
tr(format: "deleteTunnelsConfirmationAlertButtonMessage (%d)", selectedTunnels.count)
let title = tr("deleteTunnelsConfirmationAlertButtonTitle")
- self.showConfirmationAlert(message: message, buttonTitle: title, from: sender) { [weak self] in
+ ConfirmationAlertPresenter.showConfirmationAlert(message: message, buttonTitle: title,
+ from: sender, presentingVC: self) { [weak self] in
self?.tunnelsManager?.removeMultiple(tunnels: selectedTunnels) { [weak self] error in
guard let self = self else { return }
if let error = error {
@@ -250,20 +251,6 @@ class TunnelsListTableViewController: UIViewController {
}
}
}
-
- func showConfirmationAlert(message: String, buttonTitle: String, from barButtonItem: UIBarButtonItem, onConfirmed: @escaping (() -> Void)) {
- let destroyAction = UIAlertAction(title: buttonTitle, style: .destructive) { _ in
- onConfirmed()
- }
- let cancelAction = UIAlertAction(title: tr("actionCancel"), style: .cancel)
- let alert = UIAlertController(title: "", message: message, preferredStyle: .actionSheet)
- alert.addAction(destroyAction)
- alert.addAction(cancelAction)
-
- alert.popoverPresentationController?.barButtonItem = barButtonItem
-
- present(alert, animated: true, completion: nil)
- }
}
extension TunnelsListTableViewController: UIDocumentPickerDelegate {