From 86afd1a46a83038a787176272a7c486b7269e1a3 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Wed, 22 Sep 2021 20:56:25 +0200 Subject: [PATCH] UI: iOS: disable list rows when no config Signed-off-by: Jason A. Donenfeld --- Sources/WireGuardApp/UI/iOS/View/TunnelListCell.swift | 4 ++++ .../iOS/ViewController/TunnelsListTableViewController.swift | 1 + 2 files changed, 5 insertions(+) diff --git a/Sources/WireGuardApp/UI/iOS/View/TunnelListCell.swift b/Sources/WireGuardApp/UI/iOS/View/TunnelListCell.swift index 4dbe97c..dcca9ec 100644 --- a/Sources/WireGuardApp/UI/iOS/View/TunnelListCell.swift +++ b/Sources/WireGuardApp/UI/iOS/View/TunnelListCell.swift @@ -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) { diff --git a/Sources/WireGuardApp/UI/iOS/ViewController/TunnelsListTableViewController.swift b/Sources/WireGuardApp/UI/iOS/ViewController/TunnelsListTableViewController.swift index 85e64ce..29f93ce 100644 --- a/Sources/WireGuardApp/UI/iOS/ViewController/TunnelsListTableViewController.swift +++ b/Sources/WireGuardApp/UI/iOS/ViewController/TunnelsListTableViewController.swift @@ -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) }