Retain network settings placeholder

Refines a05a016881
This commit is contained in:
Davide De Rosa 2019-05-01 23:28:03 +02:00
parent 25671e7442
commit 7abd281c23
1 changed files with 10 additions and 35 deletions

View File

@ -344,18 +344,13 @@ extension NetworkSettingsViewController {
let cell = Cells.field.dequeue(from: tableView, for: indexPath) let cell = Cells.field.dequeue(from: tableView, for: indexPath)
cell.caption = L10n.Configuration.Cells.DnsDomain.caption cell.caption = L10n.Configuration.Cells.DnsDomain.caption
cell.field.tag = FieldTag.dnsDomain.rawValue cell.field.tag = FieldTag.dnsDomain.rawValue
cell.field.placeholder = L10n.Global.Cells.none
cell.field.text = networkSettings.dnsDomainName cell.field.text = networkSettings.dnsDomainName
cell.field.clearButtonMode = .always cell.field.clearButtonMode = .always
cell.field.keyboardType = .asciiCapable cell.field.keyboardType = .asciiCapable
cell.captionWidth = 160.0 cell.captionWidth = 160.0
cell.delegate = self cell.delegate = self
if networkChoices.dns == .manual { cell.field.isEnabled = (networkChoices.dns == .manual)
cell.field.isEnabled = true
cell.field.placeholder = L10n.Global.Cells.none
} else {
cell.field.isEnabled = false
cell.field.placeholder = nil
}
return cell return cell
case .dnsAddress: case .dnsAddress:
@ -364,18 +359,13 @@ extension NetworkSettingsViewController {
let cell = Cells.field.dequeue(from: tableView, for: indexPath) let cell = Cells.field.dequeue(from: tableView, for: indexPath)
cell.caption = L10n.NetworkSettings.Cells.Address.caption cell.caption = L10n.NetworkSettings.Cells.Address.caption
cell.field.tag = FieldTag.dnsAddress.rawValue + i cell.field.tag = FieldTag.dnsAddress.rawValue + i
cell.field.placeholder = L10n.Global.Cells.none
cell.field.text = networkSettings.dnsServers?[i] cell.field.text = networkSettings.dnsServers?[i]
cell.field.clearButtonMode = .always cell.field.clearButtonMode = .always
cell.field.keyboardType = .decimalPad cell.field.keyboardType = .decimalPad
cell.captionWidth = 160.0 cell.captionWidth = 160.0
cell.delegate = self cell.delegate = self
if networkChoices.dns == .manual { cell.field.isEnabled = (networkChoices.dns == .manual)
cell.field.isEnabled = true
cell.field.placeholder = L10n.Global.Cells.none
} else {
cell.field.isEnabled = false
cell.field.placeholder = nil
}
return cell return cell
case .dnsAddAddress: case .dnsAddAddress:
@ -388,36 +378,26 @@ extension NetworkSettingsViewController {
let cell = Cells.field.dequeue(from: tableView, for: indexPath) let cell = Cells.field.dequeue(from: tableView, for: indexPath)
cell.caption = L10n.NetworkSettings.Cells.Address.caption cell.caption = L10n.NetworkSettings.Cells.Address.caption
cell.field.tag = FieldTag.proxyAddress.rawValue cell.field.tag = FieldTag.proxyAddress.rawValue
cell.field.placeholder = L10n.Global.Cells.none
cell.field.text = networkSettings.proxyAddress cell.field.text = networkSettings.proxyAddress
cell.field.clearButtonMode = .always cell.field.clearButtonMode = .always
cell.field.keyboardType = .decimalPad cell.field.keyboardType = .decimalPad
cell.captionWidth = 160.0 cell.captionWidth = 160.0
cell.delegate = self cell.delegate = self
if networkChoices.proxy == .manual { cell.field.isEnabled = (networkChoices.proxy == .manual)
cell.field.isEnabled = true
cell.field.placeholder = L10n.Global.Cells.none
} else {
cell.field.isEnabled = false
cell.field.placeholder = nil
}
return cell return cell
case .proxyPort: case .proxyPort:
let cell = Cells.field.dequeue(from: tableView, for: indexPath) let cell = Cells.field.dequeue(from: tableView, for: indexPath)
cell.caption = L10n.NetworkSettings.Cells.Port.caption cell.caption = L10n.NetworkSettings.Cells.Port.caption
cell.field.tag = FieldTag.proxyPort.rawValue cell.field.tag = FieldTag.proxyPort.rawValue
cell.field.placeholder = L10n.Global.Cells.none
cell.field.text = networkSettings.proxyPort?.description cell.field.text = networkSettings.proxyPort?.description
cell.field.clearButtonMode = .always cell.field.clearButtonMode = .always
cell.field.keyboardType = .numberPad cell.field.keyboardType = .numberPad
cell.captionWidth = 160.0 cell.captionWidth = 160.0
cell.delegate = self cell.delegate = self
if networkChoices.proxy == .manual { cell.field.isEnabled = (networkChoices.proxy == .manual)
cell.field.isEnabled = true
cell.field.placeholder = L10n.Global.Cells.none
} else {
cell.field.isEnabled = false
cell.field.placeholder = nil
}
return cell return cell
case .proxyBypass: case .proxyBypass:
@ -426,18 +406,13 @@ extension NetworkSettingsViewController {
let cell = Cells.field.dequeue(from: tableView, for: indexPath) let cell = Cells.field.dequeue(from: tableView, for: indexPath)
cell.caption = L10n.NetworkSettings.Cells.ProxyBypass.caption cell.caption = L10n.NetworkSettings.Cells.ProxyBypass.caption
cell.field.tag = FieldTag.proxyBypass.rawValue + i cell.field.tag = FieldTag.proxyBypass.rawValue + i
cell.field.placeholder = L10n.Global.Cells.none
cell.field.text = networkSettings.proxyBypassDomains?[i] cell.field.text = networkSettings.proxyBypassDomains?[i]
cell.field.clearButtonMode = .always cell.field.clearButtonMode = .always
cell.field.keyboardType = .asciiCapable cell.field.keyboardType = .asciiCapable
cell.captionWidth = 160.0 cell.captionWidth = 160.0
cell.delegate = self cell.delegate = self
if networkChoices.proxy == .manual { cell.field.isEnabled = (networkChoices.proxy == .manual)
cell.field.isEnabled = true
cell.field.placeholder = L10n.Global.Cells.none
} else {
cell.field.isEnabled = false
cell.field.placeholder = nil
}
return cell return cell
case .proxyAddBypass: case .proxyAddBypass: