TunnelsManager: startDeactivation() need not take a completion handler

Because the completion handler pattern doesn't fit in this case.
This commit is contained in:
Roopesh Chander 2018-11-10 12:25:17 +05:30
parent 97d8570d99
commit e6917a6075
3 changed files with 3 additions and 8 deletions

View File

@ -159,9 +159,7 @@ extension TunnelDetailTableViewController {
} }
} }
} else { } else {
s.tunnelsManager.startDeactivation(of: s.tunnel) { error in s.tunnelsManager.startDeactivation(of: s.tunnel)
print("Error while deactivating: \(String(describing: error))")
}
} }
} }
return cell return cell

View File

@ -287,9 +287,7 @@ extension TunnelsListTableViewController: UITableViewDataSource {
} }
} }
} else { } else {
tunnelsManager.startDeactivation(of: tunnel) { [weak s] error in tunnelsManager.startDeactivation(of: tunnel)
s?.showErrorAlert(title: "Deactivation error", message: "Error while bringing down tunnel: \(String(describing: error))")
}
} }
} }
} }

View File

@ -200,9 +200,8 @@ class TunnelsManager {
tunnel.startActivation(completionHandler: completionHandler) tunnel.startActivation(completionHandler: completionHandler)
} }
func startDeactivation(of tunnel: TunnelContainer, completionHandler: @escaping (Error?) -> Void) { func startDeactivation(of tunnel: TunnelContainer) {
if (tunnel.status == .inactive) { if (tunnel.status == .inactive) {
completionHandler(TunnelActivationError.attemptingDeactivationWhenTunnelIsInactive)
return return
} }
tunnel.startDeactivation() tunnel.startDeactivation()