Merge branch 'discern-unsupported-option-alert'
This commit is contained in:
commit
e7eab45fdc
|
@ -116,6 +116,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele
|
||||||
}
|
}
|
||||||
nav.modalPresentationStyle = .formSheet
|
nav.modalPresentationStyle = .formSheet
|
||||||
root.present(nav, animated: true, completion: nil)
|
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 {
|
} catch {
|
||||||
let alert = Macros.alert(L10n.Organizer.Sections.Hosts.header, L10n.Wizards.Host.Alerts.parsing)
|
let alert = Macros.alert(L10n.Organizer.Sections.Hosts.header, L10n.Wizards.Host.Alerts.parsing)
|
||||||
alert.addCancelAction(L10n.Global.ok)
|
alert.addCancelAction(L10n.Global.ok)
|
||||||
|
|
|
@ -45,6 +45,7 @@
|
||||||
"wizards.host.cells.title_input.placeholder" = "My Profile";
|
"wizards.host.cells.title_input.placeholder" = "My Profile";
|
||||||
"wizards.host.sections.existing.header" = "Existing profiles";
|
"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.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.";
|
"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.";
|
"service.welcome.message" = "Welcome to Passepartout!\n\nUse the organizer to add a new profile.";
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
enum ApplicationError: String, Error {
|
enum ApplicationError: Error {
|
||||||
case missingProfile
|
case missingProfile
|
||||||
|
|
||||||
case missingCredentials
|
case missingCredentials
|
||||||
|
@ -40,5 +40,5 @@ enum ApplicationError: String, Error {
|
||||||
|
|
||||||
case emptyRemotes
|
case emptyRemotes
|
||||||
|
|
||||||
case unsupportedConfiguration
|
case unsupportedConfiguration(option: String)
|
||||||
}
|
}
|
||||||
|
|
|
@ -660,6 +660,10 @@ internal enum L10n {
|
||||||
internal static let existing = L10n.tr("Localizable", "wizards.host.alerts.existing")
|
internal static let existing = L10n.tr("Localizable", "wizards.host.alerts.existing")
|
||||||
/// Unable to parse the provided configuration file.
|
/// Unable to parse the provided configuration file.
|
||||||
internal static let parsing = L10n.tr("Localizable", "wizards.host.alerts.parsing")
|
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 {
|
internal enum Cells {
|
||||||
|
|
|
@ -113,11 +113,8 @@ extension TunnelKitProvider.Configuration {
|
||||||
case "key":
|
case "key":
|
||||||
clientKey = CryptoContainer(pem: currentBlock.joined(separator: "\n"))
|
clientKey = CryptoContainer(pem: currentBlock.joined(separator: "\n"))
|
||||||
|
|
||||||
case "tls-auth":
|
case "tls-auth", "tls-crypt":
|
||||||
unsupportedError = ApplicationError.unsupportedConfiguration
|
unsupportedError = ApplicationError.unsupportedConfiguration(option: blockName)
|
||||||
|
|
||||||
case "tls-crypt":
|
|
||||||
unsupportedError = ApplicationError.unsupportedConfiguration
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
|
@ -187,7 +184,7 @@ extension TunnelKitProvider.Configuration {
|
||||||
renegotiateAfterSeconds = Int(arg)
|
renegotiateAfterSeconds = Int(arg)
|
||||||
}
|
}
|
||||||
Regex.fragment.enumerateArguments(in: line) { (_) in
|
Regex.fragment.enumerateArguments(in: line) { (_) in
|
||||||
unsupportedError = ApplicationError.unsupportedConfiguration
|
unsupportedError = ApplicationError.unsupportedConfiguration(option: "fragment")
|
||||||
}
|
}
|
||||||
|
|
||||||
if let error = unsupportedError {
|
if let error = unsupportedError {
|
||||||
|
|
Loading…
Reference in New Issue