Tunnel editing: Delegate should also report when editing is cancelled
This commit is contained in:
parent
4e2a1aa07a
commit
b2ad15da55
|
@ -54,10 +54,13 @@ class TunnelDetailTableViewController: UITableViewController {
|
|||
// MARK: TunnelEditTableViewControllerDelegate
|
||||
|
||||
extension TunnelDetailTableViewController: TunnelEditTableViewControllerDelegate {
|
||||
func saved(tunnel: TunnelContainer) {
|
||||
func tunnelSaved(tunnel: TunnelContainer) {
|
||||
tunnelViewModel = TunnelViewModel(tunnelConfiguration: tunnel.tunnelConfiguration)
|
||||
self.tableView.reloadData()
|
||||
}
|
||||
func tunnelEditingCancelled() {
|
||||
// Nothing to do
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: UITableViewDataSource
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
import UIKit
|
||||
|
||||
protocol TunnelEditTableViewControllerDelegate: class {
|
||||
func saved(tunnel: TunnelContainer)
|
||||
func tunnelSaved(tunnel: TunnelContainer)
|
||||
func tunnelEditingCancelled()
|
||||
}
|
||||
|
||||
// MARK: TunnelEditTableViewController
|
||||
|
@ -81,8 +82,8 @@ class TunnelEditTableViewController: UITableViewController {
|
|||
print("Could not modify tunnel: \(error)")
|
||||
self?.showErrorAlert(title: "Could not save", message: "Internal error")
|
||||
} else {
|
||||
self?.delegate?.saved(tunnel: tunnel)
|
||||
self?.dismiss(animated: true, completion: nil)
|
||||
self?.delegate?.tunnelSaved(tunnel: tunnel)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -92,8 +93,8 @@ class TunnelEditTableViewController: UITableViewController {
|
|||
print("Could not add tunnel: \(error)")
|
||||
self?.showErrorAlert(title: "Could not save", message: "Internal error")
|
||||
} else {
|
||||
self?.delegate?.saved(tunnel: tunnel)
|
||||
self?.dismiss(animated: true, completion: nil)
|
||||
self?.delegate?.tunnelSaved(tunnel: tunnel)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -102,6 +103,7 @@ class TunnelEditTableViewController: UITableViewController {
|
|||
|
||||
@objc func cancelTapped() {
|
||||
dismiss(animated: true, completion: nil)
|
||||
self.delegate?.tunnelEditingCancelled()
|
||||
}
|
||||
|
||||
func showErrorAlert(title: String, message: String) {
|
||||
|
|
|
@ -94,12 +94,15 @@ class TunnelsListTableViewController: UITableViewController {
|
|||
// MARK: TunnelEditTableViewControllerDelegate
|
||||
|
||||
extension TunnelsListTableViewController: TunnelEditTableViewControllerDelegate {
|
||||
func saved(tunnel: TunnelContainer) {
|
||||
func tunnelSaved(tunnel: TunnelContainer) {
|
||||
guard let tunnelsManager = tunnelsManager else { return }
|
||||
let tunnelDetailVC = TunnelDetailTableViewController(tunnelsManager: tunnelsManager,
|
||||
tunnel: tunnel)
|
||||
showDetailViewController(tunnelDetailVC, sender: self) // Shall get propagated up to the split-vc
|
||||
}
|
||||
func tunnelEditingCancelled() {
|
||||
// Nothing to do here
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: UITableViewDataSource
|
||||
|
|
Loading…
Reference in New Issue