aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--WireGuard/WireGuard/Base.lproj/Localizable.strings4
-rw-r--r--WireGuard/WireGuard/UI/ActivateOnDemandViewModel.swift19
-rw-r--r--WireGuard/WireGuard/UI/iOS/ViewController/TunnelDetailTableViewController.swift2
-rw-r--r--WireGuard/WireGuard/UI/iOS/ViewController/TunnelEditTableViewController.swift2
4 files changed, 25 insertions, 2 deletions
diff --git a/WireGuard/WireGuard/Base.lproj/Localizable.strings b/WireGuard/WireGuard/Base.lproj/Localizable.strings
index de2a8c2f..32b792ff 100644
--- a/WireGuard/WireGuard/Base.lproj/Localizable.strings
+++ b/WireGuard/WireGuard/Base.lproj/Localizable.strings
@@ -89,6 +89,10 @@
"tunnelOnDemandAnySSID" = "Any SSID";
"tunnelOnDemandOnlySelectedSSIDs" = "Only selected SSIDs";
"tunnelOnDemandExceptSelectedSSIDs" = "Except selected SSIDs";
+"tunnelOnDemandOnlySSID (%d)" = "Only %d SSID";
+"tunnelOnDemandOnlySSIDs (%d)" = "Only %d SSIDs";
+"tunnelOnDemandExceptSSID (%d)" = "Except %d SSID";
+"tunnelOnDemandExceptSSIDs (%d)" = "Except %d SSIDs";
"tunnelOnDemandSSIDViewTitle" = "SSIDs";
"tunnelOnDemandSectionTitleSelectedSSIDs" = "SSIDs";
diff --git a/WireGuard/WireGuard/UI/ActivateOnDemandViewModel.swift b/WireGuard/WireGuard/UI/ActivateOnDemandViewModel.swift
index 2f13f074..c7d01739 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 {
diff --git a/WireGuard/WireGuard/UI/iOS/ViewController/TunnelDetailTableViewController.swift b/WireGuard/WireGuard/UI/iOS/ViewController/TunnelDetailTableViewController.swift
index abee8180..32393a9c 100644
--- a/WireGuard/WireGuard/UI/iOS/ViewController/TunnelDetailTableViewController.swift
+++ b/WireGuard/WireGuard/UI/iOS/ViewController/TunnelDetailTableViewController.swift
@@ -423,7 +423,7 @@ extension TunnelDetailTableViewController {
} else {
let cell: ChevronCell = tableView.dequeueReusableCell(for: indexPath)
cell.message = field.localizedUIString
- cell.detailMessage = onDemandViewModel.ssidOption.localizedUIString
+ cell.detailMessage = onDemandViewModel.localizedSSIDDescription
return cell
}
}
diff --git a/WireGuard/WireGuard/UI/iOS/ViewController/TunnelEditTableViewController.swift b/WireGuard/WireGuard/UI/iOS/ViewController/TunnelEditTableViewController.swift
index e5f322a3..943e7e5f 100644
--- a/WireGuard/WireGuard/UI/iOS/ViewController/TunnelEditTableViewController.swift
+++ b/WireGuard/WireGuard/UI/iOS/ViewController/TunnelEditTableViewController.swift
@@ -442,7 +442,7 @@ extension TunnelEditTableViewController {
} else {
let cell: ChevronCell = tableView.dequeueReusableCell(for: indexPath)
cell.message = field.localizedUIString
- cell.detailMessage = onDemandViewModel.ssidOption.localizedUIString
+ cell.detailMessage = onDemandViewModel.localizedSSIDDescription
return cell
}
}