From 75ac9b30d0b21ed3af69069d0dfef38f69597680 Mon Sep 17 00:00:00 2001 From: Diego Rey Mendez Date: Fri, 20 Dec 2024 15:29:36 -0300 Subject: [PATCH] Addresses PR feedback --- .../Education/ControlCenterWidgetEducationView.swift | 6 +++--- .../VPNWidgetSupport/VPNWidgetTunnelController.swift | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/DuckDuckGo/Widgets/Education/ControlCenterWidgetEducationView.swift b/DuckDuckGo/Widgets/Education/ControlCenterWidgetEducationView.swift index 643098de37..f5382082c2 100644 --- a/DuckDuckGo/Widgets/Education/ControlCenterWidgetEducationView.swift +++ b/DuckDuckGo/Widgets/Education/ControlCenterWidgetEducationView.swift @@ -103,10 +103,10 @@ private extension Image { static let controlCenterBottom = Image("ControlCenterBottom") } -/* + @available(iOS 18.0, *) struct ControlCenterWidgetEducationView_Previews: PreviewProvider { static var previews: some View { - ControlCenterWidgetEducationView(navBarTitle: "Control Center") + ControlCenterWidgetEducationView(navBarTitle: "Control Center", widget: .vpnToggle) } -}*/ +} diff --git a/LocalPackages/VPNiOS/Sources/VPNWidgetSupport/VPNWidgetTunnelController.swift b/LocalPackages/VPNiOS/Sources/VPNWidgetSupport/VPNWidgetTunnelController.swift index 7bfad29d65..379457a8a7 100644 --- a/LocalPackages/VPNiOS/Sources/VPNWidgetSupport/VPNWidgetTunnelController.swift +++ b/LocalPackages/VPNiOS/Sources/VPNWidgetSupport/VPNWidgetTunnelController.swift @@ -70,11 +70,13 @@ public struct VPNWidgetTunnelController: Sendable { private func awaitUntilStatusIsNoLongerTransitioning(manager: NETunnelProviderManager) async throws { + let start = Date() + while true { try await Task.sleep(for: .milliseconds(500)) - if manager.connection.status != .connecting - && manager.connection.status != .disconnecting { + if start.timeIntervalSinceNow > 30 + || (manager.connection.status != .connecting && manager.connection.status != .disconnecting) { break }