Show default gateway policy in configuration UI

This commit is contained in:
Davide De Rosa 2019-04-25 14:53:50 +02:00
parent e85c91ed79
commit b3a509fbea
3 changed files with 19 additions and 1 deletions

View File

@ -87,6 +87,7 @@ class ConfigurationViewController: UIViewController, TableModelHost {
} else { } else {
networkRows = [] networkRows = []
} }
networkRows.insert(.defaultGateway, at: 0)
networkRows.append(.dnsDomain) networkRows.append(.dnsDomain)
networkRows.append(.httpProxy) networkRows.append(.httpProxy)
networkRows.append(.httpsProxy) networkRows.append(.httpsProxy)
@ -197,6 +198,8 @@ extension ConfigurationViewController: UITableViewDataSource, UITableViewDelegat
case compressionAlgorithm case compressionAlgorithm
case defaultGateway
case dnsServer case dnsServer
case dnsDomain case dnsDomain
@ -304,12 +307,22 @@ extension ConfigurationViewController: UITableViewDataSource, UITableViewDelegat
cell.accessoryType = .none cell.accessoryType = .none
cell.isTappable = false cell.isTappable = false
case .defaultGateway:
cell.leftText = L10n.Configuration.Cells.DefaultGateway.caption
if let policies = configuration.routingPolicies {
cell.rightText = policies.map { $0.rawValue }.joined(separator: " / ")
} else {
cell.rightText = V.All.Value.none
}
cell.accessoryType = .none
cell.isTappable = false
case .dnsServer: case .dnsServer:
guard let dnsServers = configuration.dnsServers else { guard let dnsServers = configuration.dnsServers else {
fatalError("Showing DNS section without any custom server") fatalError("Showing DNS section without any custom server")
} }
cell.leftText = L10n.Configuration.Cells.DnsServer.caption cell.leftText = L10n.Configuration.Cells.DnsServer.caption
cell.rightText = dnsServers[indexPath.row] cell.rightText = dnsServers[indexPath.row - 1]
cell.accessoryType = .none cell.accessoryType = .none
cell.isTappable = false cell.isTappable = false

View File

@ -181,6 +181,7 @@
"configuration.cells.tls_wrapping.value.auth" = "Authentication"; "configuration.cells.tls_wrapping.value.auth" = "Authentication";
"configuration.cells.tls_wrapping.value.crypt" = "Encryption"; "configuration.cells.tls_wrapping.value.crypt" = "Encryption";
"configuration.cells.eku.caption" = "Extended verification"; "configuration.cells.eku.caption" = "Extended verification";
"configuration.cells.default_gateway.caption" = "Default gateway";
"configuration.cells.dns_server.caption" = "DNS"; "configuration.cells.dns_server.caption" = "DNS";
"configuration.cells.dns_domain.caption" = "Domain"; "configuration.cells.dns_domain.caption" = "Domain";
"configuration.cells.proxy_http.caption" = "Proxy"; "configuration.cells.proxy_http.caption" = "Proxy";

View File

@ -168,6 +168,10 @@ public enum L10n {
public static let lzo = L10n.tr("Localizable", "configuration.cells.compression_framing.value.lzo") public static let lzo = L10n.tr("Localizable", "configuration.cells.compression_framing.value.lzo")
} }
} }
public enum DefaultGateway {
/// Default gateway
public static let caption = L10n.tr("Localizable", "configuration.cells.default_gateway.caption")
}
public enum Digest { public enum Digest {
/// Authentication /// Authentication
public static let caption = L10n.tr("Localizable", "configuration.cells.digest.caption") public static let caption = L10n.tr("Localizable", "configuration.cells.digest.caption")