Tunnel edit: init() need not take a tunnelConfiguration argument

This commit is contained in:
Roopesh Chander 2018-12-19 16:30:34 +05:30
parent d36b764e20
commit d82aedebbd
2 changed files with 5 additions and 6 deletions

View File

@ -55,12 +55,11 @@ class TunnelEditTableViewController: UITableViewController {
loadSections() loadSections()
} }
init(tunnelsManager: TunnelsManager, tunnelConfiguration: TunnelConfiguration?) { init(tunnelsManager: TunnelsManager) {
// Use this initializer to create a new tunnel. // Use this initializer to create a new tunnel.
// If tunnelConfiguration is passed, data will be prepopulated from that configuration.
self.tunnelsManager = tunnelsManager self.tunnelsManager = tunnelsManager
tunnel = nil tunnel = nil
tunnelViewModel = TunnelViewModel(tunnelConfiguration: tunnelConfiguration) tunnelViewModel = TunnelViewModel(tunnelConfiguration: nil)
activateOnDemandSetting = ActivateOnDemandSetting.defaultSetting activateOnDemandSetting = ActivateOnDemandSetting.defaultSetting
super.init(style: .grouped) super.init(style: .grouped)
loadSections() loadSections()

View File

@ -110,7 +110,7 @@ class TunnelsListTableViewController: UIViewController {
let createFromScratchAction = UIAlertAction(title: "Create from scratch", style: .default) { [weak self] _ in let createFromScratchAction = UIAlertAction(title: "Create from scratch", style: .default) { [weak self] _ in
if let self = self, let tunnelsManager = self.tunnelsManager { if let self = self, let tunnelsManager = self.tunnelsManager {
self.presentViewControllerForTunnelCreation(tunnelsManager: tunnelsManager, tunnelConfiguration: nil) self.presentViewControllerForTunnelCreation(tunnelsManager: tunnelsManager)
} }
} }
alert.addAction(createFromScratchAction) alert.addAction(createFromScratchAction)
@ -136,8 +136,8 @@ class TunnelsListTableViewController: UIViewController {
present(settingsNC, animated: true) present(settingsNC, animated: true)
} }
func presentViewControllerForTunnelCreation(tunnelsManager: TunnelsManager, tunnelConfiguration: TunnelConfiguration?) { func presentViewControllerForTunnelCreation(tunnelsManager: TunnelsManager) {
let editVC = TunnelEditTableViewController(tunnelsManager: tunnelsManager, tunnelConfiguration: tunnelConfiguration) let editVC = TunnelEditTableViewController(tunnelsManager: tunnelsManager)
let editNC = UINavigationController(rootViewController: editVC) let editNC = UINavigationController(rootViewController: editVC)
editNC.modalPresentationStyle = .formSheet editNC.modalPresentationStyle = .formSheet
present(editNC, animated: true) present(editNC, animated: true)