aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard/UI/ActivateOnDemandViewModel.swift
diff options
context:
space:
mode:
authorRoopesh Chander <roop@roopc.net>2019-03-09 15:35:49 +0530
committerJason A. Donenfeld <Jason@zx2c4.com>2019-03-18 06:46:55 +0100
commitb7f8f74b5698f120ce22c79c32ccfc6fdb37252f (patch)
tree2ae30e6aab44bf263b66293b03316b8ec61350d5 /WireGuard/WireGuard/UI/ActivateOnDemandViewModel.swift
parenton-demand: iOS: Show list of SSIDs in a separate screen (diff)
downloadwireguard-apple-b7f8f74b5698f120ce22c79c32ccfc6fdb37252f.tar.xz
wireguard-apple-b7f8f74b5698f120ce22c79c32ccfc6fdb37252f.zip
on-demand: iOS: Only n SSIDs / Except m SSIDs
Signed-off-by: Roopesh Chander <roop@roopc.net>
Diffstat (limited to 'WireGuard/WireGuard/UI/ActivateOnDemandViewModel.swift')
-rw-r--r--WireGuard/WireGuard/UI/ActivateOnDemandViewModel.swift19
1 files changed, 19 insertions, 0 deletions
diff --git a/WireGuard/WireGuard/UI/ActivateOnDemandViewModel.swift b/WireGuard/WireGuard/UI/ActivateOnDemandViewModel.swift
index 2f13f07..c7d0173 100644
--- a/WireGuard/WireGuard/UI/ActivateOnDemandViewModel.swift
+++ b/WireGuard/WireGuard/UI/ActivateOnDemandViewModel.swift
@@ -130,6 +130,25 @@ extension ActivateOnDemandViewModel {
}
}
+ var localizedSSIDDescription: String {
+ guard isWiFiInterfaceEnabled else { return "" }
+ switch ssidOption {
+ case .anySSID: return tr("tunnelOnDemandAnySSID")
+ case .onlySpecificSSIDs:
+ if selectedSSIDs.count == 1 {
+ return tr(format: "tunnelOnDemandOnlySSID (%d)", selectedSSIDs.count)
+ } else {
+ return tr(format: "tunnelOnDemandOnlySSIDs (%d)", selectedSSIDs.count)
+ }
+ case .exceptSpecificSSIDs:
+ if selectedSSIDs.count == 1 {
+ return tr(format: "tunnelOnDemandExceptSSID (%d)", selectedSSIDs.count)
+ } else {
+ return tr(format: "tunnelOnDemandExceptSSIDs (%d)", selectedSSIDs.count)
+ }
+ }
+ }
+
func fixSSIDOption() {
selectedSSIDs = uniquifiedNonEmptySelectedSSIDs()
if selectedSSIDs.isEmpty {