diff options
author | Roopesh Chander <roop@roopc.net> | 2018-12-29 18:44:29 +0530 |
---|---|---|
committer | Roopesh Chander <roop@roopc.net> | 2019-01-14 14:52:30 +0530 |
commit | 04f6ee0f115bdeb26398568296ecef437872a660 (patch) | |
tree | 93ab976bb9915b211f5656b867004be795895789 /WireGuard/WireGuard/UI/macOS/AppDelegate.swift | |
parent | macOS: Ability to import tunnels from file (diff) | |
download | wireguard-apple-04f6ee0f115bdeb26398568296ecef437872a660.tar.xz wireguard-apple-04f6ee0f115bdeb26398568296ecef437872a660.zip |
macOS: Ability to activate / deactivate a tunnel
Signed-off-by: Roopesh Chander <roop@roopc.net>
Diffstat (limited to '')
-rw-r--r-- | WireGuard/WireGuard/UI/macOS/AppDelegate.swift | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/WireGuard/WireGuard/UI/macOS/AppDelegate.swift b/WireGuard/WireGuard/UI/macOS/AppDelegate.swift index 970e56d..3a5aa1d 100644 --- a/WireGuard/WireGuard/UI/macOS/AppDelegate.swift +++ b/WireGuard/WireGuard/UI/macOS/AppDelegate.swift @@ -18,10 +18,29 @@ class AppDelegate: NSObject, NSApplicationDelegate { self.statusItem = createStatusBarItem(with: statusMenu) tunnelsManager.tunnelsListDelegate = statusMenu + tunnelsManager.activationDelegate = self } } } +extension AppDelegate: TunnelsManagerActivationDelegate { + func tunnelActivationAttemptFailed(tunnel: TunnelContainer, error: TunnelsManagerActivationAttemptError) { + ErrorPresenter.showErrorAlert(error: error, from: nil) + } + + func tunnelActivationAttemptSucceeded(tunnel: TunnelContainer) { + // Nothing to do + } + + func tunnelActivationFailed(tunnel: TunnelContainer, error: TunnelsManagerActivationError) { + ErrorPresenter.showErrorAlert(error: error, from: nil) + } + + func tunnelActivationSucceeded(tunnel: TunnelContainer) { + // Nothing to do + } +} + func createStatusBarItem(with statusMenu: StatusMenu) -> NSStatusItem { let statusItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.squareLength) if let statusBarImage = NSImage(named: "WireGuardMacStatusBarIcon") { |