From fc235a029e586a437e3c10f1ce372fbcffb79899 Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Mon, 18 Nov 2019 19:12:24 -0600 Subject: [PATCH] Remove toolbar autohiding and add optional fullscreen mode. --- NetNewsWire.xcodeproj/project.pbxproj | 12 ++- iOS/Article/ArticleViewController.swift | 52 +++++++------ iOS/Base.lproj/Main.storyboard | 11 +++ .../MasterTimelineViewController.swift | 5 ++ iOS/RootSplitViewController.swift | 8 ++ iOS/SceneCoordinator.swift | 41 ++++++---- .../InteractiveNavigationController.swift | 77 +++++++++++++++++++ .../PoppableGestureRecognizerDelegate.swift | 40 ++++++++++ .../UISplitViewController-Extensions.swift | 2 +- 9 files changed, 206 insertions(+), 42 deletions(-) create mode 100644 iOS/UIKit Extensions/InteractiveNavigationController.swift create mode 100644 iOS/UIKit Extensions/PoppableGestureRecognizerDelegate.swift diff --git a/NetNewsWire.xcodeproj/project.pbxproj b/NetNewsWire.xcodeproj/project.pbxproj index 0277c54d3..92322aad5 100644 --- a/NetNewsWire.xcodeproj/project.pbxproj +++ b/NetNewsWire.xcodeproj/project.pbxproj @@ -114,7 +114,7 @@ 518B2EE82351B45600400001 /* NetNewsWire_iOSTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 840D61952029031D009BC708 /* NetNewsWire_iOSTests.swift */; }; 518C3193237B00D9004D740F /* ArticleIconSchemeHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5141E7552374A2890013FF27 /* ArticleIconSchemeHandler.swift */; }; 518C3194237B00DA004D740F /* ArticleIconSchemeHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5141E7552374A2890013FF27 /* ArticleIconSchemeHandler.swift */; }; - 51934CCB230F599B006127BE /* ThemedNavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51934CC1230F5963006127BE /* ThemedNavigationController.swift */; }; + 51934CCB230F599B006127BE /* InteractiveNavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51934CC1230F5963006127BE /* InteractiveNavigationController.swift */; }; 51934CCE2310792F006127BE /* ActivityManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51934CCD2310792F006127BE /* ActivityManager.swift */; }; 51938DF2231AFC660055A1A0 /* SearchTimelineFeedDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51938DF1231AFC660055A1A0 /* SearchTimelineFeedDelegate.swift */; }; 51938DF3231AFC660055A1A0 /* SearchTimelineFeedDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51938DF1231AFC660055A1A0 /* SearchTimelineFeedDelegate.swift */; }; @@ -139,6 +139,7 @@ 51A9A5F22380DE520033AADF /* AddWebFeedDefaultContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A66684238075AE00CB272D /* AddWebFeedDefaultContainer.swift */; }; 51A9A5F32380DE530033AADF /* AddWebFeedDefaultContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A66684238075AE00CB272D /* AddWebFeedDefaultContainer.swift */; }; 51A9A5F52380F6A60033AADF /* ModalNavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A9A5F42380F6A60033AADF /* ModalNavigationController.swift */; }; + 51A9A60A2382FD240033AADF /* PoppableGestureRecognizerDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A9A6092382FD240033AADF /* PoppableGestureRecognizerDelegate.swift */; }; 51B62E68233186730085F949 /* IconView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51B62E67233186730085F949 /* IconView.swift */; }; 51BB7C272335A8E5008E8144 /* ArticleActivityItemSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51BB7C262335A8E5008E8144 /* ArticleActivityItemSource.swift */; }; 51BB7C312335ACDE008E8144 /* page.html in Resources */ = {isa = PBXBuildFile; fileRef = 51BB7C302335ACDE008E8144 /* page.html */; }; @@ -1286,7 +1287,7 @@ 5186A634235EF3A800C97195 /* VibrantLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VibrantLabel.swift; sourceTree = ""; }; 518B2ED22351B3DD00400001 /* NetNewsWire-iOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "NetNewsWire-iOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 518B2EE92351B4C200400001 /* NetNewsWire_iOSTests_target.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = NetNewsWire_iOSTests_target.xcconfig; sourceTree = ""; }; - 51934CC1230F5963006127BE /* ThemedNavigationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThemedNavigationController.swift; sourceTree = ""; }; + 51934CC1230F5963006127BE /* InteractiveNavigationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InteractiveNavigationController.swift; sourceTree = ""; }; 51934CCD2310792F006127BE /* ActivityManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActivityManager.swift; sourceTree = ""; }; 51938DF1231AFC660055A1A0 /* SearchTimelineFeedDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchTimelineFeedDelegate.swift; sourceTree = ""; }; 519B8D322143397200FA689C /* SharingServiceDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SharingServiceDelegate.swift; sourceTree = ""; }; @@ -1303,6 +1304,7 @@ 51A9A5E52380C8B20033AADF /* ShareFolderPickerFolderCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ShareFolderPickerFolderCell.xib; sourceTree = ""; }; 51A9A5E72380CA130033AADF /* ShareFolderPickerCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareFolderPickerCell.swift; sourceTree = ""; }; 51A9A5F42380F6A60033AADF /* ModalNavigationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ModalNavigationController.swift; sourceTree = ""; }; + 51A9A6092382FD240033AADF /* PoppableGestureRecognizerDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PoppableGestureRecognizerDelegate.swift; sourceTree = ""; }; 51B62E67233186730085F949 /* IconView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IconView.swift; sourceTree = ""; }; 51BB7C262335A8E5008E8144 /* ArticleActivityItemSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArticleActivityItemSource.swift; sourceTree = ""; }; 51BB7C302335ACDE008E8144 /* page.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = page.html; sourceTree = ""; }; @@ -1857,7 +1859,7 @@ 5183CCCF226E1E880010922C /* NonIntrinsicLabel.swift */, 512363372369155100951F16 /* RoundedProgressView.swift */, 51C45250226506F400C03939 /* String-Extensions.swift */, - 51934CC1230F5963006127BE /* ThemedNavigationController.swift */, + 51934CC1230F5963006127BE /* InteractiveNavigationController.swift */, 5108F6D723763094001ABC45 /* TickMarkSlider.swift */, 51F85BF82274AA7B00C787DC /* UIBarButtonItem-Extensions.swift */, 51F85BF622749FA100C787DC /* UIFont-Extensions.swift */, @@ -1867,6 +1869,7 @@ 5186A634235EF3A800C97195 /* VibrantLabel.swift */, 5F323808231DF9F000706F6B /* VibrantTableViewCell.swift */, 51A9A5F42380F6A60033AADF /* ModalNavigationController.swift */, + 51A9A6092382FD240033AADF /* PoppableGestureRecognizerDelegate.swift */, ); path = "UIKit Extensions"; sourceTree = ""; @@ -3971,6 +3974,7 @@ 51C4526A226508F600C03939 /* MasterFeedTableViewCellLayout.swift in Sources */, 51C452AE2265104D00C03939 /* ArticleStringFormatter.swift in Sources */, 512E08E62268800D00BDCFDD /* FolderTreeControllerDelegate.swift in Sources */, + 51A9A60A2382FD240033AADF /* PoppableGestureRecognizerDelegate.swift in Sources */, 51C4529922650A0000C03939 /* ArticleStylesManager.swift in Sources */, 51EF0F802277A8330050506E /* MasterTimelineCellLayout.swift in Sources */, 51F85BF722749FA100C787DC /* UIFont-Extensions.swift in Sources */, @@ -4026,7 +4030,7 @@ 51A1699D235E10D700EB091F /* SettingsViewController.swift in Sources */, 51C45293226509C800C03939 /* StarredFeedDelegate.swift in Sources */, 51D6A5BC23199C85001C27D8 /* MasterTimelineDataSource.swift in Sources */, - 51934CCB230F599B006127BE /* ThemedNavigationController.swift in Sources */, + 51934CCB230F599B006127BE /* InteractiveNavigationController.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/iOS/Article/ArticleViewController.swift b/iOS/Article/ArticleViewController.swift index 7ea133540..ad24be8f1 100644 --- a/iOS/Article/ArticleViewController.swift +++ b/iOS/Article/ArticleViewController.swift @@ -34,6 +34,7 @@ class ArticleViewController: UIViewController { @IBOutlet private weak var starBarButtonItem: UIBarButtonItem! @IBOutlet private weak var actionBarButtonItem: UIBarButtonItem! @IBOutlet private weak var webViewContainer: UIView! + @IBOutlet private weak var showNavigationView: UIView! @IBOutlet private weak var showToolbarView: UIView! private var articleExtractorButton: ArticleExtractorButton = { @@ -100,11 +101,13 @@ class ArticleViewController: UIViewController { NotificationCenter.default.addObserver(self, selector: #selector(unreadCountDidChange(_:)), name: .UnreadCountDidChange, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(statusesDidChange(_:)), name: .StatusesDidChange, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(contentSizeCategoryDidChange(_:)), name: UIContentSizeCategory.didChangeNotification, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(willEnterForeground(_:)), name: UIApplication.willEnterForegroundNotification, object: nil) articleExtractorButton.addTarget(self, action: #selector(toggleArticleExtractor(_:)), for: .touchUpInside) toolbarItems?.insert(UIBarButtonItem(customView: articleExtractorButton), at: 6) - showToolbarView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(showToolBar(_:)))) + showNavigationView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(showBars(_:)))) + showToolbarView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(showBars(_:)))) ArticleViewControllerWebViewProvider.shared.dequeueWebView() { webView in @@ -112,7 +115,6 @@ class ArticleViewController: UIViewController { self.webViewContainer.addChildAndPin(webView) webView.navigationDelegate = self webView.uiDelegate = self - webView.scrollView.delegate = self webView.configuration.userContentController.add(WrapperScriptMessageHandler(self), name: MessageName.imageWasClicked) webView.configuration.userContentController.add(WrapperScriptMessageHandler(self), name: MessageName.imageWasShown) @@ -126,6 +128,11 @@ class ArticleViewController: UIViewController { } + override func viewDidAppear(_ animated: Bool) { + super.viewDidAppear(true) + coordinator.isArticleViewControllerPending = false + } + func updateUI() { guard let article = currentArticle else { @@ -208,10 +215,14 @@ class ArticleViewController: UIViewController { reloadHTML() } + @objc func willEnterForeground(_ note: Notification) { + showBars() + } + // MARK: Actions - @objc func showToolBar(_ sender: Any) { - showToolbar() + @objc func showBars(_ sender: Any) { + showBars() } @IBAction func toggleArticleExtractor(_ sender: Any) { @@ -295,23 +306,6 @@ class ArticleViewController: UIViewController { } -extension ArticleViewController: UIScrollViewDelegate { - - func scrollViewWillEndDragging(_ scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer) { - if velocity.y > 0.5 { - hideToolbar() - } else if velocity.y < -1.0 { - showToolbar() - } - } - - func scrollViewDidScroll(_ scrollView: UIScrollView) { - if scrollView.contentOffset.y < 20 { - showToolbar() - } - } -} - // MARK: WKNavigationDelegate extension ArticleViewController: WKNavigationDelegate { @@ -348,6 +342,14 @@ extension ArticleViewController: WKNavigationDelegate { } +// MARK: InteractiveNavigationControllerTappable + +extension ArticleViewController: InteractiveNavigationControllerTappable { + func didTapNavigationBar() { + hideBars() + } +} + // MARK: WKUIDelegate extension ArticleViewController: WKUIDelegate { @@ -443,14 +445,18 @@ private extension ArticleViewController { } } - func showToolbar() { + func showBars() { if traitCollection.userInterfaceIdiom == .phone && coordinator.isRootSplitCollapsed { + coordinator.showStatusBar() + navigationController?.setNavigationBarHidden(false, animated: true) navigationController?.setToolbarHidden(false, animated: true) } } - func hideToolbar() { + func hideBars() { if traitCollection.userInterfaceIdiom == .phone && coordinator.isRootSplitCollapsed { + coordinator.hideStatusBar() + navigationController?.setNavigationBarHidden(true, animated: true) navigationController?.setToolbarHidden(true, animated: true) } } diff --git a/iOS/Base.lproj/Main.storyboard b/iOS/Base.lproj/Main.storyboard index 32bdaf65e..dab0d6343 100644 --- a/iOS/Base.lproj/Main.storyboard +++ b/iOS/Base.lproj/Main.storyboard @@ -27,16 +27,26 @@ + + + + + + + + + + @@ -110,6 +120,7 @@ + diff --git a/iOS/MasterTimeline/MasterTimelineViewController.swift b/iOS/MasterTimeline/MasterTimelineViewController.swift index a5f234eb1..6b153cedc 100644 --- a/iOS/MasterTimeline/MasterTimelineViewController.swift +++ b/iOS/MasterTimeline/MasterTimelineViewController.swift @@ -79,6 +79,11 @@ class MasterTimelineViewController: UITableViewController, UndoableCommandRunner } + override func viewDidAppear(_ animated: Bool) { + super.viewDidAppear(true) + coordinator.isTimelineViewControllerPending = false + } + // MARK: Actions @IBAction func markAllAsRead(_ sender: Any) { diff --git a/iOS/RootSplitViewController.swift b/iOS/RootSplitViewController.swift index 48bf64b9f..007425424 100644 --- a/iOS/RootSplitViewController.swift +++ b/iOS/RootSplitViewController.swift @@ -13,6 +13,14 @@ class RootSplitViewController: UISplitViewController { var coordinator: SceneCoordinator! + override var prefersStatusBarHidden: Bool { + return coordinator.prefersStatusBarHidden + } + + override var preferredStatusBarUpdateAnimation: UIStatusBarAnimation { + return .slide + } + override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) { if UIApplication.shared.applicationState != .background { self.coordinator.configureThreePanelMode(for: size) diff --git a/iOS/SceneCoordinator.swift b/iOS/SceneCoordinator.swift index 90bc20a30..fadff4d22 100644 --- a/iOS/SceneCoordinator.swift +++ b/iOS/SceneCoordinator.swift @@ -65,8 +65,8 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider { private var lastSearchScope: SearchScope? = nil private var isSearching: Bool = false private var searchArticleIds: Set? = nil - private var isTimelineViewControllerPending = false - private var isArticleViewControllerPending = false + var isTimelineViewControllerPending = false + var isArticleViewControllerPending = false private(set) var sortDirection = AppDefaults.timelineSortDirection { didSet { @@ -83,6 +83,8 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider { } } + var prefersStatusBarHidden = false + var displayUndoAvailableTip: Bool { get { AppDefaults.displayUndoAvailableTip } set { AppDefaults.displayUndoAvailableTip = newValue } @@ -299,7 +301,7 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider { rootSplitViewController = RootSplitViewController() rootSplitViewController.coordinator = self rootSplitViewController.preferredDisplayMode = .allVisible - rootSplitViewController.viewControllers = [ThemedNavigationController.template()] + rootSplitViewController.viewControllers = [InteractiveNavigationController.template()] rootSplitViewController.delegate = self masterNavigationController = (rootSplitViewController.viewControllers.first as! UINavigationController) @@ -779,6 +781,20 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider { } } + func showStatusBar() { + prefersStatusBarHidden = false + UIView.animate(withDuration: 0.15) { + self.rootSplitViewController.setNeedsStatusBarAppearanceUpdate() + } + } + + func hideStatusBar() { + prefersStatusBarHidden = true + UIView.animate(withDuration: 0.15) { + self.rootSplitViewController.setNeedsStatusBarAppearanceUpdate() + } + } + func showSettings() { let settingsNavController = UIStoryboard.settings.instantiateInitialViewController() as! UINavigationController let settingsViewController = settingsNavController.topViewController as! SettingsViewController @@ -945,13 +961,18 @@ extension SceneCoordinator: UISplitViewControllerDelegate { // MARK: UINavigationControllerDelegate extension SceneCoordinator: UINavigationControllerDelegate { - + func navigationController(_ navigationController: UINavigationController, didShow viewController: UIViewController, animated: Bool) { if UIApplication.shared.applicationState == .background { return } + // Restore any bars hidden by the previous controller + showStatusBar() + navigationController.setNavigationBarHidden(false, animated: true) + navigationController.setToolbarHidden(false, animated: true) + // If we are showing the Feeds and only the feeds start clearing stuff if viewController === masterFeedViewController && !isThreePanelMode && !isTimelineViewControllerPending { activityManager.invalidateCurrentActivities() @@ -959,10 +980,6 @@ extension SceneCoordinator: UINavigationControllerDelegate { return } - if viewController is MasterTimelineViewController { - isTimelineViewControllerPending = false - } - // If we are using a phone and navigate away from the detail, clear up the article resources (including activity). // Don't clear it if we have pushed an ArticleViewController, but don't yet see it on the navigation stack. // This happens when we are going to the next unread and we need to grab another timeline to continue. The @@ -975,10 +992,6 @@ extension SceneCoordinator: UINavigationControllerDelegate { return } - if viewController is ArticleViewController { - isArticleViewControllerPending = false - } - } } @@ -1509,13 +1522,13 @@ private extension SceneCoordinator { func addNavControllerIfNecessary(_ controller: UIViewController, showButton: Bool) -> UIViewController { - if rootSplitViewController.isCollapsed { + if rootSplitViewController.traitCollection.horizontalSizeClass == .compact { return controller } else { - let navController = ThemedNavigationController.template(rootViewController: controller) + let navController = InteractiveNavigationController.template(rootViewController: controller) navController.isToolbarHidden = false if showButton { diff --git a/iOS/UIKit Extensions/InteractiveNavigationController.swift b/iOS/UIKit Extensions/InteractiveNavigationController.swift new file mode 100644 index 000000000..1cf98237a --- /dev/null +++ b/iOS/UIKit Extensions/InteractiveNavigationController.swift @@ -0,0 +1,77 @@ +// +// InteractiveNavigationController.swift +// NetNewsWire +// +// Created by Maurice Parker on 8/22/19. +// Copyright © 2019 Ranchero Software. All rights reserved. +// + +import UIKit + +protocol InteractiveNavigationControllerTappable { + func didTapNavigationBar() +} + +class InteractiveNavigationController: UINavigationController { + + private let poppableDelegate = PoppableGestureRecognizerDelegate() + + static func template() -> UINavigationController { + let navController = InteractiveNavigationController() + navController.configure() + return navController + } + + static func template(rootViewController: UIViewController) -> UINavigationController { + let navController = InteractiveNavigationController(rootViewController: rootViewController) + navController.configure() + return navController + } + + override func viewDidLoad() { + super.viewDidLoad() + poppableDelegate.originalDelegate = interactivePopGestureRecognizer?.delegate + poppableDelegate.navigationController = self + interactivePopGestureRecognizer?.delegate = poppableDelegate + + navigationBar.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(didTapNavigationBar))) + } + + override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) { + super.traitCollectionDidChange(previousTraitCollection) + if traitCollection.userInterfaceStyle != previousTraitCollection?.userInterfaceStyle { + configure() + } + } + + @objc func didTapNavigationBar() { + if let tappable = topViewController as? InteractiveNavigationControllerTappable { + tappable.didTapNavigationBar() + } + } + +} + +// MARK: Private + +private extension InteractiveNavigationController { + + func configure() { + isToolbarHidden = false + view.backgroundColor = AppAssets.barBackgroundColor + + let navigationAppearance = UINavigationBarAppearance() + navigationAppearance.backgroundColor = AppAssets.barBackgroundColor + navigationAppearance.titleTextAttributes = [.foregroundColor: UIColor.label] + navigationAppearance.largeTitleTextAttributes = [.foregroundColor: UIColor.label] + navigationBar.standardAppearance = navigationAppearance + navigationBar.tintColor = AppAssets.primaryAccentColor + + let toolbarAppearance = UIToolbarAppearance() + toolbarAppearance.backgroundColor = AppAssets.barBackgroundColor + toolbar.standardAppearance = toolbarAppearance + toolbar.compactAppearance = toolbarAppearance + toolbar.tintColor = AppAssets.primaryAccentColor + } + +} diff --git a/iOS/UIKit Extensions/PoppableGestureRecognizerDelegate.swift b/iOS/UIKit Extensions/PoppableGestureRecognizerDelegate.swift new file mode 100644 index 000000000..7d32ce2b5 --- /dev/null +++ b/iOS/UIKit Extensions/PoppableGestureRecognizerDelegate.swift @@ -0,0 +1,40 @@ +// +// PoppableGestureRecognizerDelegate.swift +// NetNewsWire-iOS +// +// Created by Maurice Parker on 11/18/19. +// Copyright © 2019 Ranchero Software. All rights reserved. +// +// https://stackoverflow.com/a/38042863 + +import UIKit + +final class PoppableGestureRecognizerDelegate: NSObject, UIGestureRecognizerDelegate { + + weak var navigationController: UINavigationController? + weak var originalDelegate: UIGestureRecognizerDelegate? + + override func responds(to aSelector: Selector!) -> Bool { + if aSelector == #selector(gestureRecognizer(_:shouldReceive:)) { + return true + } else if let responds = originalDelegate?.responds(to: aSelector) { + return responds + } else { + return false + } + } + + override func forwardingTarget(for aSelector: Selector!) -> Any? { + return originalDelegate + } + + func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldReceive touch: UITouch) -> Bool { + if let nav = navigationController, nav.isNavigationBarHidden, nav.viewControllers.count > 1 { + return true + } else if let result = originalDelegate?.gestureRecognizer?(gestureRecognizer, shouldReceive: touch) { + return result + } else { + return false + } + } +} diff --git a/iOS/UIKit Extensions/UISplitViewController-Extensions.swift b/iOS/UIKit Extensions/UISplitViewController-Extensions.swift index 979bdd1e7..63e9acc18 100644 --- a/iOS/UIKit Extensions/UISplitViewController-Extensions.swift +++ b/iOS/UIKit Extensions/UISplitViewController-Extensions.swift @@ -13,7 +13,7 @@ extension UISplitViewController { static func template() -> UISplitViewController { let splitViewController = UISplitViewController() splitViewController.preferredDisplayMode = .automatic - splitViewController.viewControllers = [ThemedNavigationController.template()] + splitViewController.viewControllers = [InteractiveNavigationController.template()] return splitViewController }