iOS: Extract network extension management into a separate file#140
Open
ailinykh wants to merge 1 commit intoclostra:masterfrom
Open
iOS: Extract network extension management into a separate file#140ailinykh wants to merge 1 commit intoclostra:masterfrom
ailinykh wants to merge 1 commit intoclostra:masterfrom
Conversation
Collaborator
|
I'm very curious if |
Contributor
Author
|
NEVPNConnection is more appropriate because it represents the state of your tunnel and the main app can handle all the state transitions while The When |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is the first step of the
ViewControllerrefactoring process described in #139All the network extension stuff is now moved into a separate component and the
ViewController's dependency graph changed from thisflowchart LR viewController --> UIViewController viewController --> UIButton viewController --> UIImageView viewController --> UILabel viewController --> UserDefaults viewController --> NotificationCenter viewController --> MMWormhole viewController --> NETunnelProviderManager viewController --> NWPathMonitor viewController --> NEVPNStatus subgraph User Iinterface UIButton UIImageView UILabel UIViewController end subgraph Infrastructure UserDefaults NotificationCenter MMWormhole end subgraph Networking NETunnelProviderManager NWPathMonitor NEVPNStatus endto this:
flowchart RL viewController --> UIViewController viewController --> UIButton viewController --> UIImageView viewController --> UILabel viewController --> UserDefaults viewController --> NotificationCenter viewController --> MMWormhole TunnelManagerImpl --> NETunnelProviderManager TunnelManagerImpl --> NEVPNStatus TunnelManagerImpl -.-> TunnelManager["<TunnelManager>"] TunnelManagerDelegate --> TunnelManagerState viewController --> TunnelManager viewController --> TunnelManagerDelegate subgraph User Interface UIButton UIImageView UILabel UIViewController end subgraph Infrastructure UserDefaults NotificationCenter MMWormhole end subgraph Network Extension NETunnelProviderManager NWPathMonitor NEVPNStatus end subgraph NewNode TunnelManager TunnelManagerDelegate TunnelManagerState TunnelManagerImpl endThere are some benefits of this approach:
ViewControllerdoes not depend on NetworkExtension, the dependency inversion principle appliedTunnelManagercan be shared between iOS/macOS platforms without any changeTunnelManagerprotocol which allows us to focus on UI improvements on the simulator. Like so:NWPathMonitorsince we can rely onNWConnectionstate