Customize PAC in network settings
This commit is contained in:
parent
18ff4b69a5
commit
dfa711b335
|
@ -40,6 +40,8 @@ private enum FieldTag: Int {
|
|||
|
||||
case proxyPort = 302
|
||||
|
||||
case proxyAutoConfigurationURL = 303
|
||||
|
||||
case proxyBypass = 400
|
||||
}
|
||||
|
||||
|
@ -100,6 +102,7 @@ class NetworkSettingsViewController: UITableViewController {
|
|||
var proxyRows: [RowType] = Array(repeating: .proxyBypass, count: networkSettings.proxyBypassDomains?.count ?? 0)
|
||||
proxyRows.insert(.proxyAddress, at: 0)
|
||||
proxyRows.insert(.proxyPort, at: 1)
|
||||
proxyRows.insert(.proxyAutoConfigurationURL, at: 2)
|
||||
if networkChoices.proxy == .manual {
|
||||
proxyRows.append(.proxyAddBypass)
|
||||
}
|
||||
|
@ -188,7 +191,7 @@ class NetworkSettingsViewController: UITableViewController {
|
|||
private func commitTextField(_ field: UITextField) {
|
||||
|
||||
// DNS: domain, servers
|
||||
// Proxy: address, port, bypass domains
|
||||
// Proxy: address, port, PAC, bypass domains
|
||||
|
||||
if field.tag == FieldTag.dnsDomain.rawValue {
|
||||
networkSettings.dnsDomainName = field.text
|
||||
|
@ -196,6 +199,12 @@ class NetworkSettingsViewController: UITableViewController {
|
|||
networkSettings.proxyAddress = field.text
|
||||
} else if field.tag == FieldTag.proxyPort.rawValue {
|
||||
networkSettings.proxyPort = UInt16(field.text ?? "0")
|
||||
} else if field.tag == FieldTag.proxyAutoConfigurationURL.rawValue {
|
||||
if let string = field.text {
|
||||
networkSettings.proxyAutoConfigurationURL = URL(string: string)
|
||||
} else {
|
||||
networkSettings.proxyAutoConfigurationURL = nil
|
||||
}
|
||||
} else if field.tag >= FieldTag.dnsAddress.rawValue && field.tag < FieldTag.proxyAddress.rawValue {
|
||||
let i = field.tag - FieldTag.dnsAddress.rawValue
|
||||
networkSettings.dnsServers?[i] = field.text ?? ""
|
||||
|
@ -257,6 +266,8 @@ extension NetworkSettingsViewController {
|
|||
|
||||
case proxyPort
|
||||
|
||||
case proxyAutoConfigurationURL
|
||||
|
||||
case proxyBypass
|
||||
|
||||
case proxyAddBypass
|
||||
|
@ -377,6 +388,19 @@ extension NetworkSettingsViewController {
|
|||
cell.delegate = self
|
||||
cell.field.isEnabled = (networkChoices.proxy == .manual)
|
||||
return cell
|
||||
|
||||
case .proxyAutoConfigurationURL:
|
||||
let cell = Cells.field.dequeue(from: tableView, for: indexPath)
|
||||
cell.caption = "PAC"
|
||||
cell.field.tag = FieldTag.proxyAutoConfigurationURL.rawValue
|
||||
cell.field.placeholder = L10n.Core.Global.Values.none
|
||||
cell.field.text = networkSettings.proxyAutoConfigurationURL?.absoluteString
|
||||
cell.field.clearButtonMode = .always
|
||||
cell.field.keyboardType = .asciiCapable
|
||||
cell.captionWidth = 160.0
|
||||
cell.delegate = self
|
||||
cell.field.isEnabled = (networkChoices.proxy == .manual)
|
||||
return cell
|
||||
|
||||
case .proxyBypass:
|
||||
let i = indexPath.row - Offsets.proxyBypass
|
||||
|
|
2
Podfile
2
Podfile
|
@ -9,7 +9,7 @@ $tunnelkit_specs = ['Protocols/OpenVPN', 'Extra/LZO']
|
|||
|
||||
def shared_pods
|
||||
#pod_version $tunnelkit_name, $tunnelkit_specs, '~> 2.0.5'
|
||||
pod_git $tunnelkit_name, $tunnelkit_specs, 'dcac7cb'
|
||||
pod_git $tunnelkit_name, $tunnelkit_specs, '4959442'
|
||||
#pod_path $tunnelkit_name, $tunnelkit_specs, '..'
|
||||
pod 'SSZipArchive'
|
||||
|
||||
|
|
10
Podfile.lock
10
Podfile.lock
|
@ -37,8 +37,8 @@ DEPENDENCIES:
|
|||
- Convenience/Tables (from `https://github.com/keeshux/convenience`, commit `b990a8c`)
|
||||
- MBProgressHUD
|
||||
- SSZipArchive
|
||||
- TunnelKit/Extra/LZO (from `https://github.com/passepartoutvpn/tunnelkit`, commit `dcac7cb`)
|
||||
- TunnelKit/Protocols/OpenVPN (from `https://github.com/passepartoutvpn/tunnelkit`, commit `dcac7cb`)
|
||||
- TunnelKit/Extra/LZO (from `https://github.com/passepartoutvpn/tunnelkit`, commit `4959442`)
|
||||
- TunnelKit/Protocols/OpenVPN (from `https://github.com/passepartoutvpn/tunnelkit`, commit `4959442`)
|
||||
|
||||
SPEC REPOS:
|
||||
https://github.com/cocoapods/specs.git:
|
||||
|
@ -52,7 +52,7 @@ EXTERNAL SOURCES:
|
|||
:commit: b990a8c
|
||||
:git: https://github.com/keeshux/convenience
|
||||
TunnelKit:
|
||||
:commit: dcac7cb
|
||||
:commit: '4959442'
|
||||
:git: https://github.com/passepartoutvpn/tunnelkit
|
||||
|
||||
CHECKOUT OPTIONS:
|
||||
|
@ -60,7 +60,7 @@ CHECKOUT OPTIONS:
|
|||
:commit: b990a8c
|
||||
:git: https://github.com/keeshux/convenience
|
||||
TunnelKit:
|
||||
:commit: dcac7cb
|
||||
:commit: '4959442'
|
||||
:git: https://github.com/passepartoutvpn/tunnelkit
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
|
@ -71,6 +71,6 @@ SPEC CHECKSUMS:
|
|||
SwiftyBeaver: aaf2ebd7dac2e952991f46a82ed24ad642867ae2
|
||||
TunnelKit: 0743f0306be0869d51118ac33e274e7507a93537
|
||||
|
||||
PODFILE CHECKSUM: d4e710af29f32c4b095a1ba28f308af40031483d
|
||||
PODFILE CHECKSUM: a0028109a65292b76d72edb188291804eac46868
|
||||
|
||||
COCOAPODS: 1.8.4
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit ddc0d6a9af162a8b95373c5a02f93785e8c15adb
|
||||
Subproject commit 149207de584d55314948be2d9f6d8f23ea72f9c6
|
Loading…
Reference in New Issue