diff options
author | Roopesh Chander <roop@roopc.net> | 2018-11-09 19:29:34 +0530 |
---|---|---|
committer | Roopesh Chander <roop@roopc.net> | 2018-11-09 19:29:34 +0530 |
commit | 1d63509b9224432c1a495c33fbf179123217eac4 (patch) | |
tree | 5f6c407ef5119bb96f76a4c18633f75eb394daa9 /WireGuard/WireGuard/UI/iOS | |
parent | Remove unused code (diff) | |
download | wireguard-apple-1d63509b9224432c1a495c33fbf179123217eac4.tar.xz wireguard-apple-1d63509b9224432c1a495c33fbf179123217eac4.zip |
VPN: Refresh tunnel statuses when app gets to the foreground
Because the tunnel could've be activated from iOS Settings now
Signed-off-by: Roopesh Chander <roop@roopc.net>
Diffstat (limited to 'WireGuard/WireGuard/UI/iOS')
-rw-r--r-- | WireGuard/WireGuard/UI/iOS/AppDelegate.swift | 4 | ||||
-rw-r--r-- | WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift | 10 |
2 files changed, 14 insertions, 0 deletions
diff --git a/WireGuard/WireGuard/UI/iOS/AppDelegate.swift b/WireGuard/WireGuard/UI/iOS/AppDelegate.swift index 4e09650..fabdae9 100644 --- a/WireGuard/WireGuard/UI/iOS/AppDelegate.swift +++ b/WireGuard/WireGuard/UI/iOS/AppDelegate.swift @@ -37,4 +37,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate { mainVC?.tunnelsListVC?.importFromFile(url: url) return true } + + func applicationDidBecomeActive(_ application: UIApplication) { + mainVC?.tunnelsListVC?.refreshTunnelConnectionStatuses() + } } diff --git a/WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift b/WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift index d40eef7..a9d858e 100644 --- a/WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift +++ b/WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift @@ -223,6 +223,16 @@ class TunnelsListTableViewController: UIViewController { } } } + + func refreshTunnelConnectionStatuses() { + if let tunnelsManager = tunnelsManager { + tunnelsManager.refreshConnectionStatuses() + } else { + onTunnelsManagerReady = { tunnelsManager in + tunnelsManager.refreshConnectionStatuses() + } + } + } } // MARK: UIDocumentPickerDelegate |