diff --git a/Passepartout-iOS/AppDelegate.swift b/Passepartout-iOS/AppDelegate.swift index 9714d8f1..ddd18ddb 100644 --- a/Passepartout-iOS/AppDelegate.swift +++ b/Passepartout-iOS/AppDelegate.swift @@ -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 diff --git a/Passepartout-iOS/Scenes/Organizer/WizardHostViewController.swift b/Passepartout-iOS/Scenes/Organizer/WizardHostViewController.swift index 6f044c61..3c7531db 100644 --- a/Passepartout-iOS/Scenes/Organizer/WizardHostViewController.swift +++ b/Passepartout-iOS/Scenes/Organizer/WizardHostViewController.swift @@ -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) } }