From e6917a60753e53903c509d0ce362fbd10766ba69 Mon Sep 17 00:00:00 2001 From: Roopesh Chander Date: Sat, 10 Nov 2018 12:25:17 +0530 Subject: [PATCH] TunnelsManager: startDeactivation() need not take a completion handler Because the completion handler pattern doesn't fit in this case. --- .../WireGuard/UI/iOS/TunnelDetailTableViewController.swift | 4 +--- .../WireGuard/UI/iOS/TunnelsListTableViewController.swift | 4 +--- WireGuard/WireGuard/VPN/TunnelsManager.swift | 3 +-- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/WireGuard/WireGuard/UI/iOS/TunnelDetailTableViewController.swift b/WireGuard/WireGuard/UI/iOS/TunnelDetailTableViewController.swift index 76a38e3..5209b3a 100644 --- a/WireGuard/WireGuard/UI/iOS/TunnelDetailTableViewController.swift +++ b/WireGuard/WireGuard/UI/iOS/TunnelDetailTableViewController.swift @@ -159,9 +159,7 @@ extension TunnelDetailTableViewController { } } } else { - s.tunnelsManager.startDeactivation(of: s.tunnel) { error in - print("Error while deactivating: \(String(describing: error))") - } + s.tunnelsManager.startDeactivation(of: s.tunnel) } } return cell diff --git a/WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift b/WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift index a9d858e..ba61743 100644 --- a/WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift +++ b/WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift @@ -287,9 +287,7 @@ extension TunnelsListTableViewController: UITableViewDataSource { } } } else { - tunnelsManager.startDeactivation(of: tunnel) { [weak s] error in - s?.showErrorAlert(title: "Deactivation error", message: "Error while bringing down tunnel: \(String(describing: error))") - } + tunnelsManager.startDeactivation(of: tunnel) } } } diff --git a/WireGuard/WireGuard/VPN/TunnelsManager.swift b/WireGuard/WireGuard/VPN/TunnelsManager.swift index a5e94a8..d07f439 100644 --- a/WireGuard/WireGuard/VPN/TunnelsManager.swift +++ b/WireGuard/WireGuard/VPN/TunnelsManager.swift @@ -200,9 +200,8 @@ class TunnelsManager { tunnel.startActivation(completionHandler: completionHandler) } - func startDeactivation(of tunnel: TunnelContainer, completionHandler: @escaping (Error?) -> Void) { + func startDeactivation(of tunnel: TunnelContainer) { if (tunnel.status == .inactive) { - completionHandler(TunnelActivationError.attemptingDeactivationWhenTunnelIsInactive) return } tunnel.startDeactivation()