Do not open long content when XOR is disabled

This commit is contained in:
Davide De Rosa 2023-03-17 17:52:57 +01:00
parent 37354d1b87
commit 8f999a462e
2 changed files with 21 additions and 18 deletions

View File

@ -141,13 +141,16 @@ extension EndpointAdvancedView.OpenVPNView {
Text(L10n.Endpoint.Advanced.Openvpn.Items.Digest.caption) Text(L10n.Endpoint.Advanced.Openvpn.Items.Digest.caption)
.withTrailingText($0.localizedDescription) .withTrailingText($0.localizedDescription)
} }
// Text(Unlocalized.VPN.xor) if let xor = settings.xor {
// .withTrailingText(settings.xor.localizedDescription)
themeLongContentLink( themeLongContentLink(
Unlocalized.VPN.xor, Unlocalized.VPN.xor,
content: .constant(settings.xor.localizedLongDescription), content: .constant(xor.localizedLongDescription),
withPreview: settings.xor.localizedDescription withPreview: xor.localizedDescription
) )
} else {
Text(Unlocalized.VPN.xor)
.withTrailingText(L10n.Global.Strings.disabled)
}
} header: { } header: {
Text(L10n.Endpoint.Advanced.Openvpn.Sections.Communication.header) Text(L10n.Endpoint.Advanced.Openvpn.Sections.Communication.header)
} }
@ -168,13 +171,16 @@ extension EndpointAdvancedView.OpenVPNView {
values: OpenVPN.Digest.available, values: OpenVPN.Digest.available,
description: \.localizedDescription description: \.localizedDescription
) )
// Text(Unlocalized.VPN.xor) if let xor = builder.xorMethod {
// .withTrailingText(builder.xorMethod.localizedDescription)
themeLongContentLink( themeLongContentLink(
Unlocalized.VPN.xor, Unlocalized.VPN.xor,
content: .constant(builder.xorMethod.localizedLongDescription), content: .constant(xor.localizedLongDescription),
withPreview: builder.xorMethod.localizedDescription withPreview: xor.localizedDescription
) )
} else {
Text(Unlocalized.VPN.xor)
.withTrailingText(L10n.Global.Strings.disabled)
}
} header: { } header: {
Text(L10n.Endpoint.Advanced.Openvpn.Sections.Communication.header) Text(L10n.Endpoint.Advanced.Openvpn.Sections.Communication.header)
} }

View File

@ -85,11 +85,8 @@ extension Optional where Wrapped == OpenVPN.TLSWrap {
} }
} }
extension Optional where Wrapped == OpenVPN.XORMethod { extension OpenVPN.XORMethod {
var localizedDescription: String { var localizedDescription: String {
guard let self = self else {
return L10n.Global.Strings.disabled
}
switch self { switch self {
case .xormask: case .xormask:
return Unlocalized.OpenVPN.XOR.xormask.rawValue return Unlocalized.OpenVPN.XOR.xormask.rawValue