aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard
diff options
context:
space:
mode:
authorRoopesh Chander <roop@roopc.net>2018-10-25 11:14:38 +0530
committerRoopesh Chander <roop@roopc.net>2018-10-27 15:13:02 +0530
commitf7feb18ea88d4a9fa83854fc720eadfb26d79fce (patch)
treeb963ccf012093e9a0c9ff34f2502cc5452bfb047 /WireGuard/WireGuard
parentImport: Support for opening a .conf file in the app (diff)
downloadwireguard-apple-f7feb18ea88d4a9fa83854fc720eadfb26d79fce.tar.xz
wireguard-apple-f7feb18ea88d4a9fa83854fc720eadfb26d79fce.zip
Tunnel editing: Delegate should also report when editing is cancelled
Signed-off-by: Roopesh Chander <roop@roopc.net>
Diffstat (limited to 'WireGuard/WireGuard')
-rw-r--r--WireGuard/WireGuard/UI/iOS/TunnelDetailTableViewController.swift5
-rw-r--r--WireGuard/WireGuard/UI/iOS/TunnelEditTableViewController.swift8
-rw-r--r--WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift5
3 files changed, 13 insertions, 5 deletions
diff --git a/WireGuard/WireGuard/UI/iOS/TunnelDetailTableViewController.swift b/WireGuard/WireGuard/UI/iOS/TunnelDetailTableViewController.swift
index 1ca6ec6..b4ae135 100644
--- a/WireGuard/WireGuard/UI/iOS/TunnelDetailTableViewController.swift
+++ b/WireGuard/WireGuard/UI/iOS/TunnelDetailTableViewController.swift
@@ -54,10 +54,13 @@ class TunnelDetailTableViewController: UITableViewController {
// MARK: TunnelEditTableViewControllerDelegate
extension TunnelDetailTableViewController: TunnelEditTableViewControllerDelegate {
- func saved(tunnel: TunnelContainer) {
+ func tunnelSaved(tunnel: TunnelContainer) {
tunnelViewModel = TunnelViewModel(tunnelConfiguration: tunnel.tunnelConfiguration)
self.tableView.reloadData()
}
+ func tunnelEditingCancelled() {
+ // Nothing to do
+ }
}
// MARK: UITableViewDataSource
diff --git a/WireGuard/WireGuard/UI/iOS/TunnelEditTableViewController.swift b/WireGuard/WireGuard/UI/iOS/TunnelEditTableViewController.swift
index 1c863f5..1054cfa 100644
--- a/WireGuard/WireGuard/UI/iOS/TunnelEditTableViewController.swift
+++ b/WireGuard/WireGuard/UI/iOS/TunnelEditTableViewController.swift
@@ -4,7 +4,8 @@
import UIKit
protocol TunnelEditTableViewControllerDelegate: class {
- func saved(tunnel: TunnelContainer)
+ func tunnelSaved(tunnel: TunnelContainer)
+ func tunnelEditingCancelled()
}
// MARK: TunnelEditTableViewController
@@ -81,8 +82,8 @@ class TunnelEditTableViewController: UITableViewController {
print("Could not modify tunnel: \(error)")
self?.showErrorAlert(title: "Could not save", message: "Internal error")
} else {
- self?.delegate?.saved(tunnel: tunnel)
self?.dismiss(animated: true, completion: nil)
+ self?.delegate?.tunnelSaved(tunnel: tunnel)
}
}
} else {
@@ -92,8 +93,8 @@ class TunnelEditTableViewController: UITableViewController {
print("Could not add tunnel: \(error)")
self?.showErrorAlert(title: "Could not save", message: "Internal error")
} else {
- self?.delegate?.saved(tunnel: tunnel)
self?.dismiss(animated: true, completion: nil)
+ self?.delegate?.tunnelSaved(tunnel: tunnel)
}
}
}
@@ -102,6 +103,7 @@ class TunnelEditTableViewController: UITableViewController {
@objc func cancelTapped() {
dismiss(animated: true, completion: nil)
+ self.delegate?.tunnelEditingCancelled()
}
func showErrorAlert(title: String, message: String) {
diff --git a/WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift b/WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift
index 0500f18..e88ec91 100644
--- a/WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift
+++ b/WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift
@@ -94,12 +94,15 @@ class TunnelsListTableViewController: UITableViewController {
// MARK: TunnelEditTableViewControllerDelegate
extension TunnelsListTableViewController: TunnelEditTableViewControllerDelegate {
- func saved(tunnel: TunnelContainer) {
+ func tunnelSaved(tunnel: TunnelContainer) {
guard let tunnelsManager = tunnelsManager else { return }
let tunnelDetailVC = TunnelDetailTableViewController(tunnelsManager: tunnelsManager,
tunnel: tunnel)
showDetailViewController(tunnelDetailVC, sender: self) // Shall get propagated up to the split-vc
}
+ func tunnelEditingCancelled() {
+ // Nothing to do here
+ }
}
// MARK: UITableViewDataSource