aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoopesh Chander <roop@roopc.net>2019-01-22 19:30:06 +0530
committerRoopesh Chander <roop@roopc.net>2019-01-22 19:30:21 +0530
commit9f362e8cb0c4cdecd5a1002dca50020bd7db29fe (patch)
tree6f833ab77fb4e7da256d6e8f80ab56dd242c3763
parentmacOS: Tunnel detail: Handle deletion outside app (diff)
downloadwireguard-apple-9f362e8cb0c4cdecd5a1002dca50020bd7db29fe.tar.xz
wireguard-apple-9f362e8cb0c4cdecd5a1002dca50020bd7db29fe.zip
macOS: Tunnel edit: Handle deletion outside app
Signed-off-by: Roopesh Chander <roop@roopc.net>
-rw-r--r--WireGuard/WireGuard/UI/macOS/ViewController/TunnelDetailTableViewController.swift11
1 files changed, 10 insertions, 1 deletions
diff --git a/WireGuard/WireGuard/UI/macOS/ViewController/TunnelDetailTableViewController.swift b/WireGuard/WireGuard/UI/macOS/ViewController/TunnelDetailTableViewController.swift
index 70085d76..546d1c1f 100644
--- a/WireGuard/WireGuard/UI/macOS/ViewController/TunnelDetailTableViewController.swift
+++ b/WireGuard/WireGuard/UI/macOS/ViewController/TunnelDetailTableViewController.swift
@@ -84,6 +84,7 @@ class TunnelDetailTableViewController: NSViewController {
}
private var tableViewModelRows = [TableViewModelRow]()
private var statusObservationToken: AnyObject?
+ private var tunnelEditVC: TunnelEditViewController?
init(tunnelsManager: TunnelsManager, tunnel: TunnelContainer) {
self.tunnelsManager = tunnelsManager
@@ -201,6 +202,7 @@ class TunnelDetailTableViewController: NSViewController {
let tunnelEditVC = TunnelEditViewController(tunnelsManager: tunnelsManager, tunnel: tunnel)
tunnelEditVC.delegate = self
presentAsSheet(tunnelEditVC)
+ self.tunnelEditVC = tunnelEditVC
}
@objc func handleToggleActiveStatusAction() {
@@ -219,6 +221,13 @@ class TunnelDetailTableViewController: NSViewController {
tunnelsManager.startDeactivation(of: tunnel)
}
}
+
+ override func viewWillDisappear() {
+ super.viewWillDisappear()
+ if let tunnelEditVC = tunnelEditVC {
+ dismiss(tunnelEditVC)
+ }
+ }
}
extension TunnelDetailTableViewController: NSTableViewDataSource {
@@ -264,6 +273,6 @@ extension TunnelDetailTableViewController: TunnelEditViewControllerDelegate {
}
func tunnelEditingCancelled() {
- // Nothing to do
+ self.tunnelEditVC = nil
}
}