Delete openURL .ovpn on Cancel
This commit is contained in:
parent
0d23187eef
commit
42c94c3a14
|
@ -99,6 +99,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele
|
|||
// already presented: update parsed configuration
|
||||
if let nav = root.presentedViewController as? UINavigationController, let wizard = nav.topViewController as? WizardHostViewController {
|
||||
wizard.parsedFile = parsedFile
|
||||
wizard.removesConfigurationOnCancel = true
|
||||
return true
|
||||
}
|
||||
|
||||
|
@ -108,6 +109,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele
|
|||
fatalError("Expected WizardHostViewController from storyboard")
|
||||
}
|
||||
wizard.parsedFile = parsedFile
|
||||
wizard.removesConfigurationOnCancel = true
|
||||
|
||||
// best effort to delegate to main vc
|
||||
let split = root as? UISplitViewController
|
||||
|
|
|
@ -41,6 +41,8 @@ class WizardHostViewController: UITableViewController, TableModelHost, Wizard {
|
|||
useSuggestedTitle()
|
||||
}
|
||||
}
|
||||
|
||||
var removesConfigurationOnCancel = false
|
||||
|
||||
private var createdProfile: HostConnectionProfile?
|
||||
|
||||
|
@ -148,6 +150,9 @@ class WizardHostViewController: UITableViewController, TableModelHost, Wizard {
|
|||
}
|
||||
|
||||
@IBAction private func close() {
|
||||
if removesConfigurationOnCancel, let url = parsedFile?.url {
|
||||
try? FileManager.default.removeItem(at: url)
|
||||
}
|
||||
dismiss(animated: true, completion: nil)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue