fix(ios): better "install from file" view hierarchy placement

This commit is contained in:
jahorton 2021-01-25 15:54:39 +07:00
parent af06478b73
commit b205d1efff
2 changed files with 10 additions and 6 deletions

View file

@ -110,14 +110,14 @@ class MainViewController: UIViewController, TextViewDelegate, UIActionSheetDeleg
// We have to gerry-rig this so that the framework-based SettingsViewController
// can launch the app-based DocumentViewController.
if #available(iOS 11.0, *) {
Manager.shared.fileBrowserLauncher = { _ in
Manager.shared.fileBrowserLauncher = { navVC in
let vc = PackageBrowserViewController(documentTypes: ["com.keyman.kmp"],
in: .import,
navVC: self.navigationController!)
navVC: navVC)
// Auto-dismiss the settings menu, then present the "install from file" browser.
self.navigationController!.topViewController!.dismiss(animated: true, completion: nil)
self.present(vc, animated: true)
// Present the "install from file" browser within the specified navigation view controller.
// (Allows displaying from within the Settings menu)
navVC.present(vc, animated: true)
}
}
}

View file

@ -97,7 +97,11 @@ class PackageBrowserViewController: UIDocumentPickerViewController, UIDocumentPi
activitySpinner.stopAnimating()
activitySpinner.removeFromSuperview()
self.view.isUserInteractionEnabled = true
self.dismiss(animated: true, completion: nil)
if let navVC = self.navVC {
navVC.dismiss(animated: true, completion: nil)
} else {
self.dismiss(animated: true, completion: nil)
}
}
}