aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard/UI/iOS
diff options
context:
space:
mode:
authorRoopesh Chander <roop@roopc.net>2018-12-07 11:49:10 +0530
committerRoopesh Chander <roop@roopc.net>2018-12-07 12:36:23 +0530
commit05d0429c501185c53830d00f04a70a59eba93b81 (patch)
treea6d8e31945c34a0657a161014ecf55d65ce3c51f /WireGuard/WireGuard/UI/iOS
parentSettings: Exporting configs as zip should open document picker (diff)
downloadwireguard-apple-05d0429c501185c53830d00f04a70a59eba93b81.tar.xz
wireguard-apple-05d0429c501185c53830d00f04a70a59eba93b81.zip
Tunnels list: Deselect rows correctly
Do it like UITableViewController.clearsSelectionOnViewWillAppear would. Signed-off-by: Roopesh Chander <roop@roopc.net>
Diffstat (limited to 'WireGuard/WireGuard/UI/iOS')
-rw-r--r--WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift8
1 files changed, 7 insertions, 1 deletions
diff --git a/WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift b/WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift
index 4cff27c..f558de4 100644
--- a/WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift
+++ b/WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift
@@ -91,6 +91,13 @@ class TunnelsListTableViewController: UIViewController {
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) {
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)
@@ -254,7 +261,6 @@ extension TunnelsListTableViewController: UITableViewDataSource {
extension TunnelsListTableViewController: UITableViewDelegate {
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
- tableView.deselectRow(at: indexPath, animated: true)
guard let tunnelsManager = tunnelsManager else { return }
let tunnel = tunnelsManager.tunnel(at: indexPath.row)
let tunnelDetailVC = TunnelDetailTableViewController(tunnelsManager: tunnelsManager,