From ca18aadddf79d67c80116e0f91a1ac49eb81a735 Mon Sep 17 00:00:00 2001 From: Davide Date: Fri, 1 Nov 2024 20:01:18 +0100 Subject: [PATCH] Allow interactive credentials with providers (#796) Fixes #795 --- .../xcshareddata/swiftpm/Package.resolved | 4 ++-- Passepartout/Library/Package.swift | 2 +- Passepartout/Library/Sources/AppUI/L10n/AppError+L10n.swift | 3 +++ .../Library/Sources/AppUI/L10n/SwiftGen+Strings.swift | 2 ++ .../Sources/AppUI/Resources/en.lproj/Localizable.strings | 1 + .../Library/Tests/AppUITests/ExtendedTunnelTests.swift | 6 ++++-- 6 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Passepartout.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Passepartout.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 4c11ccbe..9400c385 100644 --- a/Passepartout.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Passepartout.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -12,7 +12,7 @@ { "identity" : "generic-json-swift", "kind" : "remoteSourceControl", - "location" : "https://github.com/zoul/generic-json-swift", + "location" : "https://github.com/iwill/generic-json-swift", "state" : { "revision" : "0a06575f4038b504e78ac330913d920f1630f510", "version" : "2.0.2" @@ -41,7 +41,7 @@ "kind" : "remoteSourceControl", "location" : "git@github.com:passepartoutvpn/passepartoutkit-source", "state" : { - "revision" : "8b4c47f716120fab3f219593cf4ae0e6e2c86677" + "revision" : "e95c7b54dc11e744d9b40a722fccf752436ac0ef" } }, { diff --git a/Passepartout/Library/Package.swift b/Passepartout/Library/Package.swift index 34334ec7..618476d7 100644 --- a/Passepartout/Library/Package.swift +++ b/Passepartout/Library/Package.swift @@ -36,7 +36,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: "8b4c47f716120fab3f219593cf4ae0e6e2c86677"), + .package(url: "git@github.com:passepartoutvpn/passepartoutkit-source", revision: "e95c7b54dc11e744d9b40a722fccf752436ac0ef"), // .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/L10n/AppError+L10n.swift b/Passepartout/Library/Sources/AppUI/L10n/AppError+L10n.swift index c31d8824..5d045152 100644 --- a/Passepartout/Library/Sources/AppUI/L10n/AppError+L10n.swift +++ b/Passepartout/Library/Sources/AppUI/L10n/AppError+L10n.swift @@ -74,6 +74,9 @@ extension PassepartoutError: LocalizedError { .compactMap { $0 } .joined(separator: " ") + case .noActiveModules: + return Strings.Errors.App.Passepartout.noActiveModules + case .parsing: let message = userInfo as? String ?? reason?.localizedDescription diff --git a/Passepartout/Library/Sources/AppUI/L10n/SwiftGen+Strings.swift b/Passepartout/Library/Sources/AppUI/L10n/SwiftGen+Strings.swift index 2e2b6e34..5eb9d796 100644 --- a/Passepartout/Library/Sources/AppUI/L10n/SwiftGen+Strings.swift +++ b/Passepartout/Library/Sources/AppUI/L10n/SwiftGen+Strings.swift @@ -137,6 +137,8 @@ public enum Strings { public static let invalidFields = Strings.tr("Localizable", "errors.app.passepartout.invalid_fields", fallback: "Invalid fields.") /// No provider server selected. public static let missingProviderEntity = Strings.tr("Localizable", "errors.app.passepartout.missing_provider_entity", fallback: "No provider server selected.") + /// The profile has no active modules. + public static let noActiveModules = Strings.tr("Localizable", "errors.app.passepartout.no_active_modules", fallback: "The profile has no active modules.") /// Unable to parse file. public static let parsing = Strings.tr("Localizable", "errors.app.passepartout.parsing", fallback: "Unable to parse file.") /// No provider selected. diff --git a/Passepartout/Library/Sources/AppUI/Resources/en.lproj/Localizable.strings b/Passepartout/Library/Sources/AppUI/Resources/en.lproj/Localizable.strings index 5e8cd52e..9f79b796 100644 --- a/Passepartout/Library/Sources/AppUI/Resources/en.lproj/Localizable.strings +++ b/Passepartout/Library/Sources/AppUI/Resources/en.lproj/Localizable.strings @@ -273,6 +273,7 @@ "errors.app.passepartout.incompatible_modules" = "Some active modules are incompatible, try to only activate one of them."; "errors.app.passepartout.invalid_fields" = "Invalid fields."; "errors.app.passepartout.missing_provider_entity" = "No provider server selected."; +"errors.app.passepartout.no_active_modules" = "The profile has no active modules."; "errors.app.passepartout.parsing" = "Unable to parse file."; "errors.app.passepartout.provider_required" = "No provider selected."; "errors.app.passepartout.default" = "Unable to complete operation (code=%@)."; diff --git a/Passepartout/Library/Tests/AppUITests/ExtendedTunnelTests.swift b/Passepartout/Library/Tests/AppUITests/ExtendedTunnelTests.swift index 46d38e21..20581247 100644 --- a/Passepartout/Library/Tests/AppUITests/ExtendedTunnelTests.swift +++ b/Passepartout/Library/Tests/AppUITests/ExtendedTunnelTests.swift @@ -39,7 +39,8 @@ extension ExtendedTunnelTests { let sut = ExtendedTunnel(tunnel: tunnel, environment: env, interval: 0.1) sut.observeObjects() - let profile = try Profile.Builder().tryBuild() + let module = try DNSModule.Builder().tryBuild() + let profile = try Profile.Builder(modules: [module], activatingModules: true).tryBuild() try await tunnel.install(profile, connect: true, title: \.name) env.setEnvironmentValue(.crypto, forKey: TunnelEnvironmentKeys.lastErrorCode) @@ -54,7 +55,8 @@ extension ExtendedTunnelTests { let sut = ExtendedTunnel(tunnel: tunnel, environment: env, interval: 0.1) sut.observeObjects() - let profile = try Profile.Builder().tryBuild() + let module = try DNSModule.Builder().tryBuild() + let profile = try Profile.Builder(modules: [module], activatingModules: true).tryBuild() try await tunnel.install(profile, connect: false, title: \.name) let dataCount = DataCount(500, 700)