TunnelsManager: Return a manager with no tunnels in the simulator
To be able to run at least parts of the app in the simulator. Signed-off-by: Roopesh Chander <roop@roopc.net>
This commit is contained in:
parent
7e9ee913c1
commit
b3515c937e
|
@ -42,6 +42,10 @@ class TunnelsManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
static func create(completionHandler: @escaping (TunnelsManager?) -> Void) {
|
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
|
NETunnelProviderManager.loadAllFromPreferences { (managers, error) in
|
||||||
if let error = error {
|
if let error = error {
|
||||||
os_log("Failed to load tunnel provider managers: %{public}@", log: OSLog.default, type: .debug, "\(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 ?? []))
|
completionHandler(TunnelsManager(tunnelProviders: managers ?? []))
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
func add(tunnelConfiguration: TunnelConfiguration, completionHandler: @escaping (TunnelContainer?, TunnelManagementError?) -> Void) {
|
func add(tunnelConfiguration: TunnelConfiguration, completionHandler: @escaping (TunnelContainer?, TunnelManagementError?) -> Void) {
|
||||||
|
|
Loading…
Reference in New Issue