diff options
Diffstat (limited to 'WireGuard/WireGuard/UI/macOS/ViewController/TunnelEditViewController.swift')
-rw-r--r-- | WireGuard/WireGuard/UI/macOS/ViewController/TunnelEditViewController.swift | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/WireGuard/WireGuard/UI/macOS/ViewController/TunnelEditViewController.swift b/WireGuard/WireGuard/UI/macOS/ViewController/TunnelEditViewController.swift index d8dbbd2..62eba17 100644 --- a/WireGuard/WireGuard/UI/macOS/ViewController/TunnelEditViewController.swift +++ b/WireGuard/WireGuard/UI/macOS/ViewController/TunnelEditViewController.swift @@ -3,6 +3,11 @@ import Cocoa +protocol TunnelEditViewControllerDelegate: class { + func tunnelSaved(tunnel: TunnelContainer) + func tunnelEditingCancelled() +} + class TunnelEditViewController: NSViewController { let nameRow: EditableKeyValueRow = { @@ -62,6 +67,8 @@ class TunnelEditViewController: NSViewController { let tunnelsManager: TunnelsManager let tunnel: TunnelContainer? + weak var delegate: TunnelEditViewControllerDelegate? + var textViewObservationToken: AnyObject? init(tunnelsManager: TunnelsManager, tunnel: TunnelContainer?) { @@ -149,6 +156,7 @@ class TunnelEditViewController: NSViewController { return } self?.dismiss(self) + self?.delegate?.tunnelSaved(tunnel: tunnel) } } catch let error as WireGuardAppError { ErrorPresenter.showErrorAlert(error: error, from: self) @@ -159,6 +167,7 @@ class TunnelEditViewController: NSViewController { } @objc func discardButtonClicked() { + delegate?.tunnelEditingCancelled() dismiss(self) } } |