Split and notifications
This commit is contained in:
parent
c497d41a6c
commit
96555b94c3
@ -78,17 +78,26 @@ class DetailViewController: UIViewController {
|
||||
let loadObject = MVMCoreLoadObject(pageJSON: page, modulesJSON: jsonObject.optionalDictionaryForKey(KeyModuleMap), requestParameters: nil, dataForPage: nil, delegateObject: nil),
|
||||
viewController.shouldFinishProcessingLoad(loadObject, error: &errorObject) {
|
||||
|
||||
//let split = MVMCoreUISplitViewController.setup(asMainController: nil, rightPanel: nil)!
|
||||
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 2) {
|
||||
viewController.navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .done, target: self, action: #selector(self.close))
|
||||
Task(priority: .userInitiated) {
|
||||
let gr = UILongPressGestureRecognizer(target: self, action: #selector(DetailViewController.close))
|
||||
viewController.view.addGestureRecognizer(gr)
|
||||
|
||||
let topAlert = NotificationContainerView()
|
||||
CoreUIObject.sharedInstance()?.topNotificationHandler = NotificationHandler(with: topAlert)
|
||||
let split = MVMCoreUISplitViewController.setup(asMainController: nil, rightPanel: nil, topAlert: topAlert)!
|
||||
_ = split.view // Force loadView
|
||||
//split.navigationController?.setViewControllers([viewController], animated: false)
|
||||
|
||||
let done = UIBarButtonItem(barButtonSystemItem: .done, target: self, action: #selector(self.close))
|
||||
let spacer = UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: self, action: nil)
|
||||
split.navigationController?.isToolbarHidden = false
|
||||
viewController.setToolbarItems([spacer, done], animated: false)
|
||||
split.navigationController?.setToolbarItems([spacer, done], animated: false)
|
||||
|
||||
NavigationHandler.shared().viewControllerToPresentOn = splitViewController
|
||||
await NavigationHandler.shared().present(viewController: split)
|
||||
await NavigationHandler.shared().push(viewController: viewController, animated: false)
|
||||
}
|
||||
let gr = UILongPressGestureRecognizer(target: self, action: #selector(DetailViewController.close))
|
||||
viewController.view.addGestureRecognizer(gr)
|
||||
let navigation = NavigationController.setupNavigationControllerAsMainController()!
|
||||
navigation.pushViewController(viewController, animated: false)
|
||||
MVMCoreNavigationHandler.shared()?.viewControllerToPresentOn = splitViewController
|
||||
MVMCoreNavigationHandler.shared()?.present(navigation, animated: true)
|
||||
|
||||
} else if let errorObject = errorObject {
|
||||
let error = NSError(domain: ErrorDomainNative, code: ErrorCode.initViewController.rawValue, userInfo: [NSLocalizedDescriptionKey: errorObject.messageToLog ?? errorObject.messageToDisplay!])
|
||||
showError(error)
|
||||
@ -100,7 +109,10 @@ class DetailViewController: UIViewController {
|
||||
}
|
||||
|
||||
@objc func close() {
|
||||
MVMCoreNavigationHandler.shared()?.dismissTopViewController(animated: true)
|
||||
guard let splitViewController = splitViewController else { return }
|
||||
Task(priority: .userInitiated) {
|
||||
await NavigationHandler.shared().navigate(with: .dismiss(viewController: splitViewController))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user