TunnelsManager: Return a manager with no tunnels in the simulator
To be able to run at least parts of the app in the simulator.
This commit is contained in:
parent
1bba1ffe16
commit
d477b132e4
|
@ -42,6 +42,10 @@ class TunnelsManager {
|
|||
}
|
||||
|
||||
static func create(completionHandler: @escaping (TunnelsManager?) -> Void) {
|
||||
#if targetEnvironment(simulator)
|
||||
// NETunnelProviderManager APIs don't work on the simulator
|
||||
completionHandler(TunnelsManager(tunnelProviders: []))
|
||||
#else
|
||||
NETunnelProviderManager.loadAllFromPreferences { (managers, error) in
|
||||
if let error = error {
|
||||
os_log("Failed to load tunnel provider managers: %{public}@", log: OSLog.default, type: .debug, "\(error)")
|
||||
|
@ -49,6 +53,7 @@ class TunnelsManager {
|
|||
}
|
||||
completionHandler(TunnelsManager(tunnelProviders: managers ?? []))
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
func add(tunnelConfiguration: TunnelConfiguration, completionHandler: @escaping (TunnelContainer?, TunnelManagementError?) -> Void) {
|
||||
|
|
Loading…
Reference in New Issue