From e00f5d261953a360c530d16eff07aecfd0fc8a86 Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Thu, 2 Jan 2025 21:53:23 -0800 Subject: [PATCH] =?UTF-8?q?Rename=20a=20bunch=20of=20iOS=20classes=20to=20?= =?UTF-8?q?match=20names=20in=206.1.6-iOS=20branch=20=E2=80=94=C2=A0trying?= =?UTF-8?q?=20to=20reconcile=20branch=20and=20main,=20and=20having=20same?= =?UTF-8?q?=20names=20for=20classes=20will=20make=20that=20easier.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Cell/MainFeedRowIdentifier.swift} | 4 +- .../Cell/MainFeedTableViewCell.swift} | 20 +++--- .../Cell/MainFeedTableViewCellLayout.swift} | 60 ++++++++-------- .../MainFeedTableViewSectionHeader.swift} | 24 +++---- ...ainFeedTableViewSectionHeaderLayout.swift} | 36 +++++----- .../Cell/MainFeedUnreadCountView.swift} | 6 +- .../MainFeedViewController+Drag.swift} | 2 +- .../MainFeedViewController+Drop.swift} | 2 +- .../MainFeedViewController.swift} | 68 +++++++++---------- .../RefreshProgressView.swift | 0 .../RefreshProgressView.xib | 0 .../ShadowTableChanges.swift | 0 iOS/SceneCoordinator.swift | 4 +- iOS/Timeline/TimelineUnreadCountView.swift | 2 +- 14 files changed, 114 insertions(+), 114 deletions(-) rename iOS/{Feed/Cell/FeedRowIdentifier.swift => MainFeed/Cell/MainFeedRowIdentifier.swift} (79%) rename iOS/{Feed/Cell/FeedTableViewCell.swift => MainFeed/Cell/MainFeedTableViewCell.swift} (84%) rename iOS/{Feed/Cell/FeedTableViewCellLayout.swift => MainFeed/Cell/MainFeedTableViewCellLayout.swift} (60%) rename iOS/{Feed/Cell/FeedTableViewSectionHeader.swift => MainFeed/Cell/MainFeedTableViewSectionHeader.swift} (86%) rename iOS/{Feed/Cell/FeedTableViewSectionHeaderLayout.swift => MainFeed/Cell/MainFeedTableViewSectionHeaderLayout.swift} (63%) rename iOS/{Feed/Cell/FeedUnreadCountView.swift => MainFeed/Cell/MainFeedUnreadCountView.swift} (97%) rename iOS/{Feed/FeedViewController+Drag.swift => MainFeed/MainFeedViewController+Drag.swift} (93%) rename iOS/{Feed/FeedViewController+Drop.swift => MainFeed/MainFeedViewController+Drop.swift} (98%) rename iOS/{Feed/FeedViewController.swift => MainFeed/MainFeedViewController.swift} (94%) rename iOS/{Feed => MainFeed}/RefreshProgressView.swift (100%) rename iOS/{Feed => MainFeed}/RefreshProgressView.xib (100%) rename iOS/{Feed => MainFeed}/ShadowTableChanges.swift (100%) diff --git a/iOS/Feed/Cell/FeedRowIdentifier.swift b/iOS/MainFeed/Cell/MainFeedRowIdentifier.swift similarity index 79% rename from iOS/Feed/Cell/FeedRowIdentifier.swift rename to iOS/MainFeed/Cell/MainFeedRowIdentifier.swift index 22eab8f51..7cffecb6e 100644 --- a/iOS/Feed/Cell/FeedRowIdentifier.swift +++ b/iOS/MainFeed/Cell/MainFeedRowIdentifier.swift @@ -1,5 +1,5 @@ // -// FeedRowIdentifier.swift +// MainFeedRowIdentifier.swift // NetNewsWire-iOS // // Created by Maurice Parker on 10/20/21. @@ -8,7 +8,7 @@ import Foundation -class FeedRowIdentifier: NSObject, NSCopying { +class MainFeedRowIdentifier: NSObject, NSCopying { var indexPath: IndexPath diff --git a/iOS/Feed/Cell/FeedTableViewCell.swift b/iOS/MainFeed/Cell/MainFeedTableViewCell.swift similarity index 84% rename from iOS/Feed/Cell/FeedTableViewCell.swift rename to iOS/MainFeed/Cell/MainFeedTableViewCell.swift index 6a754abc1..4a36e4f73 100644 --- a/iOS/Feed/Cell/FeedTableViewCell.swift +++ b/iOS/MainFeed/Cell/MainFeedTableViewCell.swift @@ -1,5 +1,5 @@ // -// FeedTableViewCell.swift +// MainFeedTableViewCell.swift // NetNewsWire // // Created by Brent Simmons on 8/1/15. @@ -11,13 +11,13 @@ import RSCore import Account import RSTree -protocol FeedTableViewCellDelegate: AnyObject { - func feedTableViewCellDisclosureDidToggle(_ sender: FeedTableViewCell, expanding: Bool) +protocol MainFeedTableViewCellDelegate: AnyObject { + func feedTableViewCellDisclosureDidToggle(_ sender: MainFeedTableViewCell, expanding: Bool) } -class FeedTableViewCell : VibrantTableViewCell { +class MainFeedTableViewCell : VibrantTableViewCell { - weak var delegate: FeedTableViewCellDelegate? + weak var delegate: MainFeedTableViewCellDelegate? override var accessibilityLabel: String? { set {} @@ -103,7 +103,7 @@ class FeedTableViewCell : VibrantTableViewCell { private var isDisclosureExpanded = false private var disclosureButton: UIButton? - private var unreadCountView = FeedUnreadCountView(frame: CGRect.zero) + private var unreadCountView = MainFeedUnreadCountView(frame: CGRect.zero) private var isShowingEditControl = false required init?(coder: NSCoder) { @@ -136,13 +136,13 @@ class FeedTableViewCell : VibrantTableViewCell { } override func sizeThatFits(_ size: CGSize) -> CGSize { - let layout = FeedTableViewCellLayout(cellWidth: bounds.size.width, insets: safeAreaInsets, label: titleView, unreadCountView: unreadCountView, showingEditingControl: isShowingEditControl, indent: indentationLevel == 1, shouldShowDisclosure: isDisclosureAvailable) + let layout = MainFeedTableViewCellLayout(cellWidth: bounds.size.width, insets: safeAreaInsets, label: titleView, unreadCountView: unreadCountView, showingEditingControl: isShowingEditControl, indent: indentationLevel == 1, shouldShowDisclosure: isDisclosureAvailable) return CGSize(width: bounds.width, height: layout.height) } override func layoutSubviews() { super.layoutSubviews() - let layout = FeedTableViewCellLayout(cellWidth: bounds.size.width, insets: safeAreaInsets, label: titleView, unreadCountView: unreadCountView, showingEditingControl: isShowingEditControl, indent: indentationLevel == 1, shouldShowDisclosure: isDisclosureAvailable) + let layout = MainFeedTableViewCellLayout(cellWidth: bounds.size.width, insets: safeAreaInsets, label: titleView, unreadCountView: unreadCountView, showingEditingControl: isShowingEditControl, indent: indentationLevel == 1, shouldShowDisclosure: isDisclosureAvailable) layoutWith(layout) } @@ -180,7 +180,7 @@ class FeedTableViewCell : VibrantTableViewCell { } -private extension FeedTableViewCell { +private extension MainFeedTableViewCell { func commonInit() { addSubviewAtInit(unreadCountView) @@ -206,7 +206,7 @@ private extension FeedTableViewCell { view.translatesAutoresizingMaskIntoConstraints = false } - func layoutWith(_ layout: FeedTableViewCellLayout) { + func layoutWith(_ layout: MainFeedTableViewCellLayout) { iconView.setFrameIfNotEqual(layout.faviconRect) titleView.setFrameIfNotEqual(layout.titleRect) unreadCountView.setFrameIfNotEqual(layout.unreadCountRect) diff --git a/iOS/Feed/Cell/FeedTableViewCellLayout.swift b/iOS/MainFeed/Cell/MainFeedTableViewCellLayout.swift similarity index 60% rename from iOS/Feed/Cell/FeedTableViewCellLayout.swift rename to iOS/MainFeed/Cell/MainFeedTableViewCellLayout.swift index 6ecb4d8a6..7d00b4752 100644 --- a/iOS/Feed/Cell/FeedTableViewCellLayout.swift +++ b/iOS/MainFeed/Cell/MainFeedTableViewCellLayout.swift @@ -1,5 +1,5 @@ // -// TableViewCellLayout.swift +// MainFeedTableViewCellLayout.swift // NetNewsWire // // Created by Brent Simmons on 11/24/17. @@ -9,7 +9,7 @@ import UIKit import RSCore -struct FeedTableViewCellLayout { +struct MainFeedTableViewCellLayout { private static let indentWidth = CGFloat(integerLiteral: 42) private static let editingControlIndent = CGFloat(integerLiteral: 40) @@ -32,18 +32,18 @@ struct FeedTableViewCellLayout { let height: CGFloat - init(cellWidth: CGFloat, insets: UIEdgeInsets, label: UILabel, unreadCountView: FeedUnreadCountView, showingEditingControl: Bool, indent: Bool, shouldShowDisclosure: Bool) { + init(cellWidth: CGFloat, insets: UIEdgeInsets, label: UILabel, unreadCountView: MainFeedUnreadCountView, showingEditingControl: Bool, indent: Bool, shouldShowDisclosure: Bool) { var initialIndent = insets.left if indent { - initialIndent += FeedTableViewCellLayout.indentWidth + initialIndent += MainFeedTableViewCellLayout.indentWidth } let bounds = CGRect(x: initialIndent, y: 0.0, width: floor(cellWidth - initialIndent - insets.right), height: 0.0) // Disclosure Button var rDisclosure = CGRect.zero if shouldShowDisclosure { - rDisclosure.size = FeedTableViewCellLayout.disclosureButtonSize + rDisclosure.size = MainFeedTableViewCellLayout.disclosureButtonSize rDisclosure.origin.x = bounds.origin.x } @@ -51,10 +51,10 @@ struct FeedTableViewCellLayout { var rFavicon = CGRect.zero if !shouldShowDisclosure { let x = bounds.origin.x - let y = UIFontMetrics.default.scaledValue(for: FeedTableViewCellLayout.verticalPadding) + + let y = UIFontMetrics.default.scaledValue(for: MainFeedTableViewCellLayout.verticalPadding) + label.font.lineHeight / 2.0 - - FeedTableViewCellLayout.imageSize.height / 2.0 - rFavicon = CGRect(x: x, y: y, width: FeedTableViewCellLayout.imageSize.width, height: FeedTableViewCellLayout.imageSize.height) + MainFeedTableViewCellLayout.imageSize.height / 2.0 + rFavicon = CGRect(x: x, y: y, width: MainFeedTableViewCellLayout.imageSize.width, height: MainFeedTableViewCellLayout.imageSize.height) } // Unread Count @@ -64,21 +64,21 @@ struct FeedTableViewCellLayout { var rUnread = CGRect.zero if !unreadCountIsHidden { rUnread.size = unreadCountSize - rUnread.origin.x = bounds.maxX - (FeedTableViewCellLayout.unreadCountMarginRight + unreadCountSize.width) + rUnread.origin.x = bounds.maxX - (MainFeedTableViewCellLayout.unreadCountMarginRight + unreadCountSize.width) } // Title - var rLabelx = insets.left + FeedTableViewCellLayout.disclosureButtonSize.width + var rLabelx = insets.left + MainFeedTableViewCellLayout.disclosureButtonSize.width if !shouldShowDisclosure { - rLabelx = rLabelx + FeedTableViewCellLayout.imageSize.width + FeedTableViewCellLayout.imageMarginRight + rLabelx = rLabelx + MainFeedTableViewCellLayout.imageSize.width + MainFeedTableViewCellLayout.imageMarginRight } - let rLabely = UIFontMetrics.default.scaledValue(for: FeedTableViewCellLayout.verticalPadding) - + let rLabely = UIFontMetrics.default.scaledValue(for: MainFeedTableViewCellLayout.verticalPadding) + var labelWidth = CGFloat.zero if !unreadCountIsHidden { - labelWidth = cellWidth - (rLabelx + FeedTableViewCellLayout.labelMarginRight + (cellWidth - rUnread.minX)) + labelWidth = cellWidth - (rLabelx + MainFeedTableViewCellLayout.labelMarginRight + (cellWidth - rUnread.minX)) } else { - labelWidth = cellWidth - (rLabelx + FeedTableViewCellLayout.labelMarginRight) + labelWidth = cellWidth - (rLabelx + MainFeedTableViewCellLayout.labelMarginRight) } let labelSizeInfo = MultilineUILabelSizer.size(for: label.text ?? "", font: label.font, numberOfLines: 0, width: Int(floor(labelWidth))) @@ -87,44 +87,44 @@ struct FeedTableViewCellLayout { // We do this because we don't want the row height to change when the editing controls are brought out. We will // handle the missing space, but removing it from the label and truncating. if showingEditingControl { - rDisclosure.origin.x += FeedTableViewCellLayout.editingControlIndent - rFavicon.origin.x += FeedTableViewCellLayout.editingControlIndent - rLabelx += FeedTableViewCellLayout.editingControlIndent + rDisclosure.origin.x += MainFeedTableViewCellLayout.editingControlIndent + rFavicon.origin.x += MainFeedTableViewCellLayout.editingControlIndent + rLabelx += MainFeedTableViewCellLayout.editingControlIndent if !unreadCountIsHidden { - rUnread.origin.x -= FeedTableViewCellLayout.editingControlIndent - labelWidth = cellWidth - (rLabelx + FeedTableViewCellLayout.labelMarginRight + (cellWidth - rUnread.minX)) + rUnread.origin.x -= MainFeedTableViewCellLayout.editingControlIndent + labelWidth = cellWidth - (rLabelx + MainFeedTableViewCellLayout.labelMarginRight + (cellWidth - rUnread.minX)) } else { - labelWidth = cellWidth - (rLabelx + FeedTableViewCellLayout.labelMarginRight + FeedTableViewCellLayout.editingControlIndent) + labelWidth = cellWidth - (rLabelx + MainFeedTableViewCellLayout.labelMarginRight + MainFeedTableViewCellLayout.editingControlIndent) } } var rLabel = CGRect(x: rLabelx, y: rLabely, width: labelWidth, height: labelSizeInfo.size.height) // Determine cell height - let paddedLabelHeight = rLabel.maxY + UIFontMetrics.default.scaledValue(for: FeedTableViewCellLayout.verticalPadding) + let paddedLabelHeight = rLabel.maxY + UIFontMetrics.default.scaledValue(for: MainFeedTableViewCellLayout.verticalPadding) let maxGraphicsHeight = [rFavicon, rUnread, rDisclosure].maxY() var cellHeight = max(paddedLabelHeight, maxGraphicsHeight) - if cellHeight < FeedTableViewCellLayout.minRowHeight { - cellHeight = FeedTableViewCellLayout.minRowHeight + if cellHeight < MainFeedTableViewCellLayout.minRowHeight { + cellHeight = MainFeedTableViewCellLayout.minRowHeight } // Center in Cell let newBounds = CGRect(x: bounds.origin.x, y: bounds.origin.y, width: bounds.width, height: cellHeight) if !unreadCountIsHidden { - rUnread = FeedTableViewCellLayout.centerVertically(rUnread, newBounds) + rUnread = MainFeedTableViewCellLayout.centerVertically(rUnread, newBounds) } if shouldShowDisclosure { - rDisclosure = FeedTableViewCellLayout.centerVertically(rDisclosure, newBounds) + rDisclosure = MainFeedTableViewCellLayout.centerVertically(rDisclosure, newBounds) } // Small fonts and the Favicon need centered if we hit the minimum row height - if cellHeight == FeedTableViewCellLayout.minRowHeight { - rLabel = FeedTableViewCellLayout.centerVertically(rLabel, newBounds) - rFavicon = FeedTableViewCellLayout.centerVertically(rFavicon, newBounds) + if cellHeight == MainFeedTableViewCellLayout.minRowHeight { + rLabel = MainFeedTableViewCellLayout.centerVertically(rLabel, newBounds) + rFavicon = MainFeedTableViewCellLayout.centerVertically(rFavicon, newBounds) } // Separator Insets - let separatorInset = FeedTableViewCellLayout.disclosureButtonSize.width + let separatorInset = MainFeedTableViewCellLayout.disclosureButtonSize.width separatorRect = CGRect(x: separatorInset, y: cellHeight - 0.5, width: cellWidth - separatorInset, height: 0.5) // Assign the properties diff --git a/iOS/Feed/Cell/FeedTableViewSectionHeader.swift b/iOS/MainFeed/Cell/MainFeedTableViewSectionHeader.swift similarity index 86% rename from iOS/Feed/Cell/FeedTableViewSectionHeader.swift rename to iOS/MainFeed/Cell/MainFeedTableViewSectionHeader.swift index 5164fc46d..f2de7af54 100644 --- a/iOS/Feed/Cell/FeedTableViewSectionHeader.swift +++ b/iOS/MainFeed/Cell/MainFeedTableViewSectionHeader.swift @@ -1,5 +1,5 @@ // -// TableViewSectionHeader.swift +// MainFeedTableViewSectionHeader.swift // NetNewsWire // // Created by Maurice Parker on 4/18/19. @@ -8,13 +8,13 @@ import UIKit -protocol FeedTableViewSectionHeaderDelegate { - func feedTableViewSectionHeaderDisclosureDidToggle(_ sender: FeedTableViewSectionHeader) +protocol MainFeedTableViewSectionHeaderDelegate { + func feedTableViewSectionHeaderDisclosureDidToggle(_ sender: MainFeedTableViewSectionHeader) } -class FeedTableViewSectionHeader: UITableViewHeaderFooterView { - - var delegate: FeedTableViewSectionHeaderDelegate? +class MainFeedTableViewSectionHeader: UITableViewHeaderFooterView { + + var delegate: MainFeedTableViewSectionHeaderDelegate? override var accessibilityLabel: String? { set {} @@ -81,7 +81,7 @@ class FeedTableViewSectionHeader: UITableViewHeaderFooterView { return label }() - private let unreadCountView = FeedUnreadCountView(frame: CGRect.zero) + private let unreadCountView = MainFeedUnreadCountView(frame: CGRect.zero) private lazy var disclosureButton: UIButton = { let button = NonIntrinsicButton() @@ -116,14 +116,14 @@ class FeedTableViewSectionHeader: UITableViewHeaderFooterView { } override func sizeThatFits(_ size: CGSize) -> CGSize { - let layout = FeedTableViewSectionHeaderLayout(cellWidth: size.width, insets: safeAreaInsets, label: titleView, unreadCountView: unreadCountView) + let layout = MainFeedTableViewSectionHeaderLayout(cellWidth: size.width, insets: safeAreaInsets, label: titleView, unreadCountView: unreadCountView) return CGSize(width: bounds.width, height: layout.height) } override func layoutSubviews() { super.layoutSubviews() - let layout = FeedTableViewSectionHeaderLayout(cellWidth: contentView.bounds.size.width, + let layout = MainFeedTableViewSectionHeaderLayout(cellWidth: contentView.bounds.size.width, insets: contentView.safeAreaInsets, label: titleView, unreadCountView: unreadCountView) @@ -132,8 +132,8 @@ class FeedTableViewSectionHeader: UITableViewHeaderFooterView { } -private extension FeedTableViewSectionHeader { - +private extension MainFeedTableViewSectionHeader { + @objc func toggleDisclosure() { delegate?.feedTableViewSectionHeaderDisclosureDidToggle(self) } @@ -187,7 +187,7 @@ private extension FeedTableViewSectionHeader { view.translatesAutoresizingMaskIntoConstraints = false } - func layoutWith(_ layout: FeedTableViewSectionHeaderLayout) { + func layoutWith(_ layout: MainFeedTableViewSectionHeaderLayout) { titleView.setFrameIfNotEqual(layout.titleRect) unreadCountView.setFrameIfNotEqual(layout.unreadCountRect) disclosureButton.setFrameIfNotEqual(layout.disclosureButtonRect) diff --git a/iOS/Feed/Cell/FeedTableViewSectionHeaderLayout.swift b/iOS/MainFeed/Cell/MainFeedTableViewSectionHeaderLayout.swift similarity index 63% rename from iOS/Feed/Cell/FeedTableViewSectionHeaderLayout.swift rename to iOS/MainFeed/Cell/MainFeedTableViewSectionHeaderLayout.swift index 6cdefefb4..2905dae54 100644 --- a/iOS/Feed/Cell/FeedTableViewSectionHeaderLayout.swift +++ b/iOS/MainFeed/Cell/MainFeedTableViewSectionHeaderLayout.swift @@ -1,5 +1,5 @@ // -// FeedTableViewSectionHeaderLayout.swift +// MainFeedTableViewSectionHeaderLayout.swift // NetNewsWire-iOS // // Created by Maurice Parker on 11/5/19. @@ -9,7 +9,7 @@ import UIKit import RSCore -struct FeedTableViewSectionHeaderLayout { +struct MainFeedTableViewSectionHeaderLayout { private static let labelMarginRight = CGFloat(integerLiteral: 8) private static let unreadCountMarginRight = CGFloat(integerLiteral: 16) @@ -24,13 +24,13 @@ struct FeedTableViewSectionHeaderLayout { let height: CGFloat - init(cellWidth: CGFloat, insets: UIEdgeInsets, label: UILabel, unreadCountView: FeedUnreadCountView) { + init(cellWidth: CGFloat, insets: UIEdgeInsets, label: UILabel, unreadCountView: MainFeedUnreadCountView) { let bounds = CGRect(x: insets.left, y: 0.0, width: floor(cellWidth - insets.right), height: 0.0) // Disclosure Button var rDisclosure = CGRect.zero - rDisclosure.size = FeedTableViewSectionHeaderLayout.disclosureButtonSize + rDisclosure.size = MainFeedTableViewSectionHeaderLayout.disclosureButtonSize rDisclosure.origin.x = bounds.origin.x // Unread Count @@ -40,43 +40,43 @@ struct FeedTableViewSectionHeaderLayout { var rUnread = CGRect.zero if !unreadCountIsHidden { rUnread.size = unreadCountSize - rUnread.origin.x = bounds.maxX - (FeedTableViewSectionHeaderLayout.unreadCountMarginRight + unreadCountSize.width) + rUnread.origin.x = bounds.maxX - (MainFeedTableViewSectionHeaderLayout.unreadCountMarginRight + unreadCountSize.width) } // Max Unread Count // We can't reload Section Headers so we don't let the title extend into the (probably) worse case Unread Count area. - let maxUnreadCountView = FeedUnreadCountView(frame: CGRect.zero) + let maxUnreadCountView = MainFeedUnreadCountView(frame: CGRect.zero) maxUnreadCountView.unreadCount = 888 let maxUnreadCountSize = maxUnreadCountView.contentSize // Title - let rLabelx = insets.left + FeedTableViewSectionHeaderLayout.disclosureButtonSize.width - let rLabely = UIFontMetrics.default.scaledValue(for: FeedTableViewSectionHeaderLayout.verticalPadding) - + let rLabelx = insets.left + MainFeedTableViewSectionHeaderLayout.disclosureButtonSize.width + let rLabely = UIFontMetrics.default.scaledValue(for: MainFeedTableViewSectionHeaderLayout.verticalPadding) + var labelWidth = CGFloat.zero - labelWidth = cellWidth - (rLabelx + FeedTableViewSectionHeaderLayout.labelMarginRight + maxUnreadCountSize.width + FeedTableViewSectionHeaderLayout.unreadCountMarginRight) - + labelWidth = cellWidth - (rLabelx + MainFeedTableViewSectionHeaderLayout.labelMarginRight + maxUnreadCountSize.width + MainFeedTableViewSectionHeaderLayout.unreadCountMarginRight) + let labelSizeInfo = MultilineUILabelSizer.size(for: label.text ?? "", font: label.font, numberOfLines: 0, width: Int(floor(labelWidth))) var rLabel = CGRect(x: rLabelx, y: rLabely, width: labelWidth, height: labelSizeInfo.size.height) // Determine cell height - let paddedLabelHeight = rLabel.maxY + UIFontMetrics.default.scaledValue(for: FeedTableViewSectionHeaderLayout.verticalPadding) + let paddedLabelHeight = rLabel.maxY + UIFontMetrics.default.scaledValue(for: MainFeedTableViewSectionHeaderLayout.verticalPadding) let maxGraphicsHeight = [rUnread, rDisclosure].maxY() var cellHeight = max(paddedLabelHeight, maxGraphicsHeight) - if cellHeight < FeedTableViewSectionHeaderLayout.minRowHeight { - cellHeight = FeedTableViewSectionHeaderLayout.minRowHeight + if cellHeight < MainFeedTableViewSectionHeaderLayout.minRowHeight { + cellHeight = MainFeedTableViewSectionHeaderLayout.minRowHeight } // Center in Cell let newBounds = CGRect(x: bounds.origin.x, y: bounds.origin.y, width: bounds.width, height: cellHeight) if !unreadCountIsHidden { - rUnread = FeedTableViewCellLayout.centerVertically(rUnread, newBounds) + rUnread = MainFeedTableViewCellLayout.centerVertically(rUnread, newBounds) } - rDisclosure = FeedTableViewCellLayout.centerVertically(rDisclosure, newBounds) + rDisclosure = MainFeedTableViewCellLayout.centerVertically(rDisclosure, newBounds) // Small fonts need centered if we hit the minimum row height - if cellHeight == FeedTableViewSectionHeaderLayout.minRowHeight { - rLabel = FeedTableViewCellLayout.centerVertically(rLabel, newBounds) + if cellHeight == MainFeedTableViewSectionHeaderLayout.minRowHeight { + rLabel = MainFeedTableViewCellLayout.centerVertically(rLabel, newBounds) } // Assign the properties diff --git a/iOS/Feed/Cell/FeedUnreadCountView.swift b/iOS/MainFeed/Cell/MainFeedUnreadCountView.swift similarity index 97% rename from iOS/Feed/Cell/FeedUnreadCountView.swift rename to iOS/MainFeed/Cell/MainFeedUnreadCountView.swift index 6e6b6e4c9..c6dc46414 100644 --- a/iOS/Feed/Cell/FeedUnreadCountView.swift +++ b/iOS/MainFeed/Cell/MainFeedUnreadCountView.swift @@ -1,5 +1,5 @@ // -// UnreadCountView.swift +// MainFeedUnreadCountView.swift // NetNewsWire // // Created by Brent Simmons on 11/22/15. @@ -8,8 +8,8 @@ import UIKit -class FeedUnreadCountView : UIView { - +class MainFeedUnreadCountView : UIView { + var padding: UIEdgeInsets { return UIEdgeInsets(top: 1.0, left: 9.0, bottom: 1.0, right: 9.0) } diff --git a/iOS/Feed/FeedViewController+Drag.swift b/iOS/MainFeed/MainFeedViewController+Drag.swift similarity index 93% rename from iOS/Feed/FeedViewController+Drag.swift rename to iOS/MainFeed/MainFeedViewController+Drag.swift index 14c778057..cd3e7aef6 100644 --- a/iOS/Feed/FeedViewController+Drag.swift +++ b/iOS/MainFeed/MainFeedViewController+Drag.swift @@ -11,7 +11,7 @@ import MobileCoreServices import Account import UniformTypeIdentifiers -extension FeedViewController: UITableViewDragDelegate { +extension MainFeedViewController: UITableViewDragDelegate { func tableView(_ tableView: UITableView, itemsForBeginning session: UIDragSession, at indexPath: IndexPath) -> [UIDragItem] { guard let node = coordinator.nodeFor(indexPath), let feed = node.representedObject as? Feed else { diff --git a/iOS/Feed/FeedViewController+Drop.swift b/iOS/MainFeed/MainFeedViewController+Drop.swift similarity index 98% rename from iOS/Feed/FeedViewController+Drop.swift rename to iOS/MainFeed/MainFeedViewController+Drop.swift index 677565816..01a466ccf 100644 --- a/iOS/Feed/FeedViewController+Drop.swift +++ b/iOS/MainFeed/MainFeedViewController+Drop.swift @@ -11,7 +11,7 @@ import RSCore import Account import RSTree -extension FeedViewController: UITableViewDropDelegate { +extension MainFeedViewController: UITableViewDropDelegate { func tableView(_ tableView: UITableView, canHandle session: UIDropSession) -> Bool { return session.localDragSession != nil diff --git a/iOS/Feed/FeedViewController.swift b/iOS/MainFeed/MainFeedViewController.swift similarity index 94% rename from iOS/Feed/FeedViewController.swift rename to iOS/MainFeed/MainFeedViewController.swift index 86d13a5f0..56ff17fb2 100644 --- a/iOS/Feed/FeedViewController.swift +++ b/iOS/MainFeed/MainFeedViewController.swift @@ -1,5 +1,5 @@ // -// FeedViewController.swift +// MainFeedViewController.swift // NetNewsWire // // Created by Maurice Parker on 4/8/19. @@ -13,7 +13,7 @@ import RSCore import RSTree import SafariServices -class FeedViewController: UITableViewController, UndoableCommandRunner { +class MainFeedViewController: UITableViewController, UndoableCommandRunner { @IBOutlet weak var filterButton: UIBarButtonItem! private var refreshProgressView: RefreshProgressView? @@ -55,7 +55,7 @@ class FeedViewController: UITableViewController, UndoableCommandRunner { frame.size.height = .leastNormalMagnitude tableView.tableHeaderView = UIView(frame: frame) - tableView.register(FeedTableViewSectionHeader.self, forHeaderFooterViewReuseIdentifier: "SectionHeader") + tableView.register(MainFeedTableViewSectionHeader.self, forHeaderFooterViewReuseIdentifier: "SectionHeader") tableView.dragDelegate = self tableView.dropDelegate = self tableView.dragInteractionEnabled = true @@ -100,7 +100,7 @@ class FeedViewController: UITableViewController, UndoableCommandRunner { 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? FeedTableViewSectionHeader { + if let headerView = tableView.headerView(forSection: sectionIndex) as? MainFeedTableViewSectionHeader { headerView.unreadCount = account.unreadCount } } @@ -115,7 +115,7 @@ class FeedViewController: UITableViewController, UndoableCommandRunner { } guard let unreadCountNode = node, let indexPath = coordinator.indexPathFor(unreadCountNode) else { return } - if let cell = tableView.cellForRow(at: indexPath) as? FeedTableViewCell { + if let cell = tableView.cellForRow(at: indexPath) as? MainFeedTableViewCell { cell.unreadCount = unreadCountProvider.unreadCount } } @@ -160,7 +160,7 @@ class FeedViewController: UITableViewController, UndoableCommandRunner { } override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { - let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath) as! FeedTableViewCell + let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath) as! MainFeedTableViewCell configure(cell, indexPath) return cell } @@ -179,7 +179,7 @@ class FeedViewController: UITableViewController, UndoableCommandRunner { return 44 } - let headerView = FeedTableViewSectionHeader() + let headerView = MainFeedTableViewSectionHeader() headerView.name = nameProvider.nameForDisplay let size = headerView.sizeThatFits(CGSize(width: tableView.bounds.width, height: 0.0)) @@ -193,7 +193,7 @@ class FeedViewController: UITableViewController, UndoableCommandRunner { return nil } - let headerView = tableView.dequeueReusableHeaderFooterView(withIdentifier: "SectionHeader") as! FeedTableViewSectionHeader + let headerView = tableView.dequeueReusableHeaderFooterView(withIdentifier: "SectionHeader") as! MainFeedTableViewSectionHeader headerView.delegate = self headerView.name = nameProvider.nameForDisplay @@ -330,7 +330,7 @@ class FeedViewController: UITableViewController, UndoableCommandRunner { } override func tableView(_ tableView: UITableView, previewForHighlightingContextMenuWithConfiguration configuration: UIContextMenuConfiguration) -> UITargetedPreview? { - guard let identifier = configuration.identifier as? FeedRowIdentifier, + guard let identifier = configuration.identifier as? MainFeedRowIdentifier, let cell = tableView.cellForRow(at: identifier.indexPath) else { return nil } @@ -427,7 +427,7 @@ class FeedViewController: UITableViewController, UndoableCommandRunner { } @objc func toggleSectionHeader(_ sender: UITapGestureRecognizer) { - guard let headerView = sender.view as? FeedTableViewSectionHeader else { + guard let headerView = sender.view as? MainFeedTableViewSectionHeader else { return } toggle(headerView) @@ -644,7 +644,7 @@ class FeedViewController: UITableViewController, UndoableCommandRunner { // MARK: UIContextMenuInteractionDelegate -extension FeedViewController: UIContextMenuInteractionDelegate { +extension MainFeedViewController: UIContextMenuInteractionDelegate { func contextMenuInteraction(_ interaction: UIContextMenuInteraction, configurationForMenuAtLocation location: CGPoint) -> UIContextMenuConfiguration? { guard let sectionIndex = interaction.view?.tag, @@ -682,9 +682,9 @@ extension FeedViewController: UIContextMenuInteractionDelegate { // MARK: FeedTableViewSectionHeaderDelegate -extension FeedViewController: FeedTableViewSectionHeaderDelegate { - - func feedTableViewSectionHeaderDisclosureDidToggle(_ sender: FeedTableViewSectionHeader) { +extension MainFeedViewController: MainFeedTableViewSectionHeaderDelegate { + + func feedTableViewSectionHeaderDisclosureDidToggle(_ sender: MainFeedTableViewSectionHeader) { toggle(sender) } @@ -692,9 +692,9 @@ extension FeedViewController: FeedTableViewSectionHeaderDelegate { // MARK: FeedTableViewCellDelegate -extension FeedViewController: FeedTableViewCellDelegate { - - func feedTableViewCellDisclosureDidToggle(_ sender: FeedTableViewCell, expanding: Bool) { +extension MainFeedViewController: MainFeedTableViewCellDelegate { + + func feedTableViewCellDisclosureDidToggle(_ sender: MainFeedTableViewCell, expanding: Bool) { if expanding { expand(sender) } else { @@ -706,8 +706,8 @@ extension FeedViewController: FeedTableViewCellDelegate { // MARK: Private -private extension FeedViewController { - +private extension MainFeedViewController { + func configureToolbar() { guard let refreshProgressView = Bundle.main.loadNibNamed("RefreshProgressView", owner: self, options: nil)?[0] as? RefreshProgressView else { return @@ -732,14 +732,14 @@ private extension FeedViewController { let titleLabel = NonIntrinsicLabel() titleLabel.text = "But I must explain" - let unreadCountView = FeedUnreadCountView() + let unreadCountView = MainFeedUnreadCountView() unreadCountView.unreadCount = 10 - let layout = FeedTableViewCellLayout(cellWidth: tableView.bounds.size.width, insets: tableView.safeAreaInsets, label: titleLabel, unreadCountView: unreadCountView, showingEditingControl: false, indent: false, shouldShowDisclosure: false) + let layout = MainFeedTableViewCellLayout(cellWidth: tableView.bounds.size.width, insets: tableView.safeAreaInsets, label: titleLabel, unreadCountView: unreadCountView, showingEditingControl: false, indent: false, shouldShowDisclosure: false) tableView.estimatedRowHeight = layout.height } - func configure(_ cell: FeedTableViewCell, _ indexPath: IndexPath) { + func configure(_ cell: MainFeedTableViewCell, _ indexPath: IndexPath) { guard let node = coordinator.nodeFor(indexPath) else { return } cell.delegate = self @@ -772,7 +772,7 @@ private extension FeedViewController { } - func configureIcon(_ cell: FeedTableViewCell, _ indexPath: IndexPath) { + func configureIcon(_ cell: MainFeedTableViewCell, _ indexPath: IndexPath) { guard let node = coordinator.nodeFor(indexPath), let feed = node.representedObject as? SidebarItem, let feedID = feed.sidebarItemID else { return } @@ -790,7 +790,7 @@ private extension FeedViewController { applyToCellsForRepresentedObject(representedObject, configure) } - func applyToCellsForRepresentedObject(_ representedObject: AnyObject, _ completion: (FeedTableViewCell, IndexPath) -> Void) { + func applyToCellsForRepresentedObject(_ representedObject: AnyObject, _ completion: (MainFeedTableViewCell, IndexPath) -> Void) { applyToAvailableCells { (cell, indexPath) in if let node = coordinator.nodeFor(indexPath), let representedFeed = representedObject as? SidebarItem, @@ -801,12 +801,12 @@ private extension FeedViewController { } } - func applyToAvailableCells(_ completion: (FeedTableViewCell, IndexPath) -> Void) { + func applyToAvailableCells(_ completion: (MainFeedTableViewCell, IndexPath) -> Void) { for cell in tableView.visibleCells { guard let indexPath = tableView.indexPath(for: cell) else { continue } - completion(cell as! FeedTableViewCell, indexPath) + completion(cell as! MainFeedTableViewCell, indexPath) } } @@ -829,7 +829,7 @@ private extension FeedViewController { return nil } - func toggle(_ headerView: FeedTableViewSectionHeader) { + func toggle(_ headerView: MainFeedTableViewSectionHeader) { guard let sectionNode = coordinator.rootNode.childAtIndex(headerView.tag) else { return } @@ -843,14 +843,14 @@ private extension FeedViewController { } } - func expand(_ cell: FeedTableViewCell) { + func expand(_ cell: MainFeedTableViewCell) { guard let indexPath = tableView.indexPath(for: cell), let node = coordinator.nodeFor(indexPath) else { return } coordinator.expand(node) } - func collapse(_ cell: FeedTableViewCell) { + func collapse(_ cell: MainFeedTableViewCell) { guard let indexPath = tableView.indexPath(for: cell), let node = coordinator.nodeFor(indexPath) else { return } @@ -858,8 +858,8 @@ private extension FeedViewController { } func makeFeedContextMenu(indexPath: IndexPath, includeDeleteRename: Bool) -> UIContextMenuConfiguration { - return UIContextMenuConfiguration(identifier: FeedRowIdentifier(indexPath: indexPath), previewProvider: nil, actionProvider: { [ weak self] suggestedActions in - + return UIContextMenuConfiguration(identifier: MainFeedRowIdentifier(indexPath: indexPath), previewProvider: nil, actionProvider: { [ weak self] suggestedActions in + guard let self = self else { return nil } var menuElements = [UIMenuElement]() @@ -903,7 +903,7 @@ private extension FeedViewController { } func makeFolderContextMenu(indexPath: IndexPath) -> UIContextMenuConfiguration { - return UIContextMenuConfiguration(identifier: FeedRowIdentifier(indexPath: indexPath), previewProvider: nil, actionProvider: { [weak self] suggestedActions in + return UIContextMenuConfiguration(identifier: MainFeedRowIdentifier(indexPath: indexPath), previewProvider: nil, actionProvider: { [weak self] suggestedActions in guard let self = self else { return nil } @@ -930,7 +930,7 @@ private extension FeedViewController { return nil } - return UIContextMenuConfiguration(identifier: FeedRowIdentifier(indexPath: indexPath), previewProvider: nil, actionProvider: { suggestedActions in + return UIContextMenuConfiguration(identifier: MainFeedRowIdentifier(indexPath: indexPath), previewProvider: nil, actionProvider: { suggestedActions in return UIMenu(title: "", children: [markAllAction]) }) } @@ -1246,7 +1246,7 @@ private extension FeedViewController { } -extension FeedViewController: UIGestureRecognizerDelegate { +extension MainFeedViewController: UIGestureRecognizerDelegate { func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool { guard let gestureRecognizer = gestureRecognizer as? UIPanGestureRecognizer else { return false diff --git a/iOS/Feed/RefreshProgressView.swift b/iOS/MainFeed/RefreshProgressView.swift similarity index 100% rename from iOS/Feed/RefreshProgressView.swift rename to iOS/MainFeed/RefreshProgressView.swift diff --git a/iOS/Feed/RefreshProgressView.xib b/iOS/MainFeed/RefreshProgressView.xib similarity index 100% rename from iOS/Feed/RefreshProgressView.xib rename to iOS/MainFeed/RefreshProgressView.xib diff --git a/iOS/Feed/ShadowTableChanges.swift b/iOS/MainFeed/ShadowTableChanges.swift similarity index 100% rename from iOS/Feed/ShadowTableChanges.swift rename to iOS/MainFeed/ShadowTableChanges.swift diff --git a/iOS/SceneCoordinator.swift b/iOS/SceneCoordinator.swift index 24135733a..20669b95c 100644 --- a/iOS/SceneCoordinator.swift +++ b/iOS/SceneCoordinator.swift @@ -60,7 +60,7 @@ class SceneCoordinator: NSObject, UndoableCommandRunner { private var rootSplitViewController: RootSplitViewController! private var navigationController: UINavigationController! - private var feedViewController: FeedViewController! + private var feedViewController: MainFeedViewController! private var timelineViewController: TimelineViewController? private var subSplitViewController: UISplitViewController? @@ -339,7 +339,7 @@ class SceneCoordinator: NSObject, UndoableCommandRunner { navigationController = (rootSplitViewController.viewControllers.first as! UINavigationController) navigationController.delegate = self - feedViewController = UIStoryboard.main.instantiateController(ofType: FeedViewController.self) + feedViewController = UIStoryboard.main.instantiateController(ofType: MainFeedViewController.self) feedViewController.coordinator = self navigationController.pushViewController(feedViewController, animated: false) diff --git a/iOS/Timeline/TimelineUnreadCountView.swift b/iOS/Timeline/TimelineUnreadCountView.swift index 603865e3f..8591f7250 100644 --- a/iOS/Timeline/TimelineUnreadCountView.swift +++ b/iOS/Timeline/TimelineUnreadCountView.swift @@ -8,7 +8,7 @@ import UIKit -class TimelineUnreadCountView: FeedUnreadCountView { +class TimelineUnreadCountView: MainFeedUnreadCountView { override var padding: UIEdgeInsets { return UIEdgeInsets(top: 2.0, left: 9.0, bottom: 2.0, right: 9.0)