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)
.withTrailingText($0.localizedDescription)
}
// Text(Unlocalized.VPN.xor)
// .withTrailingText(settings.xor.localizedDescription)
if let xor = settings.xor {
themeLongContentLink(
Unlocalized.VPN.xor,
content: .constant(settings.xor.localizedLongDescription),
withPreview: settings.xor.localizedDescription
content: .constant(xor.localizedLongDescription),
withPreview: xor.localizedDescription
)
} else {
Text(Unlocalized.VPN.xor)
.withTrailingText(L10n.Global.Strings.disabled)
}
} header: {
Text(L10n.Endpoint.Advanced.Openvpn.Sections.Communication.header)
}
@ -168,13 +171,16 @@ extension EndpointAdvancedView.OpenVPNView {
values: OpenVPN.Digest.available,
description: \.localizedDescription
)
// Text(Unlocalized.VPN.xor)
// .withTrailingText(builder.xorMethod.localizedDescription)
if let xor = builder.xorMethod {
themeLongContentLink(
Unlocalized.VPN.xor,
content: .constant(builder.xorMethod.localizedLongDescription),
withPreview: builder.xorMethod.localizedDescription
content: .constant(xor.localizedLongDescription),
withPreview: xor.localizedDescription
)
} else {
Text(Unlocalized.VPN.xor)
.withTrailingText(L10n.Global.Strings.disabled)
}
} 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 {
guard let self = self else {
return L10n.Global.Strings.disabled
}
switch self {
case .xormask:
return Unlocalized.OpenVPN.XOR.xormask.rawValue