Tunnel editing: Fix cell class names
This commit is contained in:
parent
b9c3e062ea
commit
90eac14b9a
|
@ -60,9 +60,9 @@ class TunnelEditTableViewController: UITableViewController {
|
||||||
self.tableView.rowHeight = 44
|
self.tableView.rowHeight = 44
|
||||||
self.tableView.allowsSelection = false
|
self.tableView.allowsSelection = false
|
||||||
|
|
||||||
self.tableView.register(TunnelsEditTableViewKeyValueCell.self, forCellReuseIdentifier: TunnelsEditTableViewKeyValueCell.id)
|
self.tableView.register(TunnelEditTableViewKeyValueCell.self, forCellReuseIdentifier: TunnelEditTableViewKeyValueCell.id)
|
||||||
self.tableView.register(TunnelsEditTableViewButtonCell.self, forCellReuseIdentifier: TunnelsEditTableViewButtonCell.id)
|
self.tableView.register(TunnelEditTableViewButtonCell.self, forCellReuseIdentifier: TunnelEditTableViewButtonCell.id)
|
||||||
self.tableView.register(TunnelsEditTableViewSwitchCell.self, forCellReuseIdentifier: TunnelsEditTableViewSwitchCell.id)
|
self.tableView.register(TunnelEditTableViewSwitchCell.self, forCellReuseIdentifier: TunnelEditTableViewSwitchCell.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc func saveTapped() {
|
@objc func saveTapped() {
|
||||||
|
@ -175,7 +175,7 @@ extension TunnelEditTableViewController {
|
||||||
let interfaceData = tunnelViewModel.interfaceData
|
let interfaceData = tunnelViewModel.interfaceData
|
||||||
let field = interfaceFieldsBySection[section][row]
|
let field = interfaceFieldsBySection[section][row]
|
||||||
if (field == .generateKeyPair) {
|
if (field == .generateKeyPair) {
|
||||||
let cell = tableView.dequeueReusableCell(withIdentifier: TunnelsEditTableViewButtonCell.id, for: indexPath) as! TunnelsEditTableViewButtonCell
|
let cell = tableView.dequeueReusableCell(withIdentifier: TunnelEditTableViewButtonCell.id, for: indexPath) as! TunnelEditTableViewButtonCell
|
||||||
cell.buttonText = field.rawValue
|
cell.buttonText = field.rawValue
|
||||||
cell.onTapped = { [weak self, weak interfaceData] in
|
cell.onTapped = { [weak self, weak interfaceData] in
|
||||||
if let interfaceData = interfaceData, let s = self {
|
if let interfaceData = interfaceData, let s = self {
|
||||||
|
@ -190,7 +190,7 @@ extension TunnelEditTableViewController {
|
||||||
}
|
}
|
||||||
return cell
|
return cell
|
||||||
} else {
|
} else {
|
||||||
let cell = tableView.dequeueReusableCell(withIdentifier: TunnelsEditTableViewKeyValueCell.id, for: indexPath) as! TunnelsEditTableViewKeyValueCell
|
let cell = tableView.dequeueReusableCell(withIdentifier: TunnelEditTableViewKeyValueCell.id, for: indexPath) as! TunnelEditTableViewKeyValueCell
|
||||||
// Set key
|
// Set key
|
||||||
cell.key = field.rawValue
|
cell.key = field.rawValue
|
||||||
// Set placeholder text
|
// Set placeholder text
|
||||||
|
@ -228,7 +228,7 @@ extension TunnelEditTableViewController {
|
||||||
let peerData = tunnelViewModel.peersData[peerIndex]
|
let peerData = tunnelViewModel.peersData[peerIndex]
|
||||||
let field = peerFieldsBySection[peerSectionIndex][row]
|
let field = peerFieldsBySection[peerSectionIndex][row]
|
||||||
if (field == .deletePeer) {
|
if (field == .deletePeer) {
|
||||||
let cell = tableView.dequeueReusableCell(withIdentifier: TunnelsEditTableViewButtonCell.id, for: indexPath) as! TunnelsEditTableViewButtonCell
|
let cell = tableView.dequeueReusableCell(withIdentifier: TunnelEditTableViewButtonCell.id, for: indexPath) as! TunnelEditTableViewButtonCell
|
||||||
cell.buttonText = field.rawValue
|
cell.buttonText = field.rawValue
|
||||||
cell.onTapped = { [weak self, weak peerData] in
|
cell.onTapped = { [weak self, weak peerData] in
|
||||||
guard let peerData = peerData else { return }
|
guard let peerData = peerData else { return }
|
||||||
|
@ -243,11 +243,11 @@ extension TunnelEditTableViewController {
|
||||||
}
|
}
|
||||||
return cell
|
return cell
|
||||||
} else if (field == .excludePrivateIPs) {
|
} else if (field == .excludePrivateIPs) {
|
||||||
let cell = tableView.dequeueReusableCell(withIdentifier: TunnelsEditTableViewSwitchCell.id, for: indexPath) as! TunnelsEditTableViewSwitchCell
|
let cell = tableView.dequeueReusableCell(withIdentifier: TunnelEditTableViewSwitchCell.id, for: indexPath) as! TunnelEditTableViewSwitchCell
|
||||||
cell.message = field.rawValue
|
cell.message = field.rawValue
|
||||||
return cell
|
return cell
|
||||||
} else {
|
} else {
|
||||||
let cell = tableView.dequeueReusableCell(withIdentifier: TunnelsEditTableViewKeyValueCell.id, for: indexPath) as! TunnelsEditTableViewKeyValueCell
|
let cell = tableView.dequeueReusableCell(withIdentifier: TunnelEditTableViewKeyValueCell.id, for: indexPath) as! TunnelEditTableViewKeyValueCell
|
||||||
// Set key
|
// Set key
|
||||||
cell.key = field.rawValue
|
cell.key = field.rawValue
|
||||||
// Set placeholder text
|
// Set placeholder text
|
||||||
|
@ -264,7 +264,7 @@ extension TunnelEditTableViewController {
|
||||||
} else {
|
} else {
|
||||||
assert(section == (numberOfInterfaceSections + numberOfPeers * numberOfPeerSections))
|
assert(section == (numberOfInterfaceSections + numberOfPeers * numberOfPeerSections))
|
||||||
// Add peer
|
// Add peer
|
||||||
let cell = tableView.dequeueReusableCell(withIdentifier: TunnelsEditTableViewButtonCell.id, for: indexPath) as! TunnelsEditTableViewButtonCell
|
let cell = tableView.dequeueReusableCell(withIdentifier: TunnelEditTableViewButtonCell.id, for: indexPath) as! TunnelEditTableViewButtonCell
|
||||||
cell.buttonText = "Add peer"
|
cell.buttonText = "Add peer"
|
||||||
cell.onTapped = { [weak self] in
|
cell.onTapped = { [weak self] in
|
||||||
guard let s = self else { return }
|
guard let s = self else { return }
|
||||||
|
@ -316,8 +316,8 @@ extension TunnelEditTableViewController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class TunnelsEditTableViewKeyValueCell: UITableViewCell {
|
class TunnelEditTableViewKeyValueCell: UITableViewCell {
|
||||||
static let id: String = "TunnelsEditTableViewKeyValueCell"
|
static let id: String = "TunnelEditTableViewKeyValueCell"
|
||||||
var key: String {
|
var key: String {
|
||||||
get { return keyLabel.text ?? "" }
|
get { return keyLabel.text ?? "" }
|
||||||
set(value) {keyLabel.text = value }
|
set(value) {keyLabel.text = value }
|
||||||
|
@ -401,7 +401,7 @@ class TunnelsEditTableViewKeyValueCell: UITableViewCell {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension TunnelsEditTableViewKeyValueCell: UITextFieldDelegate {
|
extension TunnelEditTableViewKeyValueCell: UITextFieldDelegate {
|
||||||
func textFieldDidBeginEditing(_ textField: UITextField) {
|
func textFieldDidBeginEditing(_ textField: UITextField) {
|
||||||
textFieldValueOnBeginEditing = textField.text ?? ""
|
textFieldValueOnBeginEditing = textField.text ?? ""
|
||||||
isValueValid = true
|
isValueValid = true
|
||||||
|
@ -422,8 +422,8 @@ extension TunnelsEditTableViewKeyValueCell: UITextFieldDelegate {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class TunnelsEditTableViewButtonCell: UITableViewCell {
|
class TunnelEditTableViewButtonCell: UITableViewCell {
|
||||||
static let id: String = "TunnelsEditTableViewButtonCell"
|
static let id: String = "TunnelEditTableViewButtonCell"
|
||||||
var buttonText: String {
|
var buttonText: String {
|
||||||
get { return button.title(for: .normal) ?? "" }
|
get { return button.title(for: .normal) ?? "" }
|
||||||
set(value) { button.setTitle(value, for: .normal) }
|
set(value) { button.setTitle(value, for: .normal) }
|
||||||
|
@ -458,8 +458,8 @@ class TunnelsEditTableViewButtonCell: UITableViewCell {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class TunnelsEditTableViewSwitchCell: UITableViewCell {
|
class TunnelEditTableViewSwitchCell: UITableViewCell {
|
||||||
static let id: String = "TunnelsEditTableViewSwitchCell"
|
static let id: String = "TunnelEditTableViewSwitchCell"
|
||||||
var message: String {
|
var message: String {
|
||||||
get { return textLabel?.text ?? "" }
|
get { return textLabel?.text ?? "" }
|
||||||
set(value) { textLabel!.text = value }
|
set(value) { textLabel!.text = value }
|
||||||
|
|
Loading…
Reference in New Issue