Tunnels list: Deselect rows correctly
Do it like UITableViewController.clearsSelectionOnViewWillAppear would.
This commit is contained in:
parent
c3a3effd82
commit
800cb8559e
|
@ -91,6 +91,13 @@ class TunnelsListTableViewController: UIViewController {
|
||||||
tunnelsManager.tunnelsListDelegate = self
|
tunnelsManager.tunnelsListDelegate = self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override func viewWillAppear(_: Bool) {
|
||||||
|
// Remove selection when getting back to the list view on iPhone
|
||||||
|
if let tableView = self.tableView, let selectedRowIndexPath = tableView.indexPathForSelectedRow {
|
||||||
|
tableView.deselectRow(at: selectedRowIndexPath, animated: false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@objc func addButtonTapped(sender: AnyObject) {
|
@objc func addButtonTapped(sender: AnyObject) {
|
||||||
if (self.tunnelsManager == nil) { return } // Do nothing until we've loaded the tunnels
|
if (self.tunnelsManager == nil) { return } // Do nothing until we've loaded the tunnels
|
||||||
let alert = UIAlertController(title: "", message: "Add a new WireGuard tunnel", preferredStyle: .actionSheet)
|
let alert = UIAlertController(title: "", message: "Add a new WireGuard tunnel", preferredStyle: .actionSheet)
|
||||||
|
@ -254,7 +261,6 @@ extension TunnelsListTableViewController: UITableViewDataSource {
|
||||||
|
|
||||||
extension TunnelsListTableViewController: UITableViewDelegate {
|
extension TunnelsListTableViewController: UITableViewDelegate {
|
||||||
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
||||||
tableView.deselectRow(at: indexPath, animated: true)
|
|
||||||
guard let tunnelsManager = tunnelsManager else { return }
|
guard let tunnelsManager = tunnelsManager else { return }
|
||||||
let tunnel = tunnelsManager.tunnel(at: indexPath.row)
|
let tunnel = tunnelsManager.tunnel(at: indexPath.row)
|
||||||
let tunnelDetailVC = TunnelDetailTableViewController(tunnelsManager: tunnelsManager,
|
let tunnelDetailVC = TunnelDetailTableViewController(tunnelsManager: tunnelsManager,
|
||||||
|
|
Loading…
Reference in New Issue