This file contains hidden or 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 UIKit | |
| struct MarkdownParser { | |
| func parse(markdown: String) -> [AttributedString] { | |
| // Split the markdown string into lines to preserve newlines | |
| let lines = markdown.split(separator: "\n", omittingEmptySubsequences: false) | |
| var parsedLines = [AttributedString]() | |
| for line in lines { |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 | |
| } |
NewerOlder