From 98cdb86e66f0ea95de06818f48d5dca31751c6e1 Mon Sep 17 00:00:00 2001 From: Stuart Breckenridge Date: Sun, 23 Jan 2022 10:58:29 +0800 Subject: [PATCH 1/8] Feeds screen changes --- iOS/AppAssets.swift | 6 +++++- .../Cell/MasterFeedTableViewCell.swift | 4 ++-- .../MasterFeedTableViewSectionHeader.swift | 12 ++++++------ ...sterFeedTableViewSectionHeaderLayout.swift | 8 ++++---- .../InteractiveNavigationController.swift | 19 +++++++++++++++++-- 5 files changed, 34 insertions(+), 15 deletions(-) diff --git a/iOS/AppAssets.swift b/iOS/AppAssets.swift index 2a5ed0659..160e5bf2e 100644 --- a/iOS/AppAssets.swift +++ b/iOS/AppAssets.swift @@ -98,9 +98,13 @@ struct AppAssets { }() static var disclosureImage: UIImage = { - return UIImage(named: "disclosure")! + return UIImage(systemName: "chevron.right")! }() + static func disclosureImage(size: CGFloat, weight: UIImage.SymbolWeight) -> UIImage { + return UIImage(systemName: "chevron.right", withConfiguration: UIImage.SymbolConfiguration(pointSize: size, weight: weight))! + } + static var contextMenuReddit: UIImage = { return UIImage(named: "contextMenuReddit")! }() diff --git a/iOS/MasterFeed/Cell/MasterFeedTableViewCell.swift b/iOS/MasterFeed/Cell/MasterFeedTableViewCell.swift index bf9c5a8da..eff30162e 100644 --- a/iOS/MasterFeed/Cell/MasterFeedTableViewCell.swift +++ b/iOS/MasterFeed/Cell/MasterFeedTableViewCell.swift @@ -88,7 +88,7 @@ class MasterFeedTableViewCell : VibrantTableViewCell { label.allowsDefaultTighteningForTruncation = false label.adjustsFontForContentSizeCategory = true label.lineBreakMode = .byTruncatingTail - label.font = .preferredFont(forTextStyle: .body) + label.font = .preferredFont(forTextStyle: .body).bold() return label }() @@ -193,7 +193,7 @@ private extension MasterFeedTableViewCell { func addDisclosureView() { disclosureButton = NonIntrinsicButton(type: .roundedRect) disclosureButton!.addTarget(self, action: #selector(buttonPressed(_:)), for: UIControl.Event.touchUpInside) - disclosureButton?.setImage(AppAssets.disclosureImage, for: .normal) + disclosureButton?.setImage(AppAssets.disclosureImage(size: 16, weight: .regular), for: .normal) disclosureButton?.tintColor = AppAssets.controlBackgroundColor disclosureButton?.imageView?.contentMode = .center disclosureButton?.imageView?.clipsToBounds = false diff --git a/iOS/MasterFeed/Cell/MasterFeedTableViewSectionHeader.swift b/iOS/MasterFeed/Cell/MasterFeedTableViewSectionHeader.swift index ee9cc296b..4ea2199bc 100644 --- a/iOS/MasterFeed/Cell/MasterFeedTableViewSectionHeader.swift +++ b/iOS/MasterFeed/Cell/MasterFeedTableViewSectionHeader.swift @@ -77,7 +77,7 @@ class MasterFeedTableViewSectionHeader: UITableViewHeaderFooterView { label.numberOfLines = 0 label.allowsDefaultTighteningForTruncation = false label.adjustsFontForContentSizeCategory = true - label.font = .preferredFont(forTextStyle: .body) + label.font = UIFont.systemFont(ofSize: UIFont.preferredFont(forTextStyle: .title2).pointSize, weight: .bold) return label }() @@ -85,8 +85,8 @@ class MasterFeedTableViewSectionHeader: UITableViewHeaderFooterView { private lazy var disclosureButton: UIButton = { let button = NonIntrinsicButton() - button.tintColor = UIColor.tertiaryLabel - button.setImage(AppAssets.disclosureImage, for: .normal) + button.tintColor = AppAssets.primaryAccentColor + button.setImage(AppAssets.disclosureImage(size: 14, weight: .bold), for: .normal) button.contentMode = .center button.addInteraction(UIPointerInteraction()) button.addTarget(self, action: #selector(toggleDisclosure), for: .touchUpInside) @@ -95,13 +95,13 @@ class MasterFeedTableViewSectionHeader: UITableViewHeaderFooterView { private let topSeparatorView: UIView = { let view = UIView() - view.backgroundColor = UIColor.separator + view.backgroundColor = UIColor.clear return view }() private let bottomSeparatorView: UIView = { let view = UIView() - view.backgroundColor = UIColor.separator + view.backgroundColor = UIColor.clear return view }() @@ -200,7 +200,7 @@ private extension MasterFeedTableViewSectionHeader { func addBackgroundView() { self.backgroundView = UIView(frame: self.bounds) - self.backgroundView?.backgroundColor = AppAssets.sectionHeaderColor + self.backgroundView?.backgroundColor = .clear } } diff --git a/iOS/MasterFeed/Cell/MasterFeedTableViewSectionHeaderLayout.swift b/iOS/MasterFeed/Cell/MasterFeedTableViewSectionHeaderLayout.swift index 1421e16f0..60748bb82 100644 --- a/iOS/MasterFeed/Cell/MasterFeedTableViewSectionHeaderLayout.swift +++ b/iOS/MasterFeed/Cell/MasterFeedTableViewSectionHeaderLayout.swift @@ -12,7 +12,7 @@ import RSCore struct MasterFeedTableViewSectionHeaderLayout { private static let labelMarginRight = CGFloat(integerLiteral: 8) - private static let unreadCountMarginRight = CGFloat(integerLiteral: 16) + private static let unreadCountMarginRight = CGFloat(integerLiteral: 0) private static let disclosureButtonSize = CGSize(width: 44, height: 44) private static let verticalPadding = CGFloat(integerLiteral: 11) @@ -31,7 +31,7 @@ struct MasterFeedTableViewSectionHeaderLayout { // Disclosure Button var rDisclosure = CGRect.zero rDisclosure.size = MasterFeedTableViewSectionHeaderLayout.disclosureButtonSize - rDisclosure.origin.x = bounds.origin.x + rDisclosure.origin.x = bounds.maxX - rDisclosure.size.width // Unread Count let unreadCountSize = unreadCountView.contentSize @@ -40,7 +40,7 @@ struct MasterFeedTableViewSectionHeaderLayout { var rUnread = CGRect.zero if !unreadCountIsHidden { rUnread.size = unreadCountSize - rUnread.origin.x = bounds.maxX - (MasterFeedTableViewSectionHeaderLayout.unreadCountMarginRight + unreadCountSize.width) + rUnread.origin.x = bounds.maxX - (MasterFeedTableViewSectionHeaderLayout.unreadCountMarginRight + unreadCountSize.width + rDisclosure.size.width) } // Max Unread Count @@ -50,7 +50,7 @@ struct MasterFeedTableViewSectionHeaderLayout { let maxUnreadCountSize = maxUnreadCountView.contentSize // Title - let rLabelx = insets.left + MasterFeedTableViewSectionHeaderLayout.disclosureButtonSize.width + let rLabelx = 15.0 let rLabely = UIFontMetrics.default.scaledValue(for: MasterFeedTableViewSectionHeaderLayout.verticalPadding) var labelWidth = CGFloat.zero diff --git a/iOS/UIKit Extensions/InteractiveNavigationController.swift b/iOS/UIKit Extensions/InteractiveNavigationController.swift index eb939fc3d..1b7ddda05 100644 --- a/iOS/UIKit Extensions/InteractiveNavigationController.swift +++ b/iOS/UIKit Extensions/InteractiveNavigationController.swift @@ -47,12 +47,27 @@ private extension InteractiveNavigationController { isToolbarHidden = false let navigationStandardAppearance = UINavigationBarAppearance() - navigationStandardAppearance.titleTextAttributes = [.foregroundColor: UIColor.label] - navigationStandardAppearance.largeTitleTextAttributes = [.foregroundColor: UIColor.label] + navigationStandardAppearance.titleTextAttributes = [ + .foregroundColor: UIColor.label, + .font: UIFont.systemFont(ofSize: UIFont.preferredFont(forTextStyle: .body).pointSize, weight: .heavy) + ] + navigationStandardAppearance.largeTitleTextAttributes = [ + .foregroundColor: UIColor.green, + .font: UIFont.systemFont(ofSize: UIFont.preferredFont(forTextStyle: .largeTitle).pointSize - 3, weight: .black) + ] navigationBar.standardAppearance = navigationStandardAppearance let scrollEdgeStandardAppearance = UINavigationBarAppearance() scrollEdgeStandardAppearance.backgroundColor = .systemBackground + scrollEdgeStandardAppearance.shadowColor = nil + scrollEdgeStandardAppearance.titleTextAttributes = [ + .foregroundColor: UIColor.label, + .font: UIFont.systemFont(ofSize: UIFont.preferredFont(forTextStyle: .body).pointSize, weight: .heavy) + ] + scrollEdgeStandardAppearance.largeTitleTextAttributes = [ + .foregroundColor: UIColor.label, + .font: UIFont.systemFont(ofSize: UIFont.preferredFont(forTextStyle: .largeTitle).pointSize - 3, weight: .black) + ] navigationBar.scrollEdgeAppearance = scrollEdgeStandardAppearance navigationBar.tintColor = AppAssets.primaryAccentColor From f66146e9bcdbe77ff8e8253bc8b579da774c7e7a Mon Sep 17 00:00:00 2001 From: Stuart Breckenridge Date: Sun, 23 Jan 2022 21:01:55 +0800 Subject: [PATCH 2/8] Refreshes Feeds screen --- .../Cell/MasterFeedTableViewCell.swift | 19 +++++++++++++++--- .../Cell/MasterFeedTableViewCellLayout.swift | 20 ++++++++++++------- iOS/MasterFeed/MasterFeedViewController.swift | 12 ++++++++++- 3 files changed, 40 insertions(+), 11 deletions(-) diff --git a/iOS/MasterFeed/Cell/MasterFeedTableViewCell.swift b/iOS/MasterFeed/Cell/MasterFeedTableViewCell.swift index eff30162e..cfe2de5c3 100644 --- a/iOS/MasterFeed/Cell/MasterFeedTableViewCell.swift +++ b/iOS/MasterFeed/Cell/MasterFeedTableViewCell.swift @@ -45,6 +45,14 @@ class MasterFeedTableViewCell : VibrantTableViewCell { } } + var itemIsInFolder = false { + didSet { + if itemIsInFolder != oldValue { + setNeedsLayout() + } + } + } + var isSeparatorShown = true { didSet { if isSeparatorShown != oldValue { @@ -88,7 +96,7 @@ class MasterFeedTableViewCell : VibrantTableViewCell { label.allowsDefaultTighteningForTruncation = false label.adjustsFontForContentSizeCategory = true label.lineBreakMode = .byTruncatingTail - label.font = .preferredFont(forTextStyle: .body).bold() + label.font = .preferredFont(forTextStyle: .body) return label }() @@ -136,14 +144,19 @@ class MasterFeedTableViewCell : VibrantTableViewCell { } override func sizeThatFits(_ size: CGSize) -> CGSize { - let layout = MasterFeedTableViewCellLayout(cellWidth: bounds.size.width, insets: safeAreaInsets, label: titleView, unreadCountView: unreadCountView, showingEditingControl: isShowingEditControl, indent: indentationLevel == 1, shouldShowDisclosure: isDisclosureAvailable) + let layout = MasterFeedTableViewCellLayout(cellWidth: bounds.size.width, insets: safeAreaInsets, label: titleView, unreadCountView: unreadCountView, showingEditingControl: isShowingEditControl, indent: indentationLevel == 1, shouldShowDisclosure: isDisclosureAvailable, itemIsInFolder: itemIsInFolder) return CGSize(width: bounds.width, height: layout.height) } override func layoutSubviews() { super.layoutSubviews() - let layout = MasterFeedTableViewCellLayout(cellWidth: bounds.size.width, insets: safeAreaInsets, label: titleView, unreadCountView: unreadCountView, showingEditingControl: isShowingEditControl, indent: indentationLevel == 1, shouldShowDisclosure: isDisclosureAvailable) + let layout = MasterFeedTableViewCellLayout(cellWidth: bounds.size.width, insets: safeAreaInsets, label: titleView, unreadCountView: unreadCountView, showingEditingControl: isShowingEditControl, indent: indentationLevel == 1, shouldShowDisclosure: isDisclosureAvailable, itemIsInFolder: itemIsInFolder) layoutWith(layout) + if isDisclosureAvailable { + titleView.font = .preferredFont(forTextStyle: .body).bold() + } else { + titleView.font = .preferredFont(forTextStyle: .body) + } } @objc func buttonPressed(_ sender: UIButton) { diff --git a/iOS/MasterFeed/Cell/MasterFeedTableViewCellLayout.swift b/iOS/MasterFeed/Cell/MasterFeedTableViewCellLayout.swift index 4ff894978..2c8b9d6a4 100644 --- a/iOS/MasterFeed/Cell/MasterFeedTableViewCellLayout.swift +++ b/iOS/MasterFeed/Cell/MasterFeedTableViewCellLayout.swift @@ -11,13 +11,13 @@ import RSCore struct MasterFeedTableViewCellLayout { - private static let indentWidth = CGFloat(integerLiteral: 42) + private static let indentWidth = CGFloat(integerLiteral: 15) private static let editingControlIndent = CGFloat(integerLiteral: 40) private static let imageSize = CGSize(width: 24, height: 24) private static let imageMarginRight = CGFloat(integerLiteral: 11) private static let labelMarginRight = CGFloat(integerLiteral: 8) private static let unreadCountMarginRight = CGFloat(integerLiteral: 16) - private static let disclosureButtonSize = CGSize(width: 44, height: 44) + private static let disclosureButtonSize = CGSize(width: 55, height: 44) private static let verticalPadding = CGFloat(integerLiteral: 11) private static let minRowHeight = CGFloat(integerLiteral: 44) @@ -32,7 +32,7 @@ struct MasterFeedTableViewCellLayout { let height: CGFloat - init(cellWidth: CGFloat, insets: UIEdgeInsets, label: UILabel, unreadCountView: MasterFeedUnreadCountView, showingEditingControl: Bool, indent: Bool, shouldShowDisclosure: Bool) { + init(cellWidth: CGFloat, insets: UIEdgeInsets, label: UILabel, unreadCountView: MasterFeedUnreadCountView, showingEditingControl: Bool, indent: Bool, shouldShowDisclosure: Bool, itemIsInFolder: Bool) { var initialIndent = insets.left if indent { @@ -54,7 +54,12 @@ struct MasterFeedTableViewCellLayout { let y = UIFontMetrics.default.scaledValue(for: MasterFeedTableViewCellLayout.verticalPadding) + label.font.lineHeight / 2.0 - MasterFeedTableViewCellLayout.imageSize.height / 2.0 - rFavicon = CGRect(x: x, y: y, width: MasterFeedTableViewCellLayout.imageSize.width, height: MasterFeedTableViewCellLayout.imageSize.height) + if itemIsInFolder { + rFavicon = CGRect(x: x + MasterFeedTableViewCellLayout.disclosureButtonSize.width - (MasterFeedTableViewCellLayout.imageSize.width / 2), y: y, width: MasterFeedTableViewCellLayout.imageSize.width, height: MasterFeedTableViewCellLayout.imageSize.height) + } else { + rFavicon = CGRect(x: x, y: y, width: MasterFeedTableViewCellLayout.imageSize.width, height: MasterFeedTableViewCellLayout.imageSize.height) + } + } // Unread Count @@ -68,9 +73,9 @@ struct MasterFeedTableViewCellLayout { } // Title - var rLabelx = insets.left + MasterFeedTableViewCellLayout.disclosureButtonSize.width - if !shouldShowDisclosure { - rLabelx = rLabelx + MasterFeedTableViewCellLayout.imageSize.width + MasterFeedTableViewCellLayout.imageMarginRight + var rLabelx = MasterFeedTableViewCellLayout.disclosureButtonSize.width + if itemIsInFolder { + rLabelx += MasterFeedTableViewCellLayout.disclosureButtonSize.width - (rFavicon.width / 2) } let rLabely = UIFontMetrics.default.scaledValue(for: MasterFeedTableViewCellLayout.verticalPadding) @@ -127,6 +132,7 @@ struct MasterFeedTableViewCellLayout { let separatorInset = MasterFeedTableViewCellLayout.disclosureButtonSize.width separatorRect = CGRect(x: separatorInset, y: cellHeight - 0.5, width: cellWidth - separatorInset, height: 0.5) + // Assign the properties self.height = cellHeight self.faviconRect = rFavicon diff --git a/iOS/MasterFeed/MasterFeedViewController.swift b/iOS/MasterFeed/MasterFeedViewController.swift index c61d6d329..1526b98ff 100644 --- a/iOS/MasterFeed/MasterFeedViewController.swift +++ b/iOS/MasterFeed/MasterFeedViewController.swift @@ -739,7 +739,7 @@ private extension MasterFeedViewController { let unreadCountView = MasterFeedUnreadCountView() unreadCountView.unreadCount = 10 - let layout = MasterFeedTableViewCellLayout(cellWidth: tableView.bounds.size.width, insets: tableView.safeAreaInsets, label: titleLabel, unreadCountView: unreadCountView, showingEditingControl: false, indent: false, shouldShowDisclosure: false) + let layout = MasterFeedTableViewCellLayout(cellWidth: tableView.bounds.size.width, insets: tableView.safeAreaInsets, label: titleLabel, unreadCountView: unreadCountView, showingEditingControl: false, indent: false, shouldShowDisclosure: false, itemIsInFolder: false) tableView.estimatedRowHeight = layout.height } @@ -763,6 +763,16 @@ private extension MasterFeedViewController { if let feed = node.representedObject as? Feed { cell.name = feed.nameForDisplay cell.unreadCount = feed.unreadCount + cell.itemIsInFolder = false + if let account = feed.account, let folders = account.folders { + for folder in folders { + if folder.objectIsChild(node.representedObject) { + cell.itemIsInFolder = true + break + } + } + } + } configureIcon(cell, indexPath) From b84f79a22f8cd6f80fd58992de38e619f0b8aa81 Mon Sep 17 00:00:00 2001 From: Stuart Breckenridge Date: Mon, 24 Jan 2022 06:20:59 +0800 Subject: [PATCH 3/8] Consistent tinting --- iOS/MasterFeed/Cell/MasterFeedTableViewCell.swift | 2 +- iOS/MasterFeed/Cell/MasterFeedTableViewSectionHeader.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/iOS/MasterFeed/Cell/MasterFeedTableViewCell.swift b/iOS/MasterFeed/Cell/MasterFeedTableViewCell.swift index cfe2de5c3..ac55c60dc 100644 --- a/iOS/MasterFeed/Cell/MasterFeedTableViewCell.swift +++ b/iOS/MasterFeed/Cell/MasterFeedTableViewCell.swift @@ -207,7 +207,7 @@ private extension MasterFeedTableViewCell { disclosureButton = NonIntrinsicButton(type: .roundedRect) disclosureButton!.addTarget(self, action: #selector(buttonPressed(_:)), for: UIControl.Event.touchUpInside) disclosureButton?.setImage(AppAssets.disclosureImage(size: 16, weight: .regular), for: .normal) - disclosureButton?.tintColor = AppAssets.controlBackgroundColor + disclosureButton?.tintColor = AppAssets.secondaryAccentColor disclosureButton?.imageView?.contentMode = .center disclosureButton?.imageView?.clipsToBounds = false disclosureButton?.addInteraction(UIPointerInteraction()) diff --git a/iOS/MasterFeed/Cell/MasterFeedTableViewSectionHeader.swift b/iOS/MasterFeed/Cell/MasterFeedTableViewSectionHeader.swift index 4ea2199bc..42cf018b7 100644 --- a/iOS/MasterFeed/Cell/MasterFeedTableViewSectionHeader.swift +++ b/iOS/MasterFeed/Cell/MasterFeedTableViewSectionHeader.swift @@ -85,7 +85,7 @@ class MasterFeedTableViewSectionHeader: UITableViewHeaderFooterView { private lazy var disclosureButton: UIButton = { let button = NonIntrinsicButton() - button.tintColor = AppAssets.primaryAccentColor + button.tintColor = AppAssets.secondaryAccentColor button.setImage(AppAssets.disclosureImage(size: 14, weight: .bold), for: .normal) button.contentMode = .center button.addInteraction(UIPointerInteraction()) From 46068c0cae906d93b6c537f54949c570ad16d874 Mon Sep 17 00:00:00 2001 From: Stuart Breckenridge Date: Mon, 24 Jan 2022 08:27:13 +0800 Subject: [PATCH 4/8] Removes collapsed unread count from headers --- iOS/MasterFeed/Cell/MasterFeedTableViewSectionHeader.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/iOS/MasterFeed/Cell/MasterFeedTableViewSectionHeader.swift b/iOS/MasterFeed/Cell/MasterFeedTableViewSectionHeader.swift index 42cf018b7..d0d899cb5 100644 --- a/iOS/MasterFeed/Cell/MasterFeedTableViewSectionHeader.swift +++ b/iOS/MasterFeed/Cell/MasterFeedTableViewSectionHeader.swift @@ -139,7 +139,6 @@ private extension MasterFeedTableViewSectionHeader { } func commonInit() { - addSubviewAtInit(unreadCountView) addSubviewAtInit(titleView) addSubviewAtInit(disclosureButton) updateExpandedState(animate: false) From e4cb868ff6d651651f4e80621341852969cd591d Mon Sep 17 00:00:00 2001 From: Stuart Breckenridge Date: Mon, 24 Jan 2022 08:37:58 +0800 Subject: [PATCH 5/8] Removes unused unread count code --- .../MasterFeedTableViewSectionHeader.swift | 33 +------------------ iOS/MasterFeed/MasterFeedViewController.swift | 14 ++------ 2 files changed, 3 insertions(+), 44 deletions(-) diff --git a/iOS/MasterFeed/Cell/MasterFeedTableViewSectionHeader.swift b/iOS/MasterFeed/Cell/MasterFeedTableViewSectionHeader.swift index d0d899cb5..a2aff10d4 100644 --- a/iOS/MasterFeed/Cell/MasterFeedTableViewSectionHeader.swift +++ b/iOS/MasterFeed/Cell/MasterFeedTableViewSectionHeader.swift @@ -19,12 +19,7 @@ class MasterFeedTableViewSectionHeader: UITableViewHeaderFooterView { override var accessibilityLabel: String? { set {} get { - if unreadCount > 0 { - let unreadLabel = NSLocalizedString("unread", comment: "Unread label for accessiblity") - return "\(name) \(unreadCount) \(unreadLabel) \(expandedStateMessage) " - } else { - return "\(name) \(expandedStateMessage) " - } + return "\(name) \(expandedStateMessage)" } } @@ -38,19 +33,6 @@ class MasterFeedTableViewSectionHeader: UITableViewHeaderFooterView { } } - var unreadCount: Int { - get { - return unreadCountView.unreadCount - } - set { - if unreadCountView.unreadCount != newValue { - unreadCountView.unreadCount = newValue - updateUnreadCountView() - setNeedsLayout() - } - } - } - var name: String { get { return titleView.text ?? "" @@ -66,7 +48,6 @@ class MasterFeedTableViewSectionHeader: UITableViewHeaderFooterView { var disclosureExpanded = false { didSet { updateExpandedState(animate: true) - updateUnreadCountView() } } @@ -168,18 +149,6 @@ private extension MasterFeedTableViewSectionHeader { } }) } - - func updateUnreadCountView() { - if !disclosureExpanded && unreadCount > 0 { - UIView.animate(withDuration: 0.3) { - self.unreadCountView.alpha = 1 - } - } else { - UIView.animate(withDuration: 0.3) { - self.unreadCountView.alpha = 0 - } - } - } func addSubviewAtInit(_ view: UIView) { contentView.addSubview(view) diff --git a/iOS/MasterFeed/MasterFeedViewController.swift b/iOS/MasterFeed/MasterFeedViewController.swift index 1526b98ff..ea5893150 100644 --- a/iOS/MasterFeed/MasterFeedViewController.swift +++ b/iOS/MasterFeed/MasterFeedViewController.swift @@ -99,13 +99,7 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner { return } - if let account = unreadCountProvider as? Account { - if let node = coordinator.rootNode.childNodeRepresentingObject(account) { - let sectionIndex = coordinator.rootNode.indexOfChild(node)! - if let headerView = tableView.headerView(forSection: sectionIndex) as? MasterFeedTableViewSectionHeader { - headerView.unreadCount = account.unreadCount - } - } + if let _ = unreadCountProvider as? Account { return } @@ -203,11 +197,7 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner { return headerView } - if let account = sectionNode.representedObject as? Account { - headerView.unreadCount = account.unreadCount - } else { - headerView.unreadCount = 0 - } + headerView.tag = section headerView.disclosureExpanded = coordinator.isExpanded(sectionNode) From 9672571d9974e30740673cd183063c511349422c Mon Sep 17 00:00:00 2001 From: Stuart Breckenridge Date: Mon, 24 Jan 2022 21:22:53 +0800 Subject: [PATCH 6/8] Bars Feeds: navigation bar and tab bar appear/disappear correctly when scrolling Timeline: navigation bar and tab bar appear/disappear correctly when scrolling Articles: Hmm, not so much. --- iOS/Base.lproj/Main.storyboard | 33 +++++++++---------- .../InteractiveNavigationController.swift | 22 +++++-------- 2 files changed, 24 insertions(+), 31 deletions(-) diff --git a/iOS/Base.lproj/Main.storyboard b/iOS/Base.lproj/Main.storyboard index 44386a8f9..4ccb0e39a 100644 --- a/iOS/Base.lproj/Main.storyboard +++ b/iOS/Base.lproj/Main.storyboard @@ -1,9 +1,8 @@ - + - - + @@ -13,13 +12,13 @@ - + @@ -113,14 +112,14 @@ - - - + + + - + @@ -166,7 +165,7 @@ - + @@ -316,26 +315,26 @@ - - + diff --git a/iOS/UIKit Extensions/InteractiveNavigationController.swift b/iOS/UIKit Extensions/InteractiveNavigationController.swift index 1b7ddda05..7054341ae 100644 --- a/iOS/UIKit Extensions/InteractiveNavigationController.swift +++ b/iOS/UIKit Extensions/InteractiveNavigationController.swift @@ -46,19 +46,8 @@ private extension InteractiveNavigationController { func configure() { isToolbarHidden = false - let navigationStandardAppearance = UINavigationBarAppearance() - navigationStandardAppearance.titleTextAttributes = [ - .foregroundColor: UIColor.label, - .font: UIFont.systemFont(ofSize: UIFont.preferredFont(forTextStyle: .body).pointSize, weight: .heavy) - ] - navigationStandardAppearance.largeTitleTextAttributes = [ - .foregroundColor: UIColor.green, - .font: UIFont.systemFont(ofSize: UIFont.preferredFont(forTextStyle: .largeTitle).pointSize - 3, weight: .black) - ] - navigationBar.standardAppearance = navigationStandardAppearance - let scrollEdgeStandardAppearance = UINavigationBarAppearance() - scrollEdgeStandardAppearance.backgroundColor = .systemBackground + scrollEdgeStandardAppearance.shadowColor = nil scrollEdgeStandardAppearance.titleTextAttributes = [ .foregroundColor: UIColor.label, @@ -68,11 +57,16 @@ private extension InteractiveNavigationController { .foregroundColor: UIColor.label, .font: UIFont.systemFont(ofSize: UIFont.preferredFont(forTextStyle: .largeTitle).pointSize - 3, weight: .black) ] - navigationBar.scrollEdgeAppearance = scrollEdgeStandardAppearance - navigationBar.tintColor = AppAssets.primaryAccentColor + navigationBar.standardAppearance = scrollEdgeStandardAppearance + navigationBar.isTranslucent = true + navigationBar.scrollEdgeAppearance = nil + navigationBar.compactAppearance = nil + navigationBar.compactScrollEdgeAppearance = nil + let toolbarAppearance = UIToolbarAppearance() + toolbarAppearance.shadowColor = nil toolbar.standardAppearance = toolbarAppearance toolbar.compactAppearance = toolbarAppearance toolbar.tintColor = AppAssets.primaryAccentColor From 4e1f6d4cd808e83dd11b0b7571765d48c39d92b8 Mon Sep 17 00:00:00 2001 From: Stuart Breckenridge Date: Mon, 24 Jan 2022 21:47:55 +0800 Subject: [PATCH 7/8] slightly better translucent behaviour Known issue: nav bar on article view is opaque. --- .../InteractiveNavigationController.swift | 38 +++++++++++++------ 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/iOS/UIKit Extensions/InteractiveNavigationController.swift b/iOS/UIKit Extensions/InteractiveNavigationController.swift index 7054341ae..7ad5fb85b 100644 --- a/iOS/UIKit Extensions/InteractiveNavigationController.swift +++ b/iOS/UIKit Extensions/InteractiveNavigationController.swift @@ -46,29 +46,43 @@ private extension InteractiveNavigationController { func configure() { isToolbarHidden = false - let scrollEdgeStandardAppearance = UINavigationBarAppearance() - - scrollEdgeStandardAppearance.shadowColor = nil - scrollEdgeStandardAppearance.titleTextAttributes = [ + // Standard appearance with system background + let standardAppearance = UINavigationBarAppearance() + standardAppearance.backgroundColor = .clear + standardAppearance.shadowColor = nil + standardAppearance.titleTextAttributes = [ .foregroundColor: UIColor.label, .font: UIFont.systemFont(ofSize: UIFont.preferredFont(forTextStyle: .body).pointSize, weight: .heavy) ] - scrollEdgeStandardAppearance.largeTitleTextAttributes = [ + standardAppearance.largeTitleTextAttributes = [ .foregroundColor: UIColor.label, .font: UIFont.systemFont(ofSize: UIFont.preferredFont(forTextStyle: .largeTitle).pointSize - 3, weight: .black) ] - navigationBar.tintColor = AppAssets.primaryAccentColor - navigationBar.standardAppearance = scrollEdgeStandardAppearance - navigationBar.isTranslucent = true - navigationBar.scrollEdgeAppearance = nil - navigationBar.compactAppearance = nil - navigationBar.compactScrollEdgeAppearance = nil + + let scrollEdgeAppearance = UINavigationBarAppearance() + scrollEdgeAppearance.backgroundColor = .systemBackground + scrollEdgeAppearance.shadowColor = nil + scrollEdgeAppearance.titleTextAttributes = [ + .foregroundColor: UIColor.label, + .font: UIFont.systemFont(ofSize: UIFont.preferredFont(forTextStyle: .body).pointSize, weight: .heavy) + ] + scrollEdgeAppearance.largeTitleTextAttributes = [ + .foregroundColor: UIColor.label, + .font: UIFont.systemFont(ofSize: UIFont.preferredFont(forTextStyle: .largeTitle).pointSize - 3, weight: .black) + ] + + + navigationBar.standardAppearance = standardAppearance + navigationBar.scrollEdgeAppearance = scrollEdgeAppearance + navigationBar.compactAppearance = standardAppearance + navigationBar.compactScrollEdgeAppearance = scrollEdgeAppearance let toolbarAppearance = UIToolbarAppearance() toolbarAppearance.shadowColor = nil toolbar.standardAppearance = toolbarAppearance - toolbar.compactAppearance = toolbarAppearance + toolbar.compactAppearance = nil + toolbar.scrollEdgeAppearance = nil toolbar.tintColor = AppAssets.primaryAccentColor } From d074f0e085b1ecd9b7017d72caac26a5952ec76a Mon Sep 17 00:00:00 2001 From: Stuart Breckenridge Date: Wed, 26 Jan 2022 06:47:47 +0800 Subject: [PATCH 8/8] standard navigation bar fonts --- .../InteractiveNavigationController.swift | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/iOS/UIKit Extensions/InteractiveNavigationController.swift b/iOS/UIKit Extensions/InteractiveNavigationController.swift index 7ad5fb85b..2737cf5d1 100644 --- a/iOS/UIKit Extensions/InteractiveNavigationController.swift +++ b/iOS/UIKit Extensions/InteractiveNavigationController.swift @@ -50,27 +50,10 @@ private extension InteractiveNavigationController { let standardAppearance = UINavigationBarAppearance() standardAppearance.backgroundColor = .clear standardAppearance.shadowColor = nil - standardAppearance.titleTextAttributes = [ - .foregroundColor: UIColor.label, - .font: UIFont.systemFont(ofSize: UIFont.preferredFont(forTextStyle: .body).pointSize, weight: .heavy) - ] - standardAppearance.largeTitleTextAttributes = [ - .foregroundColor: UIColor.label, - .font: UIFont.systemFont(ofSize: UIFont.preferredFont(forTextStyle: .largeTitle).pointSize - 3, weight: .black) - ] let scrollEdgeAppearance = UINavigationBarAppearance() scrollEdgeAppearance.backgroundColor = .systemBackground - scrollEdgeAppearance.shadowColor = nil - scrollEdgeAppearance.titleTextAttributes = [ - .foregroundColor: UIColor.label, - .font: UIFont.systemFont(ofSize: UIFont.preferredFont(forTextStyle: .body).pointSize, weight: .heavy) - ] - scrollEdgeAppearance.largeTitleTextAttributes = [ - .foregroundColor: UIColor.label, - .font: UIFont.systemFont(ofSize: UIFont.preferredFont(forTextStyle: .largeTitle).pointSize - 3, weight: .black) - ] - + scrollEdgeAppearance.shadowColor = nil navigationBar.standardAppearance = standardAppearance navigationBar.scrollEdgeAppearance = scrollEdgeAppearance