aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoopesh Chander <roop@roopc.net>2018-12-14 16:33:31 +0530
committerRoopesh Chander <roop@roopc.net>2018-12-14 16:50:36 +0530
commit1eb3fd4de00ca26a1607f90aafc8fd03a5fc7c94 (patch)
tree83a7faeb7b715124ea320bc8b1756ec8fc973035
parentDeduplicate functions (diff)
downloadwireguard-apple-1eb3fd4de00ca26a1607f90aafc8fd03a5fc7c94.tar.xz
wireguard-apple-1eb3fd4de00ca26a1607f90aafc8fd03a5fc7c94.zip
Fix status switch weird state after an error occurs
Signed-off-by: Roopesh Chander <roop@roopc.net>
-rw-r--r--WireGuard/WireGuard/UI/iOS/TunnelDetail/TunnelDetailStatusCell.swift2
-rw-r--r--WireGuard/WireGuard/UI/iOS/TunnelList/TunnelListCell.swift2
2 files changed, 2 insertions, 2 deletions
diff --git a/WireGuard/WireGuard/UI/iOS/TunnelDetail/TunnelDetailStatusCell.swift b/WireGuard/WireGuard/UI/iOS/TunnelDetail/TunnelDetailStatusCell.swift
index 855e3ed2..0dd1ee9b 100644
--- a/WireGuard/WireGuard/UI/iOS/TunnelDetail/TunnelDetailStatusCell.swift
+++ b/WireGuard/WireGuard/UI/iOS/TunnelDetail/TunnelDetailStatusCell.swift
@@ -59,7 +59,7 @@ class TunnelDetailStatusCell: UITableViewCell {
text = "Waiting"
}
textLabel?.text = text
- DispatchQueue.main.async { [weak statusSwitch] in
+ DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(200)) { [weak statusSwitch] in
guard let statusSwitch = statusSwitch else { return }
statusSwitch.isOn = !(status == .deactivating || status == .inactive)
statusSwitch.isUserInteractionEnabled = (status == .inactive || status == .active)
diff --git a/WireGuard/WireGuard/UI/iOS/TunnelList/TunnelListCell.swift b/WireGuard/WireGuard/UI/iOS/TunnelList/TunnelListCell.swift
index 95055c51..f0a16bf4 100644
--- a/WireGuard/WireGuard/UI/iOS/TunnelList/TunnelListCell.swift
+++ b/WireGuard/WireGuard/UI/iOS/TunnelList/TunnelListCell.swift
@@ -82,7 +82,7 @@ class TunnelListCell: UITableViewCell {
reset()
return
}
- DispatchQueue.main.async { [weak statusSwitch, weak busyIndicator] in
+ DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(200)) { [weak statusSwitch, weak busyIndicator] in
guard let statusSwitch = statusSwitch, let busyIndicator = busyIndicator else { return }
statusSwitch.isOn = !(status == .deactivating || status == .inactive)
statusSwitch.isUserInteractionEnabled = (status == .inactive || status == .active)