Tunnel detail: Fix deletion of tunnel

Signed-off-by: Roopesh Chander <roop@roopc.net>
This commit is contained in:
Roopesh Chander 2018-11-01 15:54:37 +05:30
parent 040ce32015
commit 5138cdf9ea
1 changed files with 8 additions and 7 deletions

View File

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