Merge pull request #3431 from stuartbreckenridge/ios-ui-navbartoolbar

Makes nav/toolbar behaviour consistent for Feeds, Timeline, and Article
This commit is contained in:
Maurice Parker
2022-02-07 12:56:38 -08:00
committed by GitHub
5 changed files with 41 additions and 9 deletions

View File

@@ -229,6 +229,11 @@ class ArticleViewController: UIViewController, MainControllerIdentifiable {
}
override func contentScrollView(for edge: NSDirectionalRectEdge) -> UIScrollView? {
return currentWebViewController?.webView?.scrollView
}
// MARK: Notifications
@objc dynamic func unreadCountDidChange(_ notification: Notification) {

View File

@@ -31,7 +31,7 @@ class WebViewController: UIViewController {
private var topShowBarsViewConstraint: NSLayoutConstraint!
private var bottomShowBarsViewConstraint: NSLayoutConstraint!
private var webView: PreloadedWebView? {
var webView: PreloadedWebView? {
return view.subviews[0] as? PreloadedWebView
}

View File

@@ -172,7 +172,7 @@
<!--Feeds-->
<scene sceneID="smW-Zh-WAh">
<objects>
<tableViewController storyboardIdentifier="MasterFeedViewController" useStoryboardIdentifierAsRestorationIdentifier="YES" clearsSelectionOnViewWillAppear="NO" id="7bK-jq-Zjz" customClass="MasterFeedViewController" customModule="NetNewsWire" customModuleProvider="target" sceneMemberID="viewController">
<tableViewController storyboardIdentifier="MasterFeedViewController" extendedLayoutIncludesOpaqueBars="YES" useStoryboardIdentifierAsRestorationIdentifier="YES" clearsSelectionOnViewWillAppear="NO" id="7bK-jq-Zjz" customClass="MasterFeedViewController" customModule="NetNewsWire" customModuleProvider="target" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="18" sectionFooterHeight="18" id="r7i-6Z-zg0">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>

View File

@@ -92,9 +92,13 @@ class MasterTimelineViewController: UITableViewController, UndoableCommandRunner
refreshControl = UIRefreshControl()
refreshControl!.addTarget(self, action: #selector(refreshAccounts(_:)), for: .valueChanged)
configureToolbar()
refreshProgressView = Bundle.main.loadNibNamed("RefreshProgressView", owner: self, options: nil)?[0] as? RefreshProgressView
refreshProgressItemButton = UIBarButtonItem(customView: refreshProgressView!)
resetUI(resetScroll: true)
// Load the table and then scroll to the saved position if available
@@ -610,6 +614,23 @@ extension MasterTimelineViewController: UISearchBarDelegate {
private extension MasterTimelineViewController {
func configureToolbar() {
guard splitViewController?.isCollapsed ?? true else {
return
}
guard let refreshProgressView = Bundle.main.loadNibNamed("RefreshProgressView", owner: self, options: nil)?[0] as? RefreshProgressView else {
return
}
self.refreshProgressView = refreshProgressView
let refreshProgressItemButton = UIBarButtonItem(customView: refreshProgressView)
toolbarItems?.insert(refreshProgressItemButton, at: 2)
}
func resetUI(resetScroll: Bool) {
title = coordinator.timelineFeed?.nameForDisplay ?? "Timeline"

View File

@@ -1364,14 +1364,20 @@ extension SceneCoordinator: UINavigationControllerDelegate {
private extension SceneCoordinator {
func configureNavigationController(_ navController: UINavigationController) {
let navigationStandardAppearance = UINavigationBarAppearance()
navigationStandardAppearance.titleTextAttributes = [.foregroundColor: UIColor.label]
navigationStandardAppearance.largeTitleTextAttributes = [.foregroundColor: UIColor.label]
navController.navigationBar.standardAppearance = navigationStandardAppearance
let scrollEdgeStandardAppearance = UINavigationBarAppearance()
scrollEdgeStandardAppearance.backgroundColor = .systemBackground
navController.navigationBar.scrollEdgeAppearance = scrollEdgeStandardAppearance
let scrollEdge = UINavigationBarAppearance()
scrollEdge.configureWithOpaqueBackground()
scrollEdge.shadowColor = nil
scrollEdge.shadowImage = UIImage()
let standard = UINavigationBarAppearance()
standard.shadowColor = .opaqueSeparator
standard.shadowImage = UIImage()
navController.navigationBar.standardAppearance = standard
navController.navigationBar.compactAppearance = standard
navController.navigationBar.scrollEdgeAppearance = scrollEdge
navController.navigationBar.compactScrollEdgeAppearance = scrollEdge
navController.navigationBar.tintColor = AppAssets.primaryAccentColor