mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Rename a bunch of iOS classes to match names in 6.1.6-iOS branch — trying to reconcile branch and main, and having same names for classes will make that easier.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
@@ -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
|
||||
@@ -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)
|
||||
@@ -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
|
||||
@@ -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)
|
||||
}
|
||||
@@ -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 {
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user