From 147ac02f0d065e3f68261f2ee7394874ae5d970f Mon Sep 17 00:00:00 2001 From: Roopesh Chander Date: Wed, 28 Jul 2021 02:30:24 +0530 Subject: [PATCH] UI: iOS: Show on-demand state in 'Status' if there are on-demand rules Signed-off-by: Roopesh Chander --- Sources/WireGuardApp/Base.lproj/Localizable.strings | 1 + .../iOS/ViewController/TunnelDetailTableViewController.swift | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/Sources/WireGuardApp/Base.lproj/Localizable.strings b/Sources/WireGuardApp/Base.lproj/Localizable.strings index 87935d1..0e24ed3 100644 --- a/Sources/WireGuardApp/Base.lproj/Localizable.strings +++ b/Sources/WireGuardApp/Base.lproj/Localizable.strings @@ -57,6 +57,7 @@ "tunnelStatusWaiting" = "Waiting"; "tunnelStatusAddendumOnDemand" = " (On Demand)"; +"tunnelStatusOnDemandDisabled" = "On Demand Disabled"; "macToggleStatusButtonActivate" = "Activate"; "macToggleStatusButtonActivating" = "Activating…"; diff --git a/Sources/WireGuardApp/UI/iOS/ViewController/TunnelDetailTableViewController.swift b/Sources/WireGuardApp/UI/iOS/ViewController/TunnelDetailTableViewController.swift index 675adfd..196de0c 100644 --- a/Sources/WireGuardApp/UI/iOS/ViewController/TunnelDetailTableViewController.swift +++ b/Sources/WireGuardApp/UI/iOS/ViewController/TunnelDetailTableViewController.swift @@ -365,6 +365,11 @@ extension TunnelDetailTableViewController { cell.switchView.isUserInteractionEnabled = (status == .inactive || status == .active) cell.isEnabled = (status == .inactive || status == .active) } + + if tunnel.hasOnDemandRules && !isOnDemandEngaged && status == .inactive { + text = tr("tunnelStatusOnDemandDisabled") + } + cell.textLabel?.text = text }