-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(cordova/apple): move network settings logic to Swift #1658
Conversation
For review, I recommend hiding the whitespaces. I was fighting with the editor, so I just had to reformat the entire file. |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #1658 +/- ##
=======================================
- Coverage 35% 35% -1%
=======================================
Files 45 47 +2
Lines 2532 2852 +320
Branches 314 314
=======================================
+ Hits 904 1012 +108
- Misses 1628 1840 +212
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, one more step closer to a modern app now.
src/cordova/apple/OutlineAppleLib/Sources/OutlineTunnelSources/OutlineTunnel.swift
Show resolved
Hide resolved
src/cordova/apple/OutlineAppleLib/Sources/OutlineTunnelSources/OutlineTunnel.swift
Outdated
Show resolved
Hide resolved
src/cordova/apple/OutlineAppleLib/Sources/OutlineTunnelSources/OutlineTunnel.swift
Outdated
Show resolved
Hide resolved
src/cordova/apple/OutlineAppleLib/Sources/OutlineTunnelSources/OutlineTunnel.swift
Outdated
Show resolved
Hide resolved
src/cordova/apple/OutlineAppleLib/Sources/OutlineTunnelSources/OutlineTunnel.swift
Outdated
Show resolved
Hide resolved
src/cordova/apple/OutlineAppleLib/Sources/OutlineTunnelSources/OutlineTunnel.swift
Outdated
Show resolved
Hide resolved
…/OutlineTunnel.swift Co-authored-by: J. Yi <[email protected]>
…/OutlineTunnel.swift Co-authored-by: J. Yi <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review and the Swift tips. I don't really know Swift! 😅
Please take another look.
While waiting for the review I moved some extra files from the plugin to the lib. This makes allows us to develop in place (no rsync!), add tests and will make it easier to refactor and cleanup.
src/cordova/apple/OutlineAppleLib/Sources/OutlineTunnelSources/OutlineTunnel.swift
Show resolved
Hide resolved
src/cordova/apple/OutlineAppleLib/Sources/OutlineTunnelSources/OutlineTunnel.swift
Outdated
Show resolved
Hide resolved
src/cordova/apple/OutlineAppleLib/Sources/OutlineTunnelSources/OutlineTunnel.swift
Outdated
Show resolved
Hide resolved
src/cordova/apple/OutlineAppleLib/Sources/OutlineTunnelSources/OutlineTunnel.swift
Outdated
Show resolved
Hide resolved
src/cordova/apple/OutlineAppleLib/Sources/OutlineTunnelSources/OutlineTunnel.swift
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just with some questions to confirm.
src/cordova/apple/OutlineAppleLib/Sources/OutlineTunnelSources/OutlineTunnel.swift
Outdated
Show resolved
Hide resolved
src/cordova/apple/OutlineAppleLib/Sources/OutlineTunnelSources/OutlineVpn.swift
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to fix an issue with macOS. The launcher has a dependency on OutlineVpn that I need to fix.
src/cordova/apple/OutlineAppleLib/Sources/OutlineTunnelSources/OutlineVpn.swift
Show resolved
Hide resolved
src/cordova/apple/OutlineAppleLib/Sources/OutlineTunnelSources/OutlineTunnel.swift
Outdated
Show resolved
Hide resolved
This is ready for re-review. @daniellacosse can you make the coverage test not fail? |
@@ -8,10 +8,13 @@ let package = Package( | |||
products: [ | |||
.library( | |||
name: "OutlineAppleLib", | |||
targets: ["Tun2socks", "OutlineTunnel", "PacketTunnelProvider"]), | |||
targets: ["Tun2socks", "OutlineTunnel"]), | |||
.library( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The VpnExtension can now depend on the PacketTunnelProvider only.
], | ||
dependencies: [ | ||
.package(url: "https://github.com/CocoaLumberjack/CocoaLumberjack.git", exact: "3.7.4"), | ||
.package(url: "https://github.com/CocoaLumberjack/CocoaLumberjack.git", from: "3.7.4"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The exact directive prevented the XCode project from upgrading the dependencies.
@@ -17,17 +17,13 @@ | |||
302D95F114D2391D003F00A1 /* MainViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 302D95EF14D2391D003F00A1 /* MainViewController.m */; }; | |||
302D95F214D2391D003F00A1 /* MainViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 302D95F014D2391D003F00A1 /* MainViewController.xib */; }; | |||
3B0347531F212F0200C8EF1F /* VpnExtension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 3B0347481F212F0100C8EF1F /* VpnExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; | |||
3B0347611F212F6900C8EF1F /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 941052A220F54953928FF2E2 /* libz.tbd */; }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are VpnExtension dependencies that were not needed because they are not used or listed in the Swift package.
52CE53E7295B6A310064D03D /* Sentry in Frameworks */ = {isa = PBXBuildFile; productRef = 52CE53E6295B6A310064D03D /* Sentry */; }; | ||
52E783062A5880CF00355E64 /* PacketTunnelProvider in Frameworks */ = {isa = PBXBuildFile; productRef = 52E783052A5880CF00355E64 /* PacketTunnelProvider */; }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new dependency on the PacketTunnelProvider, replacing all the other ones.
@@ -99,7 +88,6 @@ | |||
0168F53D3AFF46F5B346C874 /* CDVStatusBar.h */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.c.h; name = CDVStatusBar.h; path = "cordova-plugin-statusbar/CDVStatusBar.h"; sourceTree = "<group>"; }; | |||
0207DA571B56EA530066E2B4 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = Outline/Images.xcassets; sourceTree = SOURCE_ROOT; }; | |||
0394302BA6114B2AB648D4FF /* CDVStatusBar.m */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.c.objc; name = CDVStatusBar.m; path = "cordova-plugin-statusbar/CDVStatusBar.m"; sourceTree = "<group>"; }; | |||
119806AF98394D7D8749BB30 /* OutlineConnectivity.swift */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.swift; name = OutlineConnectivity.swift; path = "cordova-plugin-outline/OutlineConnectivity.swift"; sourceTree = "<group>"; }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This and others are now in the Swift package, not in the XCode project.
@@ -835,16 +809,16 @@ | |||
isa = XCRemoteSwiftPackageReference; | |||
repositoryURL = "https://github.com/CocoaLumberjack/CocoaLumberjack"; | |||
requirement = { | |||
kind = exactVersion; | |||
version = 3.7.4; | |||
kind = upToNextMajorVersion; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To allow for upgrades. The Package.resolved file pins the exact version.
@@ -21,30 +21,13 @@ | |||
ReferencedContainer = "container:Outline.xcodeproj"> | |||
</BuildableReference> | |||
</BuildActionEntry> | |||
<BuildActionEntry |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bogus dependency on the Outline target. I think this schema was originally created by copying the one for the app.
FC5FF9471F3E1E8B0032A745 /* NetworkExtension.framework in Frameworks */, | ||
52CBB84D295BC7F700D0073F /* CocoaLumberjack in Frameworks */, | ||
52CBB84F295BC7F700D0073F /* CocoaLumberjackSwift in Frameworks */, | ||
52C198972A587525006E0ACE /* PacketTunnelProvider in Frameworks */, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cleaned up dependencies for the VpnExtension.
@@ -51,7 +51,7 @@ export async function main(...parameters) { | |||
'clean', | |||
'test', | |||
'-scheme', | |||
APPLE_LIBRARY_NAME, | |||
`${APPLE_LIBRARY_NAME}-Package`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This had to change because now the package has two products, one with the same name as the package, so the auto-generated scheme uses -Package for the package scheme. The library doesn't have the tests.
The goal is to eventually get rid of all Objective-C code.
This PR illustrates how we can incrementally move code.
With the move, I'm also able to add unit tests.
/cc @daniellacosse @sbruens