Migrate when we notice a new tunnel in reload()

Signed-off-by: Roopesh Chander <roop@roopc.net>
This commit is contained in:
Roopesh Chander 2019-02-12 17:43:40 +05:30
parent 77f929789c
commit 6331b81b5d
1 changed files with 5 additions and 0 deletions

View File

@ -83,6 +83,11 @@ class TunnelsManager {
matchingTunnel.refreshStatus() matchingTunnel.refreshStatus()
} else { } else {
// Tunnel was added outside the app // Tunnel was added outside the app
if let proto = loadedTunnelProvider.protocolConfiguration as? NETunnelProviderProtocol {
if proto.migrateConfigurationIfNeeded(called: loadedTunnelProvider.localizedDescription ?? "unknown") {
loadedTunnelProvider.saveToPreferences { _ in }
}
}
let tunnel = TunnelContainer(tunnel: loadedTunnelProvider) let tunnel = TunnelContainer(tunnel: loadedTunnelProvider)
self.tunnels.append(tunnel) self.tunnels.append(tunnel)
self.tunnels.sort { $0.name < $1.name } self.tunnels.sort { $0.name < $1.name }