]> git.ipfire.org Git - thirdparty/wireguard-apple.git/commitdiff
UI: iOS: disable list rows when no config
authorJason A. Donenfeld <Jason@zx2c4.com>
Wed, 22 Sep 2021 18:56:25 +0000 (20:56 +0200)
committerJason A. Donenfeld <Jason@zx2c4.com>
Wed, 22 Sep 2021 18:56:25 +0000 (20:56 +0200)
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Sources/WireGuardApp/UI/iOS/View/TunnelListCell.swift
Sources/WireGuardApp/UI/iOS/ViewController/TunnelsListTableViewController.swift

index 4dbe97cfa2fc906bac4843aa86e948bef0ea1b88..dcca9ec0477db2aaaf1d6ef3dd96bf40cd1988c7 100644 (file)
@@ -159,6 +159,10 @@ class TunnelListCell: UITableViewCell {
             statusSwitch.isUserInteractionEnabled = (status == .inactive || status == .active)
         }
 
+        if tunnel.tunnelConfiguration == nil {
+            statusSwitch.isUserInteractionEnabled = false
+            backgroundColor = .systemPink
+        }
     }
 
     private func reset(animated: Bool) {
index 85e64cea2eb825fad5f6fcbfb10f880de8cf2af2..29f93ced8d9b0c5a29bbcba02fa366a853fbdae1 100644 (file)
@@ -344,6 +344,7 @@ extension TunnelsListTableViewController: UITableViewDelegate {
         }
         guard let tunnelsManager = tunnelsManager else { return }
         let tunnel = tunnelsManager.tunnel(at: indexPath.row)
+        guard tunnel.tunnelConfiguration != nil else { return }
         showTunnelDetail(for: tunnel, animated: true)
     }