Tunnel detail: iPad: Handle deletion of tunnel correctly
This commit is contained in:
parent
939e96e5c1
commit
01ea8f5f30
|
@ -243,14 +243,21 @@ extension TunnelDetailTableViewController {
|
||||||
cell.onTapped = { [weak self] in
|
cell.onTapped = { [weak self] in
|
||||||
guard let self = self else { return }
|
guard let self = self else { return }
|
||||||
self.showConfirmationAlert(message: "Delete this tunnel?", buttonTitle: "Delete", from: cell) { [weak self] in
|
self.showConfirmationAlert(message: "Delete this tunnel?", buttonTitle: "Delete", from: cell) { [weak self] in
|
||||||
guard let tunnelsManager = self?.tunnelsManager, let tunnel = self?.tunnel else { return }
|
guard let self = self else { return }
|
||||||
tunnelsManager.remove(tunnel: tunnel) { error in
|
self.tunnelsManager.remove(tunnel: self.tunnel) { error in
|
||||||
if error != nil {
|
if error != nil {
|
||||||
print("Error removing tunnel: \(String(describing: error))")
|
print("Error removing tunnel: \(String(describing: error))")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self?.navigationController?.navigationController?.popToRootViewController(animated: true)
|
if self.splitViewController?.isCollapsed ?? true {
|
||||||
|
self.navigationController?.navigationController?.popToRootViewController(animated: true)
|
||||||
|
} else {
|
||||||
|
let detailVC = UIViewController()
|
||||||
|
detailVC.view.backgroundColor = .white
|
||||||
|
let detailNC = UINavigationController(rootViewController: detailVC)
|
||||||
|
self.showDetailViewController(detailNC, sender: self)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return cell
|
return cell
|
||||||
|
|
Loading…
Reference in New Issue