summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@mullvad.net>2020-07-29 16:38:06 +0300
committerAndrej Mihajlov <and@mullvad.net>2020-07-30 09:50:25 +0300
commit5b38230cc4da005f5433cbe7a4046747f30f2dd5 (patch)
tree4d3c199eae04be55d7b2f501848d6ce59b65941f
parented79f32d0e469e7ac347e30b3b9509e0c0abcb51 (diff)
downloadmullvadvpn-5b38230cc4da005f5433cbe7a4046747f30f2dd5.tar.xz
mullvadvpn-5b38230cc4da005f5433cbe7a4046747f30f2dd5.zip
Make completion handler optional
-rw-r--r--ios/MullvadVPN/ConnectViewController.swift8
-rw-r--r--ios/MullvadVPN/TunnelManager.swift4
2 files changed, 7 insertions, 5 deletions
diff --git a/ios/MullvadVPN/ConnectViewController.swift b/ios/MullvadVPN/ConnectViewController.swift
index 41797054e1..53e5fd47ab 100644
--- a/ios/MullvadVPN/ConnectViewController.swift
+++ b/ios/MullvadVPN/ConnectViewController.swift
@@ -250,6 +250,10 @@ class ConnectViewController: UIViewController, RootContainment, TunnelObserver,
}
}
+ private func reconnectTunnel() {
+ TunnelManager.shared.reconnectTunnel(completionHandler: nil)
+ }
+
private func showAccountViewForExpiredAccount() {
guard !showedAccountView else { return }
@@ -290,9 +294,7 @@ class ConnectViewController: UIViewController, RootContainment, TunnelObserver,
}
@objc func handleReconnect(_ sender: Any) {
- TunnelManager.shared.reconnectTunnel {
- // TODO:
- }
+ reconnectTunnel()
}
@objc func handleSelectLocation(_ sender: Any) {
diff --git a/ios/MullvadVPN/TunnelManager.swift b/ios/MullvadVPN/TunnelManager.swift
index e21ad3a16f..f45daca22a 100644
--- a/ios/MullvadVPN/TunnelManager.swift
+++ b/ios/MullvadVPN/TunnelManager.swift
@@ -435,7 +435,7 @@ class TunnelManager {
exclusityController.addOperation(operation, categories: [.tunnelControl])
}
- func reconnectTunnel(completionHandler: @escaping () -> Void) {
+ func reconnectTunnel(completionHandler: (() -> Void)?) {
let operation = AsyncBlockOperation { (finish) in
guard let tunnelIpc = self.tunnelIpc else {
finish()
@@ -451,7 +451,7 @@ class TunnelManager {
}
operation.addDidFinishBlockObserver { (operation) in
- completionHandler()
+ completionHandler?()
}
exclusityController.addOperation(operation, categories: [.tunnelControl])