aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard/UI/macOS/ViewController
diff options
context:
space:
mode:
Diffstat (limited to 'WireGuard/WireGuard/UI/macOS/ViewController')
-rw-r--r--WireGuard/WireGuard/UI/macOS/ViewController/TunnelDetailTableViewController.swift4
-rw-r--r--WireGuard/WireGuard/UI/macOS/ViewController/TunnelEditViewController.swift15
2 files changed, 6 insertions, 13 deletions
diff --git a/WireGuard/WireGuard/UI/macOS/ViewController/TunnelDetailTableViewController.swift b/WireGuard/WireGuard/UI/macOS/ViewController/TunnelDetailTableViewController.swift
index 1cb9e2a..152cbda 100644
--- a/WireGuard/WireGuard/UI/macOS/ViewController/TunnelDetailTableViewController.swift
+++ b/WireGuard/WireGuard/UI/macOS/ViewController/TunnelDetailTableViewController.swift
@@ -97,7 +97,7 @@ class TunnelDetailTableViewController: NSViewController {
self.tunnelsManager = tunnelsManager
self.tunnel = tunnel
tunnelViewModel = TunnelViewModel(tunnelConfiguration: tunnel.tunnelConfiguration)
- onDemandViewModel = ActivateOnDemandViewModel(setting: tunnel.activateOnDemandSetting)
+ onDemandViewModel = ActivateOnDemandViewModel(option: tunnel.onDemandOption)
super.init(nibName: nil, bundle: nil)
updateTableViewModelRowsBySection()
updateTableViewModelRows()
@@ -492,7 +492,7 @@ extension TunnelDetailTableViewController: NSTableViewDelegate {
extension TunnelDetailTableViewController: TunnelEditViewControllerDelegate {
func tunnelSaved(tunnel: TunnelContainer) {
tunnelViewModel = TunnelViewModel(tunnelConfiguration: tunnel.tunnelConfiguration)
- onDemandViewModel = ActivateOnDemandViewModel(setting: tunnel.activateOnDemandSetting)
+ onDemandViewModel = ActivateOnDemandViewModel(option: tunnel.onDemandOption)
updateTableViewModelRowsBySection()
updateTableViewModelRows()
updateStatus()
diff --git a/WireGuard/WireGuard/UI/macOS/ViewController/TunnelEditViewController.swift b/WireGuard/WireGuard/UI/macOS/ViewController/TunnelEditViewController.swift
index 51b1944..d3c76f5 100644
--- a/WireGuard/WireGuard/UI/macOS/ViewController/TunnelEditViewController.swift
+++ b/WireGuard/WireGuard/UI/macOS/ViewController/TunnelEditViewController.swift
@@ -84,13 +84,6 @@ class TunnelEditViewController: NSViewController {
return button
}()
- let activateOnDemandOptions: [ActivateOnDemandOption] = [
- .none,
- .anyInterface(.anySSID),
- .wiFiInterfaceOnly(.anySSID),
- .nonWiFiInterfaceOnly
- ]
-
let tunnelsManager: TunnelsManager
let tunnel: TunnelContainer?
var onDemandViewModel: ActivateOnDemandViewModel
@@ -106,7 +99,7 @@ class TunnelEditViewController: NSViewController {
init(tunnelsManager: TunnelsManager, tunnel: TunnelContainer?) {
self.tunnelsManager = tunnelsManager
self.tunnel = tunnel
- self.onDemandViewModel = tunnel != nil ? ActivateOnDemandViewModel(setting: tunnel!.activateOnDemandSetting) : ActivateOnDemandViewModel()
+ self.onDemandViewModel = tunnel != nil ? ActivateOnDemandViewModel(option: tunnel!.onDemandOption) : ActivateOnDemandViewModel()
super.init(nibName: nil, bundle: nil)
}
@@ -223,7 +216,7 @@ class TunnelEditViewController: NSViewController {
onDemandViewModel.isNonWiFiInterfaceEnabled = onDemandEthernetCheckbox.state == .on
onDemandWiFiControls.saveToViewModel()
- let onDemandSetting = ActivateOnDemandSetting(with: onDemandViewModel.toOnDemandOption())
+ let onDemandOption = onDemandViewModel.toOnDemandOption()
let isTunnelModifiedWithoutChangingName = (tunnel != nil && tunnel!.name == name)
guard isTunnelModifiedWithoutChangingName || tunnelsManager.tunnel(named: name) == nil else {
@@ -259,7 +252,7 @@ class TunnelEditViewController: NSViewController {
if let tunnel = tunnel {
// We're modifying an existing tunnel
- tunnelsManager.modify(tunnel: tunnel, tunnelConfiguration: tunnelConfiguration, activateOnDemandSetting: onDemandSetting) { [weak self] error in
+ tunnelsManager.modify(tunnel: tunnel, tunnelConfiguration: tunnelConfiguration, onDemandOption: onDemandOption) { [weak self] error in
self?.setUserInteractionEnabled(true)
if let error = error {
ErrorPresenter.showErrorAlert(error: error, from: self)
@@ -271,7 +264,7 @@ class TunnelEditViewController: NSViewController {
} else {
// We're creating a new tunnel
AppStorePrivacyNotice.show(from: self, into: tunnelsManager) { [weak self] in
- self?.tunnelsManager.add(tunnelConfiguration: tunnelConfiguration, activateOnDemandSetting: onDemandSetting) { [weak self] result in
+ self?.tunnelsManager.add(tunnelConfiguration: tunnelConfiguration, onDemandOption: onDemandOption) { [weak self] result in
self?.setUserInteractionEnabled(true)
if let error = result.error {
ErrorPresenter.showErrorAlert(error: error, from: self)