Rename classes to more accurately describe their usage in the application.

This commit is contained in:
Maurice Parker
2019-04-23 08:00:27 -05:00
parent 717d09b2be
commit 12d4d2dbb1
14 changed files with 83 additions and 87 deletions

View File

@@ -1,10 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="H1p-Uh-vWS">
<device id="retina4_0" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
@@ -35,11 +31,11 @@
<objects>
<viewController storyboardIdentifier="DetailViewController" title="Detail" useStoryboardIdentifierAsRestorationIdentifier="YES" id="JEX-9P-axG" customClass="DetailViewController" customModule="NetNewsWire" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="svH-Pt-448">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<wkWebView contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="t8d-md-Yhc">
<rect key="frame" x="0.0" y="64" width="320" height="460"/>
<rect key="frame" x="0.0" y="64" width="600" height="492"/>
<color key="backgroundColor" red="0.36078431370000003" green="0.38823529410000002" blue="0.4039215686" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<wkWebViewConfiguration key="configuration">
<audiovisualMediaTypes key="mediaTypesRequiringUserActionForPlayback" none="YES"/>
@@ -121,15 +117,15 @@
<objects>
<tableViewController storyboardIdentifier="MasterTimelineViewController" useStoryboardIdentifierAsRestorationIdentifier="YES" id="Kyk-vK-QRX" customClass="MasterTimelineViewController" customModule="NetNewsWire" customModuleProvider="target" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" id="mtv-Ik-FoJ">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="Cell" rowHeight="208" id="T5d-L4-OKG" customClass="MasterTimelineTableViewCell" customModule="NetNewsWire" customModuleProvider="target">
<rect key="frame" x="0.0" y="28" width="320" height="208"/>
<rect key="frame" x="0.0" y="28" width="600" height="208"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="T5d-L4-OKG" id="QKC-jN-XDy">
<rect key="frame" x="0.0" y="0.0" width="320" height="207.5"/>
<rect key="frame" x="0.0" y="0.0" width="600" height="207.5"/>
<autoresizingMask key="autoresizingMask"/>
</tableViewCellContentView>
<connections>
@@ -203,17 +199,17 @@
<!--Master-->
<scene sceneID="smW-Zh-WAh">
<objects>
<tableViewController storyboardIdentifier="MasterViewController" title="Master" useStoryboardIdentifierAsRestorationIdentifier="YES" clearsSelectionOnViewWillAppear="NO" id="7bK-jq-Zjz" customClass="MasterViewController" customModule="NetNewsWire" customModuleProvider="target" sceneMemberID="viewController">
<tableViewController storyboardIdentifier="MasterViewController" title="Master" useStoryboardIdentifierAsRestorationIdentifier="YES" clearsSelectionOnViewWillAppear="NO" id="7bK-jq-Zjz" customClass="MasterFeedViewController" customModule="NetNewsWire" customModuleProvider="target" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="18" sectionFooterHeight="18" id="r7i-6Z-zg0">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="Cell" id="zNG-5C-pQm" customClass="MasterTableViewCell" customModule="NetNewsWire" customModuleProvider="target">
<rect key="frame" x="0.0" y="55.5" width="320" height="44"/>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="Cell" id="zNG-5C-pQm" customClass="MasterFeedTableViewCell" customModule="NetNewsWire" customModuleProvider="target">
<rect key="frame" x="0.0" y="55.5" width="600" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="zNG-5C-pQm" id="5gB-Jr-qIo">
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
<rect key="frame" x="0.0" y="0.0" width="600" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
</tableViewCellContentView>
</tableViewCell>

View File

@@ -11,13 +11,13 @@ import RSCore
import Account
import RSTree
protocol MasterTableViewCellDelegate: class {
func disclosureSelected(_ sender: MasterTableViewCell, expanding: Bool)
protocol MasterFeedTableViewCellDelegate: class {
func disclosureSelected(_ sender: MasterFeedTableViewCell, expanding: Bool)
}
class MasterTableViewCell : UITableViewCell {
class MasterFeedTableViewCell : UITableViewCell {
weak var delegate: MasterTableViewCellDelegate?
weak var delegate: MasterFeedTableViewCellDelegate?
var allowDisclosureSelection = false
override var accessibilityLabel: String? {
@@ -96,7 +96,7 @@ class MasterTableViewCell : UITableViewCell {
return UIImageView(image: AppAssets.feedImage)
}()
private let unreadCountView = MasterUnreadCountView(frame: CGRect.zero)
private let unreadCountView = MasterFeedUnreadCountView(frame: CGRect.zero)
private var showingEditControl = false
private var disclosureButton: UIButton?
@@ -113,7 +113,7 @@ class MasterTableViewCell : UITableViewCell {
override func layoutSubviews() {
super.layoutSubviews()
let shouldShowDisclosure = !(showingEditControl && showsReorderControl)
let layout = MasterTableViewCellLayout(cellSize: bounds.size, insets: safeAreaInsets, shouldShowImage: shouldShowImage, label: titleView, unreadCountView: unreadCountView, showingEditingControl: showingEditControl, indent: indentationLevel == 1, shouldShowDisclosure: shouldShowDisclosure)
let layout = MasterFeedTableViewCellLayout(cellSize: bounds.size, insets: safeAreaInsets, shouldShowImage: shouldShowImage, label: titleView, unreadCountView: unreadCountView, showingEditingControl: showingEditControl, indent: indentationLevel == 1, shouldShowDisclosure: shouldShowDisclosure)
layoutWith(layout)
}
@@ -126,7 +126,7 @@ class MasterTableViewCell : UITableViewCell {
}
private extension MasterTableViewCell {
private extension MasterFeedTableViewCell {
func commonInit() {
theme()
@@ -166,7 +166,7 @@ private extension MasterTableViewCell {
view.translatesAutoresizingMaskIntoConstraints = false
}
func layoutWith(_ layout: MasterTableViewCellLayout) {
func layoutWith(_ layout: MasterFeedTableViewCellLayout) {
faviconImageView.setFrameIfNotEqual(layout.faviconRect)
titleView.setFrameIfNotEqual(layout.titleRect)
unreadCountView.setFrameIfNotEqual(layout.unreadCountRect)

View File

@@ -9,7 +9,7 @@
import UIKit
import RSCore
struct MasterTableViewCellLayout {
struct MasterFeedTableViewCellLayout {
private static let indent = CGFloat(integerLiteral: 14)
private static let editingControlIndent = CGFloat(integerLiteral: 40)
@@ -25,14 +25,14 @@ struct MasterTableViewCellLayout {
let unreadCountRect: CGRect
let disclosureButtonRect: CGRect
init(cellSize: CGSize, insets: UIEdgeInsets, shouldShowImage: Bool, label: UILabel, unreadCountView: MasterUnreadCountView, showingEditingControl: Bool, indent: Bool, shouldShowDisclosure: Bool) {
init(cellSize: CGSize, insets: UIEdgeInsets, shouldShowImage: Bool, label: UILabel, unreadCountView: MasterFeedUnreadCountView, showingEditingControl: Bool, indent: Bool, shouldShowDisclosure: Bool) {
var initialIndent = MasterTableViewCellLayout.marginLeft + insets.left
var initialIndent = MasterFeedTableViewCellLayout.marginLeft + insets.left
if indent {
initialIndent += MasterTableViewCellLayout.indent
initialIndent += MasterFeedTableViewCellLayout.indent
}
if showingEditingControl {
initialIndent += MasterTableViewCellLayout.editingControlIndent
initialIndent += MasterFeedTableViewCellLayout.editingControlIndent
}
let bounds = CGRect(x: initialIndent, y: 0.0, width: floor(cellSize.width - initialIndent - insets.right), height: floor(cellSize.height))
@@ -40,8 +40,8 @@ struct MasterTableViewCellLayout {
// Favicon
var rFavicon = CGRect.zero
if shouldShowImage {
rFavicon = CGRect(x: bounds.origin.x, y: 0.0, width: MasterTableViewCellLayout.imageSize.width, height: MasterTableViewCellLayout.imageSize.height)
rFavicon = MasterTableViewCellLayout.centerVertically(rFavicon, bounds)
rFavicon = CGRect(x: bounds.origin.x, y: 0.0, width: MasterFeedTableViewCellLayout.imageSize.width, height: MasterFeedTableViewCellLayout.imageSize.height)
rFavicon = MasterFeedTableViewCellLayout.centerVertically(rFavicon, bounds)
}
self.faviconRect = rFavicon
@@ -50,12 +50,12 @@ struct MasterTableViewCellLayout {
var rLabel = CGRect(x: 0.0, y: 0.0, width: labelSize.width, height: labelSize.height)
if shouldShowImage {
rLabel.origin.x = rFavicon.maxX + MasterTableViewCellLayout.imageMarginRight
rLabel.origin.x = rFavicon.maxX + MasterFeedTableViewCellLayout.imageMarginRight
} else {
rLabel.origin.x = bounds.minX
}
rLabel = MasterTableViewCellLayout.centerVertically(rLabel, bounds)
rLabel = MasterFeedTableViewCellLayout.centerVertically(rLabel, bounds)
// Unread Count
let unreadCountSize = unreadCountView.intrinsicContentSize
@@ -66,11 +66,11 @@ struct MasterTableViewCellLayout {
rUnread.size = unreadCountSize
rUnread.origin.x = bounds.maxX -
(unreadCountSize.width + MasterTableViewCellLayout.unreadCountMarginRight + MasterTableViewCellLayout.disclosureButtonSize.width)
rUnread = MasterTableViewCellLayout.centerVertically(rUnread, bounds)
(unreadCountSize.width + MasterFeedTableViewCellLayout.unreadCountMarginRight + MasterFeedTableViewCellLayout.disclosureButtonSize.width)
rUnread = MasterFeedTableViewCellLayout.centerVertically(rUnread, bounds)
// Cap the Title width based on the unread indicator button
let labelMaxX = rUnread.minX - MasterTableViewCellLayout.unreadCountMarginLeft
let labelMaxX = rUnread.minX - MasterFeedTableViewCellLayout.unreadCountMarginLeft
if rLabel.maxX > labelMaxX {
rLabel.size.width = labelMaxX - rLabel.minX
}
@@ -82,9 +82,9 @@ struct MasterTableViewCellLayout {
var rDisclosure = CGRect.zero
if shouldShowDisclosure {
rDisclosure.size = MasterTableViewCellLayout.disclosureButtonSize
rDisclosure.origin.x = bounds.maxX - MasterTableViewCellLayout.disclosureButtonSize.width
rDisclosure = MasterTableViewCellLayout.centerVertically(rDisclosure, bounds)
rDisclosure.size = MasterFeedTableViewCellLayout.disclosureButtonSize
rDisclosure.origin.x = bounds.maxX - MasterFeedTableViewCellLayout.disclosureButtonSize.width
rDisclosure = MasterFeedTableViewCellLayout.centerVertically(rDisclosure, bounds)
// Cap the Title width based on the disclosure button
let labelMaxX = rDisclosure.minX

View File

@@ -8,7 +8,7 @@
import UIKit
class MasterTableViewSectionHeader: UITableViewHeaderFooterView {
class MasterFeedTableViewSectionHeader: UITableViewHeaderFooterView {
override var accessibilityLabel: String? {
set {}
@@ -63,7 +63,7 @@ class MasterTableViewSectionHeader: UITableViewHeaderFooterView {
return label
}()
private let unreadCountView = MasterUnreadCountView(frame: CGRect.zero)
private let unreadCountView = MasterFeedUnreadCountView(frame: CGRect.zero)
private var disclosureView: UIImageView = {
let iView = UIImageView()
iView.contentMode = .center
@@ -82,14 +82,14 @@ class MasterTableViewSectionHeader: UITableViewHeaderFooterView {
override func layoutSubviews() {
super.layoutSubviews()
let layout = MasterTableViewCellLayout(cellSize: bounds.size, insets: safeAreaInsets, shouldShowImage: false, label: titleView, unreadCountView: unreadCountView, showingEditingControl: false, indent: true, shouldShowDisclosure: true)
let layout = MasterFeedTableViewCellLayout(cellSize: bounds.size, insets: safeAreaInsets, shouldShowImage: false, label: titleView, unreadCountView: unreadCountView, showingEditingControl: false, indent: true, shouldShowDisclosure: true)
layoutWith(layout)
}
}
private extension MasterTableViewSectionHeader {
private extension MasterFeedTableViewSectionHeader {
func commonInit() {
let view = UIView()
@@ -114,7 +114,7 @@ private extension MasterTableViewSectionHeader {
view.translatesAutoresizingMaskIntoConstraints = false
}
func layoutWith(_ layout: MasterTableViewCellLayout) {
func layoutWith(_ layout: MasterFeedTableViewCellLayout) {
titleView.setFrameIfNotEqual(layout.titleRect)
unreadCountView.setFrameIfNotEqual(layout.unreadCountRect)
disclosureView.setFrameIfNotEqual(layout.disclosureButtonRect)

View File

@@ -16,7 +16,7 @@ private let textFont = UIFont.systemFont(ofSize: 11.0, weight: UIFont.Weight.sem
private var textAttributes: [NSAttributedString.Key: AnyObject] = [NSAttributedString.Key.foregroundColor: textColor, NSAttributedString.Key.font: textFont, NSAttributedString.Key.kern: NSNull()]
private var textSizeCache = [Int: CGSize]()
class MasterUnreadCountView : UIView {
class MasterFeedUnreadCountView : UIView {
var unreadCount = 0 {
didSet {

View File

@@ -12,7 +12,7 @@ import Articles
import RSCore
import RSTree
class MasterViewController: ProgressTableViewController, UndoableCommandRunner {
class MasterFeedViewController: ProgressTableViewController, UndoableCommandRunner {
@IBOutlet weak var markAllAsReadButton: UIBarButtonItem!
@@ -29,7 +29,7 @@ class MasterViewController: ProgressTableViewController, UndoableCommandRunner {
navigationItem.rightBarButtonItem = editButtonItem
tableView.register(MasterTableViewSectionHeader.self, forHeaderFooterViewReuseIdentifier: "SectionHeader")
tableView.register(MasterFeedTableViewSectionHeader.self, forHeaderFooterViewReuseIdentifier: "SectionHeader")
NotificationCenter.default.addObserver(self, selector: #selector(unreadCountDidChange(_:)), name: .UnreadCountDidChange, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(faviconDidBecomeAvailable(_:)), name: .FaviconDidBecomeAvailable, object: nil)
@@ -76,7 +76,7 @@ class MasterViewController: ProgressTableViewController, UndoableCommandRunner {
if let account = representedObject as? Account {
if let node = navState.rootNode.childNodeRepresentingObject(account) {
let sectionIndex = navState.rootNode.indexOfChild(node)!
if let headerView = tableView.headerView(forSection: sectionIndex) as? MasterTableViewSectionHeader {
if let headerView = tableView.headerView(forSection: sectionIndex) as? MasterFeedTableViewSectionHeader {
headerView.unreadCount = account.unreadCount
}
}
@@ -161,7 +161,7 @@ class MasterViewController: ProgressTableViewController, UndoableCommandRunner {
return nil
}
let headerView = tableView.dequeueReusableHeaderFooterView(withIdentifier: "SectionHeader") as! MasterTableViewSectionHeader
let headerView = tableView.dequeueReusableHeaderFooterView(withIdentifier: "SectionHeader") as! MasterFeedTableViewSectionHeader
headerView.name = nameProvider.nameForDisplay
guard let sectionNode = navState.rootNode.childAtIndex(section) else {
@@ -194,7 +194,7 @@ class MasterViewController: ProgressTableViewController, UndoableCommandRunner {
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath) as! MasterTableViewCell
let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath) as! MasterFeedTableViewCell
guard let node = navState.nodeFor(indexPath) else {
return cell
@@ -446,7 +446,7 @@ class MasterViewController: ProgressTableViewController, UndoableCommandRunner {
guard let sectionIndex = sender.view?.tag,
let sectionNode = navState.rootNode.childAtIndex(sectionIndex),
let headerView = sender.view as? MasterTableViewSectionHeader
let headerView = sender.view as? MasterFeedTableViewSectionHeader
else {
return
}
@@ -471,7 +471,7 @@ class MasterViewController: ProgressTableViewController, UndoableCommandRunner {
// MARK: API
func configure(_ cell: MasterTableViewCell, _ node: Node) {
func configure(_ cell: MasterFeedTableViewCell, _ node: Node) {
cell.delegate = self
if node.parent?.representedObject is Folder {
@@ -489,11 +489,11 @@ class MasterViewController: ProgressTableViewController, UndoableCommandRunner {
}
func configureUnreadCount(_ cell: MasterTableViewCell, _ node: Node) {
func configureUnreadCount(_ cell: MasterFeedTableViewCell, _ node: Node) {
cell.unreadCount = unreadCountFor(node)
}
func configureFavicon(_ cell: MasterTableViewCell, _ node: Node) {
func configureFavicon(_ cell: MasterFeedTableViewCell, _ node: Node) {
cell.faviconImage = imageFor(node)
}
@@ -581,7 +581,7 @@ class MasterViewController: ProgressTableViewController, UndoableCommandRunner {
// MARK: OPML Document Picker
extension MasterViewController: UIDocumentPickerDelegate {
extension MasterFeedViewController: UIDocumentPickerDelegate {
func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentsAt urls: [URL]) {
@@ -599,9 +599,9 @@ extension MasterViewController: UIDocumentPickerDelegate {
// MARK: MasterTableViewCellDelegate
extension MasterViewController: MasterTableViewCellDelegate {
extension MasterFeedViewController: MasterFeedTableViewCellDelegate {
func disclosureSelected(_ sender: MasterTableViewCell, expanding: Bool) {
func disclosureSelected(_ sender: MasterFeedTableViewCell, expanding: Bool) {
if expanding {
expand(sender)
} else {
@@ -613,7 +613,7 @@ extension MasterViewController: MasterTableViewCellDelegate {
// MARK: Private
private extension MasterViewController {
private extension MasterFeedViewController {
@objc private func refreshAccounts(_ sender: Any) {
AccountManager.shared.refreshAll()
@@ -633,7 +633,7 @@ private extension MasterViewController {
applyToCellsForRepresentedObject(representedObject, configureUnreadCount)
}
func applyToCellsForRepresentedObject(_ representedObject: AnyObject, _ callback: (MasterTableViewCell, Node) -> Void) {
func applyToCellsForRepresentedObject(_ representedObject: AnyObject, _ callback: (MasterFeedTableViewCell, Node) -> Void) {
applyToAvailableCells { (cell, node) in
if node.representedObject === representedObject {
callback(cell, node)
@@ -641,12 +641,12 @@ private extension MasterViewController {
}
}
func applyToAvailableCells(_ callback: (MasterTableViewCell, Node) -> Void) {
func applyToAvailableCells(_ callback: (MasterFeedTableViewCell, Node) -> Void) {
tableView.visibleCells.forEach { cell in
guard let indexPath = tableView.indexPath(for: cell), let node = navState.nodeFor(indexPath) else {
return
}
callback(cell as! MasterTableViewCell, node)
callback(cell as! MasterFeedTableViewCell, node)
}
}
@@ -663,7 +663,7 @@ private extension MasterViewController {
return nil
}
func expand(_ cell: MasterTableViewCell) {
func expand(_ cell: MasterFeedTableViewCell) {
guard let indexPath = tableView.indexPath(for: cell) else {
return
}
@@ -674,7 +674,7 @@ private extension MasterViewController {
}
}
func collapse(_ cell: MasterTableViewCell) {
func collapse(_ cell: MasterFeedTableViewCell) {
guard let indexPath = tableView.indexPath(for: cell) else {
return
}