diff options
author | Andrej Mihajlov <and@mullvad.net> | 2020-12-15 12:41:26 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2020-12-15 15:56:22 +0100 |
commit | 5d2a33733229cd108cd4bef422197b0f2583d758 (patch) | |
tree | a343f62d00f560cef4e9acf0e1454b355013ca41 | |
parent | WireGuardApp: Pin status switch to cell margin (diff) | |
download | wireguard-apple-5d2a33733229cd108cd4bef422197b0f2583d758.tar.xz wireguard-apple-5d2a33733229cd108cd4bef422197b0f2583d758.zip |
WireGuardApp: Remove 200ms delay when updating tunnel status switch
Signed-off-by: Andrej Mihajlov <and@mullvad.net>
-rw-r--r-- | Sources/WireGuardApp/UI/iOS/View/TunnelListCell.swift | 15 | ||||
-rw-r--r-- | Sources/WireGuardApp/UI/iOS/ViewController/TunnelDetailTableViewController.swift | 6 |
2 files changed, 8 insertions, 13 deletions
diff --git a/Sources/WireGuardApp/UI/iOS/View/TunnelListCell.swift b/Sources/WireGuardApp/UI/iOS/View/TunnelListCell.swift index 9d8cc82..1a8520d 100644 --- a/Sources/WireGuardApp/UI/iOS/View/TunnelListCell.swift +++ b/Sources/WireGuardApp/UI/iOS/View/TunnelListCell.swift @@ -87,15 +87,12 @@ class TunnelListCell: UITableViewCell { reset() 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.isUserInteractionEnabled = (status == .inactive || status == .active) - if status == .inactive || status == .active { - busyIndicator.stopAnimating() - } else { - busyIndicator.startAnimating() - } + statusSwitch.isOn = !(status == .deactivating || status == .inactive) + statusSwitch.isUserInteractionEnabled = (status == .inactive || status == .active) + if status == .inactive || status == .active { + busyIndicator.stopAnimating() + } else { + busyIndicator.startAnimating() } } diff --git a/Sources/WireGuardApp/UI/iOS/ViewController/TunnelDetailTableViewController.swift b/Sources/WireGuardApp/UI/iOS/ViewController/TunnelDetailTableViewController.swift index 6d9619a..696136f 100644 --- a/Sources/WireGuardApp/UI/iOS/ViewController/TunnelDetailTableViewController.swift +++ b/Sources/WireGuardApp/UI/iOS/ViewController/TunnelDetailTableViewController.swift @@ -343,10 +343,8 @@ extension TunnelDetailTableViewController { text = tr("tunnelStatusWaiting") } cell.textLabel?.text = text - DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(200)) { [weak cell] in - cell?.switchView.isOn = !(status == .deactivating || status == .inactive) - cell?.switchView.isUserInteractionEnabled = (status == .inactive || status == .active) - } + cell.switchView.isOn = !(status == .deactivating || status == .inactive) + cell.switchView.isUserInteractionEnabled = (status == .inactive || status == .active) cell.isEnabled = status == .active || status == .inactive } |