Commit ea98aa1b by Demid Merzlyakov

IOS-69: close presented web view on the menu, when leaving the app, so that we…

IOS-69: close presented web view on the menu, when leaving the app, so that we didn't leave a blank screen in case of redirect to the AppStore.
parent b0b13c12
......@@ -22,6 +22,20 @@ class MenuViewController: UIViewController {
self.menuCellFactory = MenuCellFactory(viewModel: menuViewModel)
super.init(nibName: nil, bundle: nil)
self.viewModel.delegate = self
if #available(iOS 13.0, *) {
NotificationCenter.default.addObserver(self, selector: #selector(appWillEnterBackgroundHandler), name: UIScene.willDeactivateNotification, object: nil)
} else {
NotificationCenter.default.addObserver(self, selector: #selector(appWillEnterBackgroundHandler), name: UIApplication.willResignActiveNotification, object: nil)
}
}
@objc
private func appWillEnterBackgroundHandler() {
self.presentedViewController?.dismiss(animated: false, completion: nil)
}
deinit {
NotificationCenter.default.removeObserver(self)
}
required init?(coder: NSCoder) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment