Fixed editable KeyValueCells being copyable

Fixed DNS servers not saving
This commit is contained in:
Eric Kuck 2018-12-14 21:48:48 -06:00
parent 424c6d1173
commit 0ea2e0d11b
2 changed files with 1 additions and 4 deletions

View File

@ -29,6 +29,7 @@ class TunnelEditEditableKeyValueCell: TunnelEditKeyValueCell {
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier) super.init(style: style, reuseIdentifier: reuseIdentifier)
copyableGesture = false
valueTextField.textColor = .black valueTextField.textColor = .black
valueTextField.isEnabled = true valueTextField.isEnabled = true
valueLabelScrollView.isScrollEnabled = false valueLabelScrollView.isScrollEnabled = false

View File

@ -246,7 +246,6 @@ extension TunnelEditTableViewController {
// Bind values to view model // Bind values to view model
cell.value = tunnelViewModel.interfaceData[field] cell.value = tunnelViewModel.interfaceData[field]
if field == .dns { // While editing DNS, you might directly set exclude private IPs if field == .dns { // While editing DNS, you might directly set exclude private IPs
cell.onValueChanged = nil
cell.onValueBeingEdited = { [weak self] value in cell.onValueBeingEdited = { [weak self] value in
self?.tunnelViewModel.interfaceData[field] = value self?.tunnelViewModel.interfaceData[field] = value
} }
@ -254,7 +253,6 @@ extension TunnelEditTableViewController {
cell.onValueChanged = { [weak self] value in cell.onValueChanged = { [weak self] value in
self?.tunnelViewModel.interfaceData[field] = value self?.tunnelViewModel.interfaceData[field] = value
} }
cell.onValueBeingEdited = nil
} }
// Compute public key live // Compute public key live
if field == .privateKey { if field == .privateKey {
@ -266,8 +264,6 @@ extension TunnelEditTableViewController {
self.tableView.reloadRows(at: [IndexPath(row: row, section: indexPath.section)], with: .none) self.tableView.reloadRows(at: [IndexPath(row: row, section: indexPath.section)], with: .none)
} }
} }
} else {
cell.onValueBeingEdited = nil
} }
return cell return cell
} }