Tunnel detail: Fix deletion of tunnel

This commit is contained in:
Roopesh Chander 2018-11-01 15:54:37 +05:30
parent d62c1fd84a
commit 1889614157
1 changed files with 8 additions and 7 deletions

View File

@ -204,14 +204,15 @@ extension TunnelDetailTableViewController {
cell.buttonText = "Delete tunnel" cell.buttonText = "Delete tunnel"
cell.onTapped = { [weak self] in cell.onTapped = { [weak self] in
guard let s = self else { return } guard let s = self else { return }
s.tunnelsManager.remove(tunnel: s.tunnel) { (error) in s.showConfirmationAlert(message: "Delete this tunnel?", buttonTitle: "Delete", from: cell) { [weak s] in
if (error != nil) { guard let tunnelsManager = s?.tunnelsManager, let tunnel = s?.tunnel else { return }
print("Error removing tunnel: \(String(describing: error))") tunnelsManager.remove(tunnel: tunnel) { (error) in
return if (error != nil) {
} print("Error removing tunnel: \(String(describing: error))")
s.showConfirmationAlert(message: "Delete this tunnel?", buttonTitle: "Delete", from: cell) { [weak s] in return
s?.navigationController?.navigationController?.popToRootViewController(animated: true) }
} }
s?.navigationController?.navigationController?.popToRootViewController(animated: true)
} }
} }
return cell return cell