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
// | |
// DefaultVPNRepository.swift | |
// Secure VPN | |
// | |
// Created by Ali Fakih on 5/20/20. | |
// Copyright © 2020 beApp. All rights reserved. | |
// | |
import Foundation | |
import AFNetworks |
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
final class DefaultVPNRepository { | |
private(set) var vpnManager: VPNRepository! | |
private let dataTransferService: DataTransferService | |
init(vpnManager: VPNRepository, dataTransfer: DataTransferService) { | |
self.vpnManager = vpnManager | |
self.dataTransferService = dataTransfer | |
} | |
} |
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 | |
import NetworkExtension | |
final class DefaultVPNManager: VPNRepository { | |
var selectedVPN: String = "" | |
var activatedVPN: String = "" | |
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
extension VPNRepository { | |
var manager: NEVPNManager { | |
return NEVPNManager.shared() | |
} | |
var status: NEVPNStatus { | |
get { | |
return manager.connection.status | |
} |
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
protocol VPNRepository { | |
var manager: NEVPNManager { get } | |
var selectedVPN: String { get set } | |
var activatedVPN: String { get set } | |
var status: NEVPNStatus { get set } | |
func loadPreferences(completion: @escaping () -> ()) | |
func save(config: VPNAccount, completion: @escaping () -> Void) | |
func connect() |
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" | |
} |
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
protocol DVPNRepository { | |
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? | |
} |
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
protocol NetworkVPNUseCase { | |
func connect(configuration: VPNAccount) | |
func getStatus() -> Observable<NetworkVPNStatus> | |
func disconnect() | |
func loadVPNConfig(completion: @escaping () -> Void) | |
func getServers(completion: @escaping (Result<[Server], Error>) -> Void) -> Cancellable? | |
} |
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
enum DashboardViewModelLoading { | |
case none | |
case fullScreen | |
case connecting | |
case connected | |
case disconnected | |
case disconnecting | |
} |
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
enum DashboardViewModelRoute { | |
case initial | |
case inAppPurchaseView | |
case purchased | |
case showPurchaseDeeplink | |
case showAds | |
case showServers(delegate: ServerListViewModelDelegate) | |
case closeServers | |
case showUpdate | |
case none |
NewerOlder