aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard/UI/iOS/ViewController/TunnelDetailTableViewController.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/TunnelDetailTableViewController.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/TunnelDetailTableViewController.swift')
-rw-r--r--WireGuard/WireGuard/UI/iOS/ViewController/TunnelDetailTableViewController.swift19
1 files changed, 3 insertions, 16 deletions
diff --git a/WireGuard/WireGuard/UI/iOS/ViewController/TunnelDetailTableViewController.swift b/WireGuard/WireGuard/UI/iOS/ViewController/TunnelDetailTableViewController.swift
index f198e06..b2dca83 100644
--- a/WireGuard/WireGuard/UI/iOS/ViewController/TunnelDetailTableViewController.swift
+++ b/WireGuard/WireGuard/UI/iOS/ViewController/TunnelDetailTableViewController.swift
@@ -125,21 +125,6 @@ class TunnelDetailTableViewController: UITableViewController {
}
}
- func showConfirmationAlert(message: String, buttonTitle: String, from sourceView: UIView, 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?.sourceView = sourceView
- alert.popoverPresentationController?.sourceRect = sourceView.bounds
-
- present(alert, animated: true, completion: nil)
- }
-
func startUpdatingRuntimeConfiguration() {
reloadRuntimeConfiguration()
reloadRuntimeConfigurationTimer?.invalidate()
@@ -435,7 +420,9 @@ extension TunnelDetailTableViewController {
cell.hasDestructiveAction = true
cell.onTapped = { [weak self] in
guard let self = self else { return }
- self.showConfirmationAlert(message: tr("deleteTunnelConfirmationAlertMessage"), buttonTitle: tr("deleteTunnelConfirmationAlertButtonTitle"), from: cell) { [weak self] in
+ ConfirmationAlertPresenter.showConfirmationAlert(message: tr("deleteTunnelConfirmationAlertMessage"),
+ buttonTitle: tr("deleteTunnelConfirmationAlertButtonTitle"),
+ from: cell, presentingVC: self) { [weak self] in
guard let self = self else { return }
self.tunnelsManager.remove(tunnel: self.tunnel) { error in
if error != nil {