WireGuardApp: Remove 200ms delay when updating tunnel status switch
Signed-off-by: Andrej Mihajlov <and@mullvad.net>
This commit is contained in:
parent
facf776602
commit
5d2a337332
|
@ -87,8 +87,6 @@ class TunnelListCell: UITableViewCell {
|
||||||
reset()
|
reset()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
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.isOn = !(status == .deactivating || status == .inactive)
|
||||||
statusSwitch.isUserInteractionEnabled = (status == .inactive || status == .active)
|
statusSwitch.isUserInteractionEnabled = (status == .inactive || status == .active)
|
||||||
if status == .inactive || status == .active {
|
if status == .inactive || status == .active {
|
||||||
|
@ -97,7 +95,6 @@ class TunnelListCell: UITableViewCell {
|
||||||
busyIndicator.startAnimating()
|
busyIndicator.startAnimating()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
required init?(coder aDecoder: NSCoder) {
|
required init?(coder aDecoder: NSCoder) {
|
||||||
fatalError("init(coder:) has not been implemented")
|
fatalError("init(coder:) has not been implemented")
|
||||||
|
|
|
@ -343,10 +343,8 @@ extension TunnelDetailTableViewController {
|
||||||
text = tr("tunnelStatusWaiting")
|
text = tr("tunnelStatusWaiting")
|
||||||
}
|
}
|
||||||
cell.textLabel?.text = text
|
cell.textLabel?.text = text
|
||||||
DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(200)) { [weak cell] in
|
cell.switchView.isOn = !(status == .deactivating || status == .inactive)
|
||||||
cell?.switchView.isOn = !(status == .deactivating || status == .inactive)
|
cell.switchView.isUserInteractionEnabled = (status == .inactive || status == .active)
|
||||||
cell?.switchView.isUserInteractionEnabled = (status == .inactive || status == .active)
|
|
||||||
}
|
|
||||||
cell.isEnabled = status == .active || status == .inactive
|
cell.isEnabled = status == .active || status == .inactive
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue