VPN: Adding, modifying and deleting actual NETunnelProviderManager instances
Signed-off-by: Roopesh Chander <roop@roopc.net>
This commit is contained in:
@@ -25,7 +25,7 @@ class TunnelDetailTableViewController: UITableViewController {
|
||||
init(tunnelsManager tm: TunnelsManager, tunnel t: TunnelContainer) {
|
||||
tunnelsManager = tm
|
||||
tunnel = t
|
||||
tunnelViewModel = TunnelViewModel(tunnelConfiguration: t.tunnelConfiguration)
|
||||
tunnelViewModel = TunnelViewModel(tunnelConfiguration: t.tunnelConfiguration())
|
||||
super.init(style: .grouped)
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ class TunnelDetailTableViewController: UITableViewController {
|
||||
|
||||
extension TunnelDetailTableViewController: TunnelEditTableViewControllerDelegate {
|
||||
func tunnelSaved(tunnel: TunnelContainer) {
|
||||
tunnelViewModel = TunnelViewModel(tunnelConfiguration: tunnel.tunnelConfiguration)
|
||||
tunnelViewModel = TunnelViewModel(tunnelConfiguration: tunnel.tunnelConfiguration())
|
||||
self.tableView.reloadData()
|
||||
}
|
||||
func tunnelEditingCancelled() {
|
||||
|
||||
@@ -34,7 +34,7 @@ class TunnelEditTableViewController: UITableViewController {
|
||||
// Use this initializer to edit an existing tunnel.
|
||||
tunnelsManager = tm
|
||||
tunnel = t
|
||||
tunnelViewModel = TunnelViewModel(tunnelConfiguration: t.tunnelConfiguration)
|
||||
tunnelViewModel = TunnelViewModel(tunnelConfiguration: t.tunnelConfiguration())
|
||||
super.init(style: .grouped)
|
||||
}
|
||||
|
||||
@@ -92,7 +92,9 @@ class TunnelEditTableViewController: UITableViewController {
|
||||
self?.showErrorAlert(title: "Could not save", message: "Internal error")
|
||||
} else {
|
||||
self?.dismiss(animated: true, completion: nil)
|
||||
self?.delegate?.tunnelSaved(tunnel: tunnel)
|
||||
if let tunnel = tunnel {
|
||||
self?.delegate?.tunnelSaved(tunnel: tunnel)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,8 +165,16 @@ extension TunnelsListTableViewController {
|
||||
// MARK: TunnelsManagerDelegate
|
||||
|
||||
extension TunnelsListTableViewController: TunnelsManagerDelegate {
|
||||
func tunnelsAdded(atIndex index: Int, numberOfTunnels: Int) {
|
||||
self.tableView.insertRows(at: [IndexPath(row: index, section: 0)], with: .automatic)
|
||||
func tunnelAdded(at index: Int) {
|
||||
tableView.insertRows(at: [IndexPath(row: index, section: 0)], with: .automatic)
|
||||
}
|
||||
|
||||
func tunnelModified(at index: Int) {
|
||||
tableView.reloadRows(at: [IndexPath(row: index, section: 0)], with: .automatic)
|
||||
}
|
||||
|
||||
func tunnelsChanged() {
|
||||
tableView.reloadData()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user