diff --git a/iOS/Article/ArticleViewController.swift b/iOS/Article/ArticleViewController.swift index e6dc35fd9..c791206a8 100644 --- a/iOS/Article/ArticleViewController.swift +++ b/iOS/Article/ArticleViewController.swift @@ -114,6 +114,14 @@ class ArticleViewController: UIViewController { NotificationCenter.default.addObserver(self, selector: #selector(contentSizeCategoryDidChange(_:)), name: UIContentSizeCategory.didChangeNotification, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(willEnterForeground(_:)), name: UIApplication.willEnterForegroundNotification, object: nil) + let fullScreenTapZone = UIView() + NSLayoutConstraint.activate([ + fullScreenTapZone.widthAnchor.constraint(equalToConstant: 150), + fullScreenTapZone.heightAnchor.constraint(equalToConstant: 44) + ]) + fullScreenTapZone.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(didTapNavigationBar))) + navigationItem.titleView = fullScreenTapZone + articleExtractorButton.addTarget(self, action: #selector(toggleArticleExtractor(_:)), for: .touchUpInside) toolbarItems?.insert(UIBarButtonItem(customView: articleExtractorButton), at: 6) @@ -275,6 +283,10 @@ class ArticleViewController: UIViewController { // MARK: Actions + @objc func didTapNavigationBar() { + hideBars() + } + @objc func showBars(_ sender: Any) { showBars() } @@ -356,14 +368,6 @@ class ArticleViewController: UIViewController { } -// MARK: InteractiveNavigationControllerTappable - -extension ArticleViewController: InteractiveNavigationControllerTappable { - func didTapNavigationBar() { - hideBars() - } -} - // MARK: UIContextMenuInteractionDelegate extension ArticleViewController: UIContextMenuInteractionDelegate { diff --git a/iOS/UIKit Extensions/InteractiveNavigationController.swift b/iOS/UIKit Extensions/InteractiveNavigationController.swift index 44b0b7dfa..e486a739a 100644 --- a/iOS/UIKit Extensions/InteractiveNavigationController.swift +++ b/iOS/UIKit Extensions/InteractiveNavigationController.swift @@ -8,10 +8,6 @@ import UIKit -protocol InteractiveNavigationControllerTappable { - func didTapNavigationBar() -} - class InteractiveNavigationController: UINavigationController { private let poppableDelegate = PoppableGestureRecognizerDelegate() @@ -33,8 +29,6 @@ class InteractiveNavigationController: UINavigationController { poppableDelegate.originalDelegate = interactivePopGestureRecognizer?.delegate poppableDelegate.navigationController = self interactivePopGestureRecognizer?.delegate = poppableDelegate - - navigationBar.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(didTapNavigationBar))) } override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) { @@ -44,13 +38,7 @@ class InteractiveNavigationController: UINavigationController { } } - @objc func didTapNavigationBar() { - if let tappable = topViewController as? InteractiveNavigationControllerTappable { - tappable.didTapNavigationBar() - } } - -} // MARK: Private