]> git.ipfire.org Git - thirdparty/wireguard-apple.git/commitdiff
WireGuardApp: Remove 200ms delay when updating tunnel status switch
authorAndrej Mihajlov <and@mullvad.net>
Tue, 15 Dec 2020 11:41:26 +0000 (12:41 +0100)
committerJason A. Donenfeld <Jason@zx2c4.com>
Tue, 15 Dec 2020 14:56:22 +0000 (15:56 +0100)
Signed-off-by: Andrej Mihajlov <and@mullvad.net>
Sources/WireGuardApp/UI/iOS/View/TunnelListCell.swift
Sources/WireGuardApp/UI/iOS/ViewController/TunnelDetailTableViewController.swift

index 9d8cc82d6668d06a60238d567b8bb4b3b92ffaae..1a8520da8f118bbfd99da9640472c8c5d4ee596a 100644 (file)
@@ -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()
         }
     }
 
index 6d9619a6459cb18f059faf40ad74c5cf65260c13..696136f8a2b27d2834513d0edbe9098e1136fab1 100644 (file)
@@ -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
         }