Fix status switch weird state after an error occurs

This commit is contained in:
Roopesh Chander 2018-12-14 16:33:31 +05:30
parent 19f16c3291
commit ce112a3f44
2 changed files with 2 additions and 2 deletions

View File

@ -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)

View File

@ -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)