diff --git a/Passepartout-iOS/AppDelegate.swift b/Passepartout-iOS/AppDelegate.swift index 7872f6c5..82ea9bae 100644 --- a/Passepartout-iOS/AppDelegate.swift +++ b/Passepartout-iOS/AppDelegate.swift @@ -116,6 +116,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele } nav.modalPresentationStyle = .formSheet root.present(nav, animated: true, completion: nil) + } catch ApplicationError.unsupportedConfiguration(let option) { + let alert = Macros.alert(L10n.Organizer.Sections.Hosts.header, L10n.Wizards.Host.Alerts.unsupported(option)) + alert.addCancelAction(L10n.Global.ok) + root.present(alert, animated: true, completion: nil) } catch { let alert = Macros.alert(L10n.Organizer.Sections.Hosts.header, L10n.Wizards.Host.Alerts.parsing) alert.addCancelAction(L10n.Global.ok) diff --git a/Passepartout/Resources/en.lproj/Localizable.strings b/Passepartout/Resources/en.lproj/Localizable.strings index ba3bbda8..621bf82b 100644 --- a/Passepartout/Resources/en.lproj/Localizable.strings +++ b/Passepartout/Resources/en.lproj/Localizable.strings @@ -45,6 +45,7 @@ "wizards.host.cells.title_input.placeholder" = "My Profile"; "wizards.host.sections.existing.header" = "Existing profiles"; "wizards.host.alerts.existing" = "A host profile with the same title already exists. Replace it?"; +"wizards.host.alerts.unsupported" = "The configuration file contains an unsupported option (%@)."; "wizards.host.alerts.parsing" = "Unable to parse the provided configuration file."; "service.welcome.message" = "Welcome to Passepartout!\n\nUse the organizer to add a new profile."; diff --git a/Passepartout/Sources/ApplicationError.swift b/Passepartout/Sources/ApplicationError.swift index d3c89ce4..d99bf98a 100644 --- a/Passepartout/Sources/ApplicationError.swift +++ b/Passepartout/Sources/ApplicationError.swift @@ -25,7 +25,7 @@ import Foundation -enum ApplicationError: String, Error { +enum ApplicationError: Error { case missingProfile case missingCredentials @@ -40,5 +40,5 @@ enum ApplicationError: String, Error { case emptyRemotes - case unsupportedConfiguration + case unsupportedConfiguration(option: String) } diff --git a/Passepartout/Sources/SwiftGen+Strings.swift b/Passepartout/Sources/SwiftGen+Strings.swift index a86214ff..37b10b85 100644 --- a/Passepartout/Sources/SwiftGen+Strings.swift +++ b/Passepartout/Sources/SwiftGen+Strings.swift @@ -660,6 +660,10 @@ internal enum L10n { internal static let existing = L10n.tr("Localizable", "wizards.host.alerts.existing") /// Unable to parse the provided configuration file. internal static let parsing = L10n.tr("Localizable", "wizards.host.alerts.parsing") + /// The configuration file contains an unsupported option (%@). + internal static func unsupported(_ p1: String) -> String { + return L10n.tr("Localizable", "wizards.host.alerts.unsupported", p1) + } } internal enum Cells { diff --git a/Passepartout/Sources/VPN/TunnelKitProvider+FileConfiguration.swift b/Passepartout/Sources/VPN/TunnelKitProvider+FileConfiguration.swift index 9b2699f0..15a6a1ad 100644 --- a/Passepartout/Sources/VPN/TunnelKitProvider+FileConfiguration.swift +++ b/Passepartout/Sources/VPN/TunnelKitProvider+FileConfiguration.swift @@ -113,11 +113,8 @@ extension TunnelKitProvider.Configuration { case "key": clientKey = CryptoContainer(pem: currentBlock.joined(separator: "\n")) - case "tls-auth": - unsupportedError = ApplicationError.unsupportedConfiguration - - case "tls-crypt": - unsupportedError = ApplicationError.unsupportedConfiguration + case "tls-auth", "tls-crypt": + unsupportedError = ApplicationError.unsupportedConfiguration(option: blockName) default: break @@ -187,7 +184,7 @@ extension TunnelKitProvider.Configuration { renegotiateAfterSeconds = Int(arg) } Regex.fragment.enumerateArguments(in: line) { (_) in - unsupportedError = ApplicationError.unsupportedConfiguration + unsupportedError = ApplicationError.unsupportedConfiguration(option: "fragment") } if let error = unsupportedError {