From ac713bebdab27b17072cbc0bb3b8d15629d0ae09 Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Wed, 3 Apr 2019 14:08:22 +0200 Subject: [PATCH] Present DNS domain in configuration UI Fixes #48 --- CHANGELOG.md | 6 +++++ .../Scenes/ConfigurationViewController.swift | 23 +++++++++++++------ .../Resources/en.lproj/Localizable.strings | 2 ++ .../Services/InfrastructurePreset.swift | 4 ++-- Passepartout/Sources/SwiftGen+Strings.swift | 8 +++++++ 5 files changed, 34 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 47e24799..1f018461 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased + +### Fixed + +- Pushing DOMAIN has no effect. [#48](https://github.com/passepartoutvpn/passepartout-ios/issues/48) + ## 1.3.0 (2019-04-03) ### Added diff --git a/Passepartout-iOS/Scenes/ConfigurationViewController.swift b/Passepartout-iOS/Scenes/ConfigurationViewController.swift index 5bb17f0d..db9b3841 100644 --- a/Passepartout-iOS/Scenes/ConfigurationViewController.swift +++ b/Passepartout-iOS/Scenes/ConfigurationViewController.swift @@ -59,18 +59,14 @@ class ConfigurationViewController: UIViewController, TableModelHost { } model.add(.tls) model.add(.compression) - if let _ = configuration.dnsServers { - model.add(.dns) - } + 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) model.setHeader(L10n.Configuration.Sections.Compression.header, for: .compression) - if let _ = configuration.dnsServers { - model.setHeader(L10n.Configuration.Sections.Dns.header, for: .dns) - } + model.setHeader(L10n.Configuration.Sections.Dns.header, for: .dns) model.setHeader(L10n.Configuration.Sections.Other.header, for: .other) // footers @@ -85,9 +81,14 @@ class ConfigurationViewController: UIViewController, TableModelHost { } model.set([.client, .tlsWrapping, .eku], in: .tls) model.set([.compressionFraming, .compressionAlgorithm], in: .compression) + var dnsRows: [RowType] if let dnsServers = configuration.dnsServers { - model.set(.dnsServer, count: dnsServers.count, in: .dns) + dnsRows = [RowType](repeating: .dnsServer, count: dnsServers.count) + } else { + dnsRows = [] } + dnsRows.append(.dnsDomain) + model.set(dnsRows, in: .dns) model.set([.keepAlive, .renegSeconds, .randomEndpoint], in: .other) return model @@ -196,6 +197,8 @@ extension ConfigurationViewController: UITableViewDataSource, UITableViewDelegat case dnsServer + case dnsDomain + case keepAlive case renegSeconds @@ -309,6 +312,12 @@ extension ConfigurationViewController: UITableViewDataSource, UITableViewDelegat cell.rightText = dnsServers[indexPath.row] cell.accessoryType = .none cell.isTappable = false + + case .dnsDomain: + cell.leftText = L10n.Configuration.Cells.DnsDomain.caption + cell.rightText = configuration.searchDomain ?? L10n.Configuration.Cells.DnsDomain.Value.none + cell.accessoryType = .none + cell.isTappable = false case .keepAlive: cell.leftText = L10n.Configuration.Cells.KeepAlive.caption diff --git a/Passepartout/Resources/en.lproj/Localizable.strings b/Passepartout/Resources/en.lproj/Localizable.strings index f795f677..309e6652 100644 --- a/Passepartout/Resources/en.lproj/Localizable.strings +++ b/Passepartout/Resources/en.lproj/Localizable.strings @@ -168,6 +168,8 @@ "configuration.cells.tls_wrapping.value.crypt" = "Encryption"; "configuration.cells.eku.caption" = "Extended verification"; "configuration.cells.dns_server.caption" = "Address"; +"configuration.cells.dns_domain.caption" = "Domain"; +"configuration.cells.dns_domain.value.none" = "None"; "configuration.cells.compression_framing.caption" = "Framing"; "configuration.cells.compression_framing.value.lzo" = "--comp-lzo"; "configuration.cells.compression_framing.value.compress" = "--compress"; diff --git a/Passepartout/Sources/Services/InfrastructurePreset.swift b/Passepartout/Sources/Services/InfrastructurePreset.swift index 51674b85..e17854ed 100644 --- a/Passepartout/Sources/Services/InfrastructurePreset.swift +++ b/Passepartout/Sources/Services/InfrastructurePreset.swift @@ -63,11 +63,11 @@ public struct InfrastructurePreset: Codable { case tlsWrap = "wrap" - case usesPIAPatches = "pia" - case checksEKU = "eku" case randomizeEndpoint = "random" + + case usesPIAPatches = "pia" } public let id: String diff --git a/Passepartout/Sources/SwiftGen+Strings.swift b/Passepartout/Sources/SwiftGen+Strings.swift index 4fd56f69..73f2bf38 100644 --- a/Passepartout/Sources/SwiftGen+Strings.swift +++ b/Passepartout/Sources/SwiftGen+Strings.swift @@ -150,6 +150,14 @@ public enum L10n { public static let embedded = L10n.tr("Localizable", "configuration.cells.digest.value.embedded") } } + public enum DnsDomain { + /// Domain + public static let caption = L10n.tr("Localizable", "configuration.cells.dns_domain.caption") + public enum Value { + /// None + public static let `none` = L10n.tr("Localizable", "configuration.cells.dns_domain.value.none") + } + } public enum DnsServer { /// Address public static let caption = L10n.tr("Localizable", "configuration.cells.dns_server.caption")