Created
February 27, 2021 21:09
-
-
Save fakiho/6a0d1577a99c6f36a1d4e19a6762593b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
public enum NetworkVPNStatus: String { | |
case invalid = "Press to allow VPN" | |
case disconnected = "Tap to Connect" | |
case connecting = "Connecting" | |
case connected = "Tap to disconnect" | |
case reasserting = "Reasserting" | |
case disconnecting = "Disconnecting" | |
} | |
protocol NetworkVPNUseCase { | |
func connect(configuration: VPNAccount) | |
func getStatus(completion: @escaping (NetworkVPNStatus) -> ()) | |
func disconnect() | |
func loadVPNConfig(completion: @escaping () -> Void) | |
func getServers(completion: @escaping (Result<[Server], Error>) -> Void) -> Cancellable? | |
} | |
final class DefaultNetworkVPNUseCase: NetworkVPNUseCase { | |
private(set) var vpnManager: DVPNRepository | |
init(vpnManager: DVPNRepository) { | |
self.vpnManager = vpnManager | |
} | |
func connect(configuration: VPNAccount) { | |
vpnManager.connect(configuration: configuration) | |
} | |
func getStatus(completion: @escaping (NetworkVPNStatus) -> ()) { | |
} | |
func disconnect() { | |
vpnManager.disconnect() | |
} | |
func loadVPNConfig(completion: @escaping () -> Void) { | |
self.vpnManager.loadVPNConfig(completion: completion) | |
} | |
func getServers(completion: @escaping (Result<[Server], Error>) -> Void) -> Cancellable? { | |
return self.vpnManager.getServers(completion: completion) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment