diff options
author | Roopesh Chander <roop@roopc.net> | 2018-12-11 17:48:34 +0530 |
---|---|---|
committer | Roopesh Chander <roop@roopc.net> | 2018-12-11 17:52:54 +0530 |
commit | bde984625cf935162404387c184030b44b8de02d (patch) | |
tree | 0cbbb55d953e6656b67e6b148dde47500d1a4f29 | |
parent | TunnelsManager: Error out only on no-internet scenario (diff) | |
download | wireguard-apple-bde984625cf935162404387c184030b44b8de02d.tar.xz wireguard-apple-bde984625cf935162404387c184030b44b8de02d.zip |
State restoration: Don't create duplicate mainVC and tunnelsListVC
This creates a duplicate tunnels manager, leading to problems tracking
tunnel statuses.
To reproduce the bug that this commit fixes, you can do the following:
1. Remove all tunnels
2. Run in Xcode
3. Import zip with ~10 tunnels
4. Stop app in Xcode
5. Run in Xcode
6. Turn on 1st tunnel, after it's on, turn off
Turn on 2nd tunnel, after it's on, turn off
...
After 6-8 tunnels, the spinner doesn't show up, indicating that the
status is not being tracked.
Signed-off-by: Roopesh Chander <roop@roopc.net>
Diffstat (limited to '')
-rw-r--r-- | WireGuard/WireGuard/UI/iOS/AppDelegate.swift | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/WireGuard/WireGuard/UI/iOS/AppDelegate.swift b/WireGuard/WireGuard/UI/iOS/AppDelegate.swift index 3116f7a..5dca2ad 100644 --- a/WireGuard/WireGuard/UI/iOS/AppDelegate.swift +++ b/WireGuard/WireGuard/UI/iOS/AppDelegate.swift @@ -52,11 +52,7 @@ extension AppDelegate { viewControllerWithRestorationIdentifierPath identifierComponents: [String], coder: NSCoder) -> UIViewController? { guard let vcIdentifier = identifierComponents.last else { return nil } - if (vcIdentifier == "MainVC") { - return MainViewController() - } else if (vcIdentifier == "TunnelsListVC") { - return TunnelsListTableViewController() - } else if (vcIdentifier.hasPrefix("TunnelDetailVC:")) { + if (vcIdentifier.hasPrefix("TunnelDetailVC:")) { let tunnelName = String(vcIdentifier.suffix(vcIdentifier.count - "TunnelDetailVC:".count)) if let tunnelsManager = mainVC?.tunnelsManager { if let tunnel = tunnelsManager.tunnel(named: tunnelName) { @@ -66,7 +62,6 @@ extension AppDelegate { // Show it when tunnelsManager is available mainVC?.showTunnelDetailForTunnel(named: tunnelName, animated: false) } - } return nil } |