Show custom DNS addresses in configuration UI
This commit is contained in:
parent
e4a0e20207
commit
a9e16c5335
|
@ -57,11 +57,17 @@ class ConfigurationViewController: UIViewController, TableModelHost {
|
|||
model.add(.reset)
|
||||
}
|
||||
model.add(.tls)
|
||||
if let _ = configuration.dnsServers {
|
||||
model.add(.dns)
|
||||
}
|
||||
model.add(.other)
|
||||
|
||||
// headers
|
||||
model.setHeader(L10n.Configuration.Sections.Communication.header, for: .communication)
|
||||
model.setHeader(L10n.Configuration.Sections.Tls.header, for: .tls)
|
||||
if let _ = configuration.dnsServers {
|
||||
model.setHeader(L10n.Configuration.Sections.Dns.header, for: .dns)
|
||||
}
|
||||
model.setHeader(L10n.Configuration.Sections.Other.header, for: .other)
|
||||
|
||||
// footers
|
||||
|
@ -75,6 +81,9 @@ class ConfigurationViewController: UIViewController, TableModelHost {
|
|||
model.set([.resetOriginal], in: .reset)
|
||||
}
|
||||
model.set([.client, .tlsWrapping], in: .tls)
|
||||
if let dnsServers = configuration.dnsServers {
|
||||
model.set(.dnsServer, count: dnsServers.count, in: .dns)
|
||||
}
|
||||
model.set([.compressionAlgorithm, .keepAlive, .renegSeconds], in: .other)
|
||||
|
||||
return model
|
||||
|
@ -157,6 +166,8 @@ extension ConfigurationViewController: UITableViewDataSource, UITableViewDelegat
|
|||
|
||||
case tls
|
||||
|
||||
case dns
|
||||
|
||||
case other
|
||||
}
|
||||
|
||||
|
@ -173,6 +184,8 @@ extension ConfigurationViewController: UITableViewDataSource, UITableViewDelegat
|
|||
|
||||
case tlsWrapping
|
||||
|
||||
case dnsServer
|
||||
|
||||
case compressionAlgorithm
|
||||
|
||||
case keepAlive
|
||||
|
@ -260,6 +273,15 @@ extension ConfigurationViewController: UITableViewDataSource, UITableViewDelegat
|
|||
cell.accessoryType = .none
|
||||
cell.isTappable = false
|
||||
|
||||
case .dnsServer:
|
||||
guard let dnsServers = configuration.dnsServers else {
|
||||
fatalError("Showing DNS section without any custom server")
|
||||
}
|
||||
cell.leftText = L10n.Configuration.Cells.DnsServer.caption
|
||||
cell.rightText = dnsServers[indexPath.row]
|
||||
cell.accessoryType = .none
|
||||
cell.isTappable = false
|
||||
|
||||
case .compressionAlgorithm:
|
||||
cell.leftText = L10n.Configuration.Cells.CompressionAlgorithm.caption
|
||||
cell.rightText = L10n.Configuration.Cells.CompressionAlgorithm.Value.disabled // hardcoded because compression unsupported
|
||||
|
|
|
@ -136,6 +136,7 @@
|
|||
"configuration.sections.communication.header" = "Communication";
|
||||
"configuration.sections.reset.footer" = "If you ended up with broken connectivity after changing the communication parameters, tap to revert to the original configuration.";
|
||||
"configuration.sections.tls.header" = "TLS";
|
||||
"configuration.sections.dns.header" = "DNS";
|
||||
"configuration.sections.other.header" = "Other";
|
||||
"configuration.cells.cipher.caption" = "Cipher";
|
||||
"configuration.cells.digest.caption" = "Authentication";
|
||||
|
@ -152,6 +153,7 @@
|
|||
"configuration.cells.tls_wrapping.value.auth" = "Authentication";
|
||||
"configuration.cells.tls_wrapping.value.crypt" = "Encryption";
|
||||
"configuration.cells.tls_wrapping.value.disabled" = "Disabled";
|
||||
"configuration.cells.dns_server.caption" = "Address";
|
||||
"configuration.cells.compression_algorithm.caption" = "Compression";
|
||||
"configuration.cells.compression_algorithm.value.disabled" = "Disabled";
|
||||
"configuration.cells.keep_alive.caption" = "Keep-alive";
|
||||
|
|
|
@ -132,6 +132,10 @@ internal enum L10n {
|
|||
internal static let embedded = L10n.tr("Localizable", "configuration.cells.digest.value.embedded")
|
||||
}
|
||||
}
|
||||
internal enum DnsServer {
|
||||
/// Address
|
||||
internal static let caption = L10n.tr("Localizable", "configuration.cells.dns_server.caption")
|
||||
}
|
||||
internal enum KeepAlive {
|
||||
/// Keep-alive
|
||||
internal static let caption = L10n.tr("Localizable", "configuration.cells.keep_alive.caption")
|
||||
|
@ -178,6 +182,10 @@ internal enum L10n {
|
|||
/// Communication
|
||||
internal static let header = L10n.tr("Localizable", "configuration.sections.communication.header")
|
||||
}
|
||||
internal enum Dns {
|
||||
/// DNS
|
||||
internal static let header = L10n.tr("Localizable", "configuration.sections.dns.header")
|
||||
}
|
||||
internal enum Other {
|
||||
/// Other
|
||||
internal static let header = L10n.tr("Localizable", "configuration.sections.other.header")
|
||||
|
|
Loading…
Reference in New Issue