aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard/UI/iOS/ViewController/TunnelsListTableViewController.swift
diff options
context:
space:
mode:
Diffstat (limited to 'WireGuard/WireGuard/UI/iOS/ViewController/TunnelsListTableViewController.swift')
-rw-r--r--WireGuard/WireGuard/UI/iOS/ViewController/TunnelsListTableViewController.swift14
1 files changed, 14 insertions, 0 deletions
diff --git a/WireGuard/WireGuard/UI/iOS/ViewController/TunnelsListTableViewController.swift b/WireGuard/WireGuard/UI/iOS/ViewController/TunnelsListTableViewController.swift
index 058063d1..6a2f3a1c 100644
--- a/WireGuard/WireGuard/UI/iOS/ViewController/TunnelsListTableViewController.swift
+++ b/WireGuard/WireGuard/UI/iOS/ViewController/TunnelsListTableViewController.swift
@@ -252,7 +252,21 @@ extension TunnelsListTableViewController: TunnelsManagerListDelegate {
}
func tunnelRemoved(at index: Int) {
+ let selectedIndex = tableView.indexPathForSelectedRow?.row
tableView.deleteRows(at: [IndexPath(row: index, section: 0)], with: .automatic)
centeredAddButton.isHidden = tunnelsManager?.numberOfTunnels() ?? 0 > 0
+ if let selectedIndex = selectedIndex, selectedIndex == index, let splitViewController = splitViewController {
+ if splitViewController.isCollapsed != false {
+ (splitViewController.viewControllers[0] as? UINavigationController)?.popViewController(animated: false)
+ } else {
+ let detailVC = UIViewController()
+ detailVC.view.backgroundColor = .white
+ let detailNC = UINavigationController(rootViewController: detailVC)
+ splitViewController.showDetailViewController(detailNC, sender: self)
+ }
+ if let presentedNavController = self.presentedViewController as? UINavigationController, presentedNavController.viewControllers.first is TunnelEditTableViewController {
+ self.presentedViewController?.dismiss(animated: false, completion: nil)
+ }
+ }
}
}