mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
@@ -98,9 +98,13 @@ struct AppAssets {
|
||||
}()
|
||||
|
||||
static var disclosureImage: UIImage = {
|
||||
return UIImage(named: "disclosure")!
|
||||
return UIImage(systemName: "chevron.right")!
|
||||
}()
|
||||
|
||||
static func disclosureImage(size: CGFloat, weight: UIImage.SymbolWeight) -> UIImage {
|
||||
return UIImage(systemName: "chevron.right", withConfiguration: UIImage.SymbolConfiguration(pointSize: size, weight: weight))!
|
||||
}
|
||||
|
||||
static var contextMenuReddit: UIImage = {
|
||||
return UIImage(named: "contextMenuReddit")!
|
||||
}()
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="19529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<device id="retina6_1" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17703"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19519"/>
|
||||
<capability name="Named colors" minToolsVersion="9.0"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="System colors in document resources" minToolsVersion="11.0"/>
|
||||
@@ -13,13 +12,13 @@
|
||||
<!--Article-->
|
||||
<scene sceneID="yUG-lL-AsK">
|
||||
<objects>
|
||||
<viewController storyboardIdentifier="ArticleViewController" title="Detail" useStoryboardIdentifierAsRestorationIdentifier="YES" id="JEX-9P-axG" userLabel="Article" customClass="ArticleViewController" customModule="NetNewsWire" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<viewController storyboardIdentifier="ArticleViewController" title="Detail" extendedLayoutIncludesOpaqueBars="YES" useStoryboardIdentifierAsRestorationIdentifier="YES" id="JEX-9P-axG" userLabel="Article" customClass="ArticleViewController" 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="414" height="896"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="h1Q-FS-jlg" customClass="ArticleSearchBar" customModule="NetNewsWire" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="777" width="414" height="36"/>
|
||||
<rect key="frame" x="0.0" y="782" width="414" height="31"/>
|
||||
<color key="backgroundColor" name="barBackgroundColor"/>
|
||||
</view>
|
||||
</subviews>
|
||||
@@ -113,14 +112,14 @@
|
||||
<!--Timeline-->
|
||||
<scene sceneID="fag-XH-avP">
|
||||
<objects>
|
||||
<tableViewController storyboardIdentifier="MasterTimelineViewController" useStoryboardIdentifierAsRestorationIdentifier="YES" clearsSelectionOnViewWillAppear="NO" id="Kyk-vK-QRX" customClass="MasterTimelineViewController" customModule="NetNewsWire" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" keyboardDismissMode="onDrag" 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="414" height="725"/>
|
||||
<tableViewController storyboardIdentifier="MasterTimelineViewController" extendedLayoutIncludesOpaqueBars="YES" useStoryboardIdentifierAsRestorationIdentifier="YES" clearsSelectionOnViewWillAppear="NO" id="Kyk-vK-QRX" customClass="MasterTimelineViewController" customModule="NetNewsWire" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" keyboardDismissMode="onDrag" dataMode="prototypes" style="plain" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" id="mtv-Ik-FoJ">
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
|
||||
<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="414" height="208"/>
|
||||
<rect key="frame" x="0.0" y="44.5" width="414" 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="414" height="208"/>
|
||||
@@ -166,7 +165,7 @@
|
||||
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
|
||||
<prototypes>
|
||||
<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="414" height="43.5"/>
|
||||
<rect key="frame" x="0.0" y="49.5" width="414" height="43.5"/>
|
||||
<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="414" height="43.5"/>
|
||||
@@ -316,26 +315,26 @@
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="200"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Blog Name" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="YsT-Lt-Zry">
|
||||
<rect key="frame" x="20" y="8" width="87" height="20.5"/>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="Blog Name" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="YsT-Lt-Zry">
|
||||
<rect key="frame" x="20" y="8" width="73" height="20.5"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleHeadline"/>
|
||||
<color key="textColor" name="primaryAccentColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Blog Author" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7GV-PV-YVq">
|
||||
<rect key="frame" x="20" y="36.5" width="90" height="21"/>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="Blog Author" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7GV-PV-YVq">
|
||||
<rect key="frame" x="20" y="36.5" width="76.5" height="21"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Article Title" textAlignment="natural" lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="iFp-rn-HhQ">
|
||||
<rect key="frame" x="20" y="74.5" width="135.5" height="33.5"/>
|
||||
<rect key="frame" x="20" y="73" width="121.5" height="30"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleTitle1"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="0Hz-Dv-MhU">
|
||||
<rect key="frame" x="20" y="116" width="44" height="20.5"/>
|
||||
<rect key="frame" x="20" y="111" width="37" height="17"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleHeadline"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
@@ -349,7 +348,7 @@
|
||||
</constraints>
|
||||
</view>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="0ko-zB-cnS">
|
||||
<rect key="frame" x="20" y="65.5" width="374" height="1"/>
|
||||
<rect key="frame" x="20" y="64" width="374" height="1"/>
|
||||
<color key="backgroundColor" systemColor="separatorColor"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="1" id="IVk-Gd-niT"/>
|
||||
|
||||
@@ -45,6 +45,14 @@ class MasterFeedTableViewCell : VibrantTableViewCell {
|
||||
}
|
||||
}
|
||||
|
||||
var itemIsInFolder = false {
|
||||
didSet {
|
||||
if itemIsInFolder != oldValue {
|
||||
setNeedsLayout()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var isSeparatorShown = true {
|
||||
didSet {
|
||||
if isSeparatorShown != oldValue {
|
||||
@@ -136,14 +144,19 @@ class MasterFeedTableViewCell : VibrantTableViewCell {
|
||||
}
|
||||
|
||||
override func sizeThatFits(_ size: CGSize) -> CGSize {
|
||||
let layout = MasterFeedTableViewCellLayout(cellWidth: bounds.size.width, insets: safeAreaInsets, label: titleView, unreadCountView: unreadCountView, showingEditingControl: isShowingEditControl, indent: indentationLevel == 1, shouldShowDisclosure: isDisclosureAvailable)
|
||||
let layout = MasterFeedTableViewCellLayout(cellWidth: bounds.size.width, insets: safeAreaInsets, label: titleView, unreadCountView: unreadCountView, showingEditingControl: isShowingEditControl, indent: indentationLevel == 1, shouldShowDisclosure: isDisclosureAvailable, itemIsInFolder: itemIsInFolder)
|
||||
return CGSize(width: bounds.width, height: layout.height)
|
||||
}
|
||||
|
||||
override func layoutSubviews() {
|
||||
super.layoutSubviews()
|
||||
let layout = MasterFeedTableViewCellLayout(cellWidth: bounds.size.width, insets: safeAreaInsets, label: titleView, unreadCountView: unreadCountView, showingEditingControl: isShowingEditControl, indent: indentationLevel == 1, shouldShowDisclosure: isDisclosureAvailable)
|
||||
let layout = MasterFeedTableViewCellLayout(cellWidth: bounds.size.width, insets: safeAreaInsets, label: titleView, unreadCountView: unreadCountView, showingEditingControl: isShowingEditControl, indent: indentationLevel == 1, shouldShowDisclosure: isDisclosureAvailable, itemIsInFolder: itemIsInFolder)
|
||||
layoutWith(layout)
|
||||
if isDisclosureAvailable {
|
||||
titleView.font = .preferredFont(forTextStyle: .body).bold()
|
||||
} else {
|
||||
titleView.font = .preferredFont(forTextStyle: .body)
|
||||
}
|
||||
}
|
||||
|
||||
@objc func buttonPressed(_ sender: UIButton) {
|
||||
@@ -193,8 +206,8 @@ private extension MasterFeedTableViewCell {
|
||||
func addDisclosureView() {
|
||||
disclosureButton = NonIntrinsicButton(type: .roundedRect)
|
||||
disclosureButton!.addTarget(self, action: #selector(buttonPressed(_:)), for: UIControl.Event.touchUpInside)
|
||||
disclosureButton?.setImage(AppAssets.disclosureImage, for: .normal)
|
||||
disclosureButton?.tintColor = AppAssets.controlBackgroundColor
|
||||
disclosureButton?.setImage(AppAssets.disclosureImage(size: 16, weight: .regular), for: .normal)
|
||||
disclosureButton?.tintColor = AppAssets.secondaryAccentColor
|
||||
disclosureButton?.imageView?.contentMode = .center
|
||||
disclosureButton?.imageView?.clipsToBounds = false
|
||||
disclosureButton?.addInteraction(UIPointerInteraction())
|
||||
|
||||
@@ -11,13 +11,13 @@ import RSCore
|
||||
|
||||
struct MasterFeedTableViewCellLayout {
|
||||
|
||||
private static let indentWidth = CGFloat(integerLiteral: 42)
|
||||
private static let indentWidth = CGFloat(integerLiteral: 15)
|
||||
private static let editingControlIndent = CGFloat(integerLiteral: 40)
|
||||
private static let imageSize = CGSize(width: 24, height: 24)
|
||||
private static let imageMarginRight = CGFloat(integerLiteral: 11)
|
||||
private static let labelMarginRight = CGFloat(integerLiteral: 8)
|
||||
private static let unreadCountMarginRight = CGFloat(integerLiteral: 16)
|
||||
private static let disclosureButtonSize = CGSize(width: 44, height: 44)
|
||||
private static let disclosureButtonSize = CGSize(width: 55, height: 44)
|
||||
private static let verticalPadding = CGFloat(integerLiteral: 11)
|
||||
|
||||
private static let minRowHeight = CGFloat(integerLiteral: 44)
|
||||
@@ -32,7 +32,7 @@ struct MasterFeedTableViewCellLayout {
|
||||
|
||||
let height: CGFloat
|
||||
|
||||
init(cellWidth: CGFloat, insets: UIEdgeInsets, label: UILabel, unreadCountView: MasterFeedUnreadCountView, showingEditingControl: Bool, indent: Bool, shouldShowDisclosure: Bool) {
|
||||
init(cellWidth: CGFloat, insets: UIEdgeInsets, label: UILabel, unreadCountView: MasterFeedUnreadCountView, showingEditingControl: Bool, indent: Bool, shouldShowDisclosure: Bool, itemIsInFolder: Bool) {
|
||||
|
||||
var initialIndent = insets.left
|
||||
if indent {
|
||||
@@ -54,7 +54,12 @@ struct MasterFeedTableViewCellLayout {
|
||||
let y = UIFontMetrics.default.scaledValue(for: MasterFeedTableViewCellLayout.verticalPadding) +
|
||||
label.font.lineHeight / 2.0 -
|
||||
MasterFeedTableViewCellLayout.imageSize.height / 2.0
|
||||
rFavicon = CGRect(x: x, y: y, width: MasterFeedTableViewCellLayout.imageSize.width, height: MasterFeedTableViewCellLayout.imageSize.height)
|
||||
if itemIsInFolder {
|
||||
rFavicon = CGRect(x: x + MasterFeedTableViewCellLayout.disclosureButtonSize.width - (MasterFeedTableViewCellLayout.imageSize.width / 2), y: y, width: MasterFeedTableViewCellLayout.imageSize.width, height: MasterFeedTableViewCellLayout.imageSize.height)
|
||||
} else {
|
||||
rFavicon = CGRect(x: x, y: y, width: MasterFeedTableViewCellLayout.imageSize.width, height: MasterFeedTableViewCellLayout.imageSize.height)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Unread Count
|
||||
@@ -68,9 +73,9 @@ struct MasterFeedTableViewCellLayout {
|
||||
}
|
||||
|
||||
// Title
|
||||
var rLabelx = insets.left + MasterFeedTableViewCellLayout.disclosureButtonSize.width
|
||||
if !shouldShowDisclosure {
|
||||
rLabelx = rLabelx + MasterFeedTableViewCellLayout.imageSize.width + MasterFeedTableViewCellLayout.imageMarginRight
|
||||
var rLabelx = MasterFeedTableViewCellLayout.disclosureButtonSize.width
|
||||
if itemIsInFolder {
|
||||
rLabelx += MasterFeedTableViewCellLayout.disclosureButtonSize.width - (rFavicon.width / 2)
|
||||
}
|
||||
let rLabely = UIFontMetrics.default.scaledValue(for: MasterFeedTableViewCellLayout.verticalPadding)
|
||||
|
||||
@@ -127,6 +132,7 @@ struct MasterFeedTableViewCellLayout {
|
||||
let separatorInset = MasterFeedTableViewCellLayout.disclosureButtonSize.width
|
||||
separatorRect = CGRect(x: separatorInset, y: cellHeight - 0.5, width: cellWidth - separatorInset, height: 0.5)
|
||||
|
||||
|
||||
// Assign the properties
|
||||
self.height = cellHeight
|
||||
self.faviconRect = rFavicon
|
||||
|
||||
@@ -19,12 +19,7 @@ class MasterFeedTableViewSectionHeader: UITableViewHeaderFooterView {
|
||||
override var accessibilityLabel: String? {
|
||||
set {}
|
||||
get {
|
||||
if unreadCount > 0 {
|
||||
let unreadLabel = NSLocalizedString("unread", comment: "Unread label for accessiblity")
|
||||
return "\(name) \(unreadCount) \(unreadLabel) \(expandedStateMessage) "
|
||||
} else {
|
||||
return "\(name) \(expandedStateMessage) "
|
||||
}
|
||||
return "\(name) \(expandedStateMessage)"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,19 +33,6 @@ class MasterFeedTableViewSectionHeader: UITableViewHeaderFooterView {
|
||||
}
|
||||
}
|
||||
|
||||
var unreadCount: Int {
|
||||
get {
|
||||
return unreadCountView.unreadCount
|
||||
}
|
||||
set {
|
||||
if unreadCountView.unreadCount != newValue {
|
||||
unreadCountView.unreadCount = newValue
|
||||
updateUnreadCountView()
|
||||
setNeedsLayout()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var name: String {
|
||||
get {
|
||||
return titleView.text ?? ""
|
||||
@@ -66,7 +48,6 @@ class MasterFeedTableViewSectionHeader: UITableViewHeaderFooterView {
|
||||
var disclosureExpanded = false {
|
||||
didSet {
|
||||
updateExpandedState(animate: true)
|
||||
updateUnreadCountView()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +58,7 @@ class MasterFeedTableViewSectionHeader: UITableViewHeaderFooterView {
|
||||
label.numberOfLines = 0
|
||||
label.allowsDefaultTighteningForTruncation = false
|
||||
label.adjustsFontForContentSizeCategory = true
|
||||
label.font = .preferredFont(forTextStyle: .body)
|
||||
label.font = UIFont.systemFont(ofSize: UIFont.preferredFont(forTextStyle: .title2).pointSize, weight: .bold)
|
||||
return label
|
||||
}()
|
||||
|
||||
@@ -85,8 +66,8 @@ class MasterFeedTableViewSectionHeader: UITableViewHeaderFooterView {
|
||||
|
||||
private lazy var disclosureButton: UIButton = {
|
||||
let button = NonIntrinsicButton()
|
||||
button.tintColor = UIColor.tertiaryLabel
|
||||
button.setImage(AppAssets.disclosureImage, for: .normal)
|
||||
button.tintColor = AppAssets.secondaryAccentColor
|
||||
button.setImage(AppAssets.disclosureImage(size: 14, weight: .bold), for: .normal)
|
||||
button.contentMode = .center
|
||||
button.addInteraction(UIPointerInteraction())
|
||||
button.addTarget(self, action: #selector(toggleDisclosure), for: .touchUpInside)
|
||||
@@ -95,13 +76,13 @@ class MasterFeedTableViewSectionHeader: UITableViewHeaderFooterView {
|
||||
|
||||
private let topSeparatorView: UIView = {
|
||||
let view = UIView()
|
||||
view.backgroundColor = UIColor.separator
|
||||
view.backgroundColor = UIColor.clear
|
||||
return view
|
||||
}()
|
||||
|
||||
private let bottomSeparatorView: UIView = {
|
||||
let view = UIView()
|
||||
view.backgroundColor = UIColor.separator
|
||||
view.backgroundColor = UIColor.clear
|
||||
return view
|
||||
}()
|
||||
|
||||
@@ -139,7 +120,6 @@ private extension MasterFeedTableViewSectionHeader {
|
||||
}
|
||||
|
||||
func commonInit() {
|
||||
addSubviewAtInit(unreadCountView)
|
||||
addSubviewAtInit(titleView)
|
||||
addSubviewAtInit(disclosureButton)
|
||||
updateExpandedState(animate: false)
|
||||
@@ -169,18 +149,6 @@ private extension MasterFeedTableViewSectionHeader {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func updateUnreadCountView() {
|
||||
if !disclosureExpanded && unreadCount > 0 {
|
||||
UIView.animate(withDuration: 0.3) {
|
||||
self.unreadCountView.alpha = 1
|
||||
}
|
||||
} else {
|
||||
UIView.animate(withDuration: 0.3) {
|
||||
self.unreadCountView.alpha = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func addSubviewAtInit(_ view: UIView) {
|
||||
contentView.addSubview(view)
|
||||
@@ -200,7 +168,7 @@ private extension MasterFeedTableViewSectionHeader {
|
||||
|
||||
func addBackgroundView() {
|
||||
self.backgroundView = UIView(frame: self.bounds)
|
||||
self.backgroundView?.backgroundColor = AppAssets.sectionHeaderColor
|
||||
self.backgroundView?.backgroundColor = .clear
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import RSCore
|
||||
struct MasterFeedTableViewSectionHeaderLayout {
|
||||
|
||||
private static let labelMarginRight = CGFloat(integerLiteral: 8)
|
||||
private static let unreadCountMarginRight = CGFloat(integerLiteral: 16)
|
||||
private static let unreadCountMarginRight = CGFloat(integerLiteral: 0)
|
||||
private static let disclosureButtonSize = CGSize(width: 44, height: 44)
|
||||
private static let verticalPadding = CGFloat(integerLiteral: 11)
|
||||
|
||||
@@ -31,7 +31,7 @@ struct MasterFeedTableViewSectionHeaderLayout {
|
||||
// Disclosure Button
|
||||
var rDisclosure = CGRect.zero
|
||||
rDisclosure.size = MasterFeedTableViewSectionHeaderLayout.disclosureButtonSize
|
||||
rDisclosure.origin.x = bounds.origin.x
|
||||
rDisclosure.origin.x = bounds.maxX - rDisclosure.size.width
|
||||
|
||||
// Unread Count
|
||||
let unreadCountSize = unreadCountView.contentSize
|
||||
@@ -40,7 +40,7 @@ struct MasterFeedTableViewSectionHeaderLayout {
|
||||
var rUnread = CGRect.zero
|
||||
if !unreadCountIsHidden {
|
||||
rUnread.size = unreadCountSize
|
||||
rUnread.origin.x = bounds.maxX - (MasterFeedTableViewSectionHeaderLayout.unreadCountMarginRight + unreadCountSize.width)
|
||||
rUnread.origin.x = bounds.maxX - (MasterFeedTableViewSectionHeaderLayout.unreadCountMarginRight + unreadCountSize.width + rDisclosure.size.width)
|
||||
}
|
||||
|
||||
// Max Unread Count
|
||||
@@ -50,7 +50,7 @@ struct MasterFeedTableViewSectionHeaderLayout {
|
||||
let maxUnreadCountSize = maxUnreadCountView.contentSize
|
||||
|
||||
// Title
|
||||
let rLabelx = insets.left + MasterFeedTableViewSectionHeaderLayout.disclosureButtonSize.width
|
||||
let rLabelx = 15.0
|
||||
let rLabely = UIFontMetrics.default.scaledValue(for: MasterFeedTableViewSectionHeaderLayout.verticalPadding)
|
||||
|
||||
var labelWidth = CGFloat.zero
|
||||
|
||||
@@ -99,13 +99,7 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner {
|
||||
return
|
||||
}
|
||||
|
||||
if let account = unreadCountProvider as? Account {
|
||||
if let node = coordinator.rootNode.childNodeRepresentingObject(account) {
|
||||
let sectionIndex = coordinator.rootNode.indexOfChild(node)!
|
||||
if let headerView = tableView.headerView(forSection: sectionIndex) as? MasterFeedTableViewSectionHeader {
|
||||
headerView.unreadCount = account.unreadCount
|
||||
}
|
||||
}
|
||||
if let _ = unreadCountProvider as? Account {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -203,11 +197,7 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner {
|
||||
return headerView
|
||||
}
|
||||
|
||||
if let account = sectionNode.representedObject as? Account {
|
||||
headerView.unreadCount = account.unreadCount
|
||||
} else {
|
||||
headerView.unreadCount = 0
|
||||
}
|
||||
|
||||
|
||||
headerView.tag = section
|
||||
headerView.disclosureExpanded = coordinator.isExpanded(sectionNode)
|
||||
@@ -739,7 +729,7 @@ private extension MasterFeedViewController {
|
||||
let unreadCountView = MasterFeedUnreadCountView()
|
||||
unreadCountView.unreadCount = 10
|
||||
|
||||
let layout = MasterFeedTableViewCellLayout(cellWidth: tableView.bounds.size.width, insets: tableView.safeAreaInsets, label: titleLabel, unreadCountView: unreadCountView, showingEditingControl: false, indent: false, shouldShowDisclosure: false)
|
||||
let layout = MasterFeedTableViewCellLayout(cellWidth: tableView.bounds.size.width, insets: tableView.safeAreaInsets, label: titleLabel, unreadCountView: unreadCountView, showingEditingControl: false, indent: false, shouldShowDisclosure: false, itemIsInFolder: false)
|
||||
tableView.estimatedRowHeight = layout.height
|
||||
}
|
||||
|
||||
@@ -763,6 +753,16 @@ private extension MasterFeedViewController {
|
||||
if let feed = node.representedObject as? Feed {
|
||||
cell.name = feed.nameForDisplay
|
||||
cell.unreadCount = feed.unreadCount
|
||||
cell.itemIsInFolder = false
|
||||
if let account = feed.account, let folders = account.folders {
|
||||
for folder in folders {
|
||||
if folder.objectIsChild(node.representedObject) {
|
||||
cell.itemIsInFolder = true
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
configureIcon(cell, indexPath)
|
||||
|
||||
@@ -46,20 +46,26 @@ private extension InteractiveNavigationController {
|
||||
func configure() {
|
||||
isToolbarHidden = false
|
||||
|
||||
let navigationStandardAppearance = UINavigationBarAppearance()
|
||||
navigationStandardAppearance.titleTextAttributes = [.foregroundColor: UIColor.label]
|
||||
navigationStandardAppearance.largeTitleTextAttributes = [.foregroundColor: UIColor.label]
|
||||
navigationBar.standardAppearance = navigationStandardAppearance
|
||||
// Standard appearance with system background
|
||||
let standardAppearance = UINavigationBarAppearance()
|
||||
standardAppearance.backgroundColor = .clear
|
||||
standardAppearance.shadowColor = nil
|
||||
|
||||
let scrollEdgeStandardAppearance = UINavigationBarAppearance()
|
||||
scrollEdgeStandardAppearance.backgroundColor = .systemBackground
|
||||
navigationBar.scrollEdgeAppearance = scrollEdgeStandardAppearance
|
||||
let scrollEdgeAppearance = UINavigationBarAppearance()
|
||||
scrollEdgeAppearance.backgroundColor = .systemBackground
|
||||
scrollEdgeAppearance.shadowColor = nil
|
||||
|
||||
navigationBar.standardAppearance = standardAppearance
|
||||
navigationBar.scrollEdgeAppearance = scrollEdgeAppearance
|
||||
navigationBar.compactAppearance = standardAppearance
|
||||
navigationBar.compactScrollEdgeAppearance = scrollEdgeAppearance
|
||||
|
||||
navigationBar.tintColor = AppAssets.primaryAccentColor
|
||||
|
||||
let toolbarAppearance = UIToolbarAppearance()
|
||||
toolbarAppearance.shadowColor = nil
|
||||
toolbar.standardAppearance = toolbarAppearance
|
||||
toolbar.compactAppearance = toolbarAppearance
|
||||
toolbar.compactAppearance = nil
|
||||
toolbar.scrollEdgeAppearance = nil
|
||||
toolbar.tintColor = AppAssets.primaryAccentColor
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user