aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard/UI/macOS/ViewController/TunnelDetailTableViewController.swift
diff options
context:
space:
mode:
authorRoopesh Chander <roop@roopc.net>2019-01-09 04:14:08 +0530
committerRoopesh Chander <roop@roopc.net>2019-01-14 14:52:36 +0530
commit13e8c6b1780eab5bd7257ba79020651e421f099c (patch)
tree0478cdfc35591b0785532d70aeeb66689ebdfb6d /WireGuard/WireGuard/UI/macOS/ViewController/TunnelDetailTableViewController.swift
parentmacOS: Quit menu item (diff)
downloadwireguard-apple-13e8c6b1780eab5bd7257ba79020651e421f099c.tar.xz
wireguard-apple-13e8c6b1780eab5bd7257ba79020651e421f099c.zip
macOS: Support for on-demand activation
Signed-off-by: Roopesh Chander <roop@roopc.net>
Diffstat (limited to '')
-rw-r--r--WireGuard/WireGuard/UI/macOS/ViewController/TunnelDetailTableViewController.swift11
1 files changed, 11 insertions, 0 deletions
diff --git a/WireGuard/WireGuard/UI/macOS/ViewController/TunnelDetailTableViewController.swift b/WireGuard/WireGuard/UI/macOS/ViewController/TunnelDetailTableViewController.swift
index 3c070606..5f6c891b 100644
--- a/WireGuard/WireGuard/UI/macOS/ViewController/TunnelDetailTableViewController.swift
+++ b/WireGuard/WireGuard/UI/macOS/ViewController/TunnelDetailTableViewController.swift
@@ -8,12 +8,14 @@ class TunnelDetailTableViewController: NSViewController {
private enum TableViewModelRow {
case interfaceFieldRow(TunnelViewModel.InterfaceField)
case peerFieldRow(peer: TunnelViewModel.PeerData, field: TunnelViewModel.PeerField)
+ case onDemandRow
case spacerRow
func localizedSectionKeyString() -> String {
switch self {
case .interfaceFieldRow: return tr("tunnelSectionTitleInterface")
case .peerFieldRow: return tr("tunnelSectionTitlePeer")
+ case .onDemandRow: return ""
case .spacerRow: return ""
}
}
@@ -22,6 +24,7 @@ class TunnelDetailTableViewController: NSViewController {
switch self {
case .interfaceFieldRow(let field): return field == .name
case .peerFieldRow(_, let field): return field == .publicKey
+ case .onDemandRow: return true
case .spacerRow: return false
}
}
@@ -163,6 +166,8 @@ class TunnelDetailTableViewController: NSViewController {
tableViewModelRows.append(.peerFieldRow(peer: peerData, field: field))
}
}
+ tableViewModelRows.append(.spacerRow)
+ tableViewModelRows.append(.onDemandRow)
}
func updateStatus() {
@@ -232,6 +237,12 @@ extension TunnelDetailTableViewController: NSTableViewDelegate {
return cell
case .spacerRow:
return NSView()
+ case .onDemandRow:
+ let cell: KeyValueRow = tableView.dequeueReusableCell()
+ cell.key = tr("macFieldOnDemand")
+ cell.value = TunnelViewModel.activateOnDemandDetailText(for: tunnel.activateOnDemandSetting)
+ cell.isKeyInBold = true
+ return cell
}
}
}