From 5fcb710d5e89fae87b171b4bbf94840aa272e85f Mon Sep 17 00:00:00 2001 From: Davide Date: Wed, 23 Oct 2024 23:19:53 +0200 Subject: [PATCH] Allow creation of OpenVPN provider module (#755) Behind paywall as per #712 Fixes #712 --- .../xcshareddata/swiftpm/Package.resolved | 2 +- Passepartout/Library/Package.swift | 2 +- Passepartout/Library/Sources/AppUI/Business/AppContext.swift | 1 - .../Library/Sources/AppUI/Business/ProfileEditor.swift | 3 ++- .../Library/Sources/AppUI/Views/Modules/OpenVPNView.swift | 4 ++-- .../Sources/AppUI/Views/Profile/ProfileCoordinator.swift | 5 ++++- .../Library/Tests/AppUITests/ProfileEditorTests.swift | 4 +++- 7 files changed, 13 insertions(+), 8 deletions(-) diff --git a/Passepartout.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Passepartout.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 3f2d97bd..5e65bd29 100644 --- a/Passepartout.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Passepartout.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -41,7 +41,7 @@ "kind" : "remoteSourceControl", "location" : "git@github.com:passepartoutvpn/passepartoutkit-source", "state" : { - "revision" : "a0cb540f739c58d04756d15b9a7bb21fae52c95f" + "revision" : "4fffdbde18ddaa5ab0fdfa9ee417a0f5015f59c6" } }, { diff --git a/Passepartout/Library/Package.swift b/Passepartout/Library/Package.swift index 6f574e3c..17bc7156 100644 --- a/Passepartout/Library/Package.swift +++ b/Passepartout/Library/Package.swift @@ -28,7 +28,7 @@ let package = Package( ], dependencies: [ // .package(url: "git@github.com:passepartoutvpn/passepartoutkit-source", from: "0.9.0"), - .package(url: "git@github.com:passepartoutvpn/passepartoutkit-source", revision: "a0cb540f739c58d04756d15b9a7bb21fae52c95f"), + .package(url: "git@github.com:passepartoutvpn/passepartoutkit-source", revision: "4fffdbde18ddaa5ab0fdfa9ee417a0f5015f59c6"), // .package(path: "../../../passepartoutkit-source"), .package(url: "git@github.com:passepartoutvpn/passepartoutkit-source-openvpn-openssl", from: "0.9.1"), // .package(url: "git@github.com:passepartoutvpn/passepartoutkit-source-openvpn-openssl", revision: "031863a1cd683962a7dfe68e20b91fa820a1ecce"), diff --git a/Passepartout/Library/Sources/AppUI/Business/AppContext.swift b/Passepartout/Library/Sources/AppUI/Business/AppContext.swift index 2cb51479..ee6e194c 100644 --- a/Passepartout/Library/Sources/AppUI/Business/AppContext.swift +++ b/Passepartout/Library/Sources/AppUI/Business/AppContext.swift @@ -115,7 +115,6 @@ private extension AppContext { try await tunnel.disconnect() return } - // FIXME: #379, reconnect in some scenarios, e.g. changing provider server } } } diff --git a/Passepartout/Library/Sources/AppUI/Business/ProfileEditor.swift b/Passepartout/Library/Sources/AppUI/Business/ProfileEditor.swift index af28bc3d..610ca1fa 100644 --- a/Passepartout/Library/Sources/AppUI/Business/ProfileEditor.swift +++ b/Passepartout/Library/Sources/AppUI/Business/ProfileEditor.swift @@ -82,7 +82,8 @@ extension ProfileEditor { .allCases .filter { // TODO: #657, hide manual OpenVPN/WireGuard until editable - $0 != .openVPN && $0 != .wireGuard +// $0 != .openVPN && $0 != .wireGuard + $0 != .wireGuard } .filter { !moduleTypes.contains($0) diff --git a/Passepartout/Library/Sources/AppUI/Views/Modules/OpenVPNView.swift b/Passepartout/Library/Sources/AppUI/Views/Modules/OpenVPNView.swift index e89b134c..35265097 100644 --- a/Passepartout/Library/Sources/AppUI/Views/Modules/OpenVPNView.swift +++ b/Passepartout/Library/Sources/AppUI/Views/Modules/OpenVPNView.swift @@ -69,7 +69,7 @@ private extension OpenVPNView { @ViewBuilder var contentView: some View { - if isServerPushed { + if isServerPushed || draft.wrappedValue.configurationBuilder != nil { manualView } else { manualView @@ -81,7 +81,7 @@ private extension OpenVPNView { VPNProviderContentModifier( providerId: providerId, selectedEntity: providerEntity, - isRequired: draft.wrappedValue.configurationBuilder == nil, + isRequired: true, entityDestination: Subroute.providerServer, providerRows: { moduleGroup(for: providerAccountRows) diff --git a/Passepartout/Library/Sources/AppUI/Views/Profile/ProfileCoordinator.swift b/Passepartout/Library/Sources/AppUI/Views/Profile/ProfileCoordinator.swift index b335e318..ecb33b04 100644 --- a/Passepartout/Library/Sources/AppUI/Views/Profile/ProfileCoordinator.swift +++ b/Passepartout/Library/Sources/AppUI/Views/Profile/ProfileCoordinator.swift @@ -112,7 +112,10 @@ private extension ProfileCoordinator { case .ip: paywallReason = iapManager.paywallReason(forFeature: .routing) - case .onDemand, .openVPN, .wireGuard: + case .openVPN, .wireGuard: + paywallReason = iapManager.paywallReason(forFeature: .providers) + + case .onDemand: break } guard paywallReason == nil else { diff --git a/Passepartout/Library/Tests/AppUITests/ProfileEditorTests.swift b/Passepartout/Library/Tests/AppUITests/ProfileEditorTests.swift index d10dafd6..42660451 100644 --- a/Passepartout/Library/Tests/AppUITests/ProfileEditorTests.swift +++ b/Passepartout/Library/Tests/AppUITests/ProfileEditorTests.swift @@ -78,8 +78,10 @@ extension ProfileEditorTests { XCTAssertFalse(moduleTypes.contains(.ip)) XCTAssertTrue(moduleTypes.contains(.onDemand)) + // provider only + XCTAssertTrue(moduleTypes.contains(.openVPN)) + // until editable - XCTAssertFalse(moduleTypes.contains(.openVPN)) XCTAssertFalse(moduleTypes.contains(.wireGuard)) }