mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2026-12-03 02:42:54 +00:00
Clean whitespace-only lines.
This commit is contained in:
1 parent
9827300a9a
commit
9efde554d4
452 files changed
+5354
-5354
No files matched your search
@@ -12,7 +12,7 @@ import Articles
|
||||
struct MainTimelineCellData {
|
||||
|
||||
private static let noText = NSLocalizedString("(No Text)", comment: "No Text")
|
||||
|
||||
|
||||
let title: String
|
||||
let attributedTitle: NSAttributedString
|
||||
let summary: String
|
||||
@@ -38,7 +38,7 @@ struct MainTimelineCellData {
|
||||
} else {
|
||||
self.summary = truncatedSummary
|
||||
}
|
||||
|
||||
|
||||
self.dateString = ArticleStringFormatter.dateString(article.logicalDatePublished)
|
||||
|
||||
if let feedName = feedName {
|
||||
@@ -47,7 +47,7 @@ struct MainTimelineCellData {
|
||||
else {
|
||||
self.feedName = ""
|
||||
}
|
||||
|
||||
|
||||
if let byline = byline {
|
||||
self.byline = byline
|
||||
} else {
|
||||
@@ -63,7 +63,7 @@ struct MainTimelineCellData {
|
||||
self.starred = article.status.starred
|
||||
self.numberOfLines = numberOfLines
|
||||
self.iconSize = iconSize
|
||||
|
||||
|
||||
}
|
||||
|
||||
init() { //Empty
|
||||
@@ -81,5 +81,5 @@ struct MainTimelineCellData {
|
||||
self.numberOfLines = 0
|
||||
self.iconSize = .medium
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -21,15 +21,15 @@ class MainTimelineFeedCell: UITableViewCell {
|
||||
configure(cellData)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var isPreview: Bool = false
|
||||
|
||||
|
||||
override func awakeFromNib() {
|
||||
super.awakeFromNib()
|
||||
indicatorView.alpha = 0.0
|
||||
configureStackView()
|
||||
}
|
||||
|
||||
|
||||
private func configureStackView() {
|
||||
switch traitCollection.preferredContentSizeCategory {
|
||||
case .accessibilityMedium, .accessibilityLarge, .accessibilityExtraLarge, .accessibilityExtraExtraLarge, .accessibilityExtraExtraExtraLarge:
|
||||
@@ -42,11 +42,11 @@ class MainTimelineFeedCell: UITableViewCell {
|
||||
metaDataStackView.distribution = .fill
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private func configure(_ cellData: MainTimelineCellData) {
|
||||
updateIndicatorView(cellData)
|
||||
articleTitle.numberOfLines = cellData.numberOfLines
|
||||
|
||||
|
||||
applyTitleTextWithAttributes(configurationState)
|
||||
|
||||
if cellData.showFeedName == .feed {
|
||||
@@ -56,10 +56,10 @@ class MainTimelineFeedCell: UITableViewCell {
|
||||
} else if cellData.showFeedName == .none {
|
||||
authorByLine.text = ""
|
||||
}
|
||||
|
||||
|
||||
articleDate.text = cellData.dateString
|
||||
}
|
||||
|
||||
|
||||
private func updateIndicatorView(_ cellData: MainTimelineCellData) {
|
||||
if cellData.read == false {
|
||||
if indicatorView.alpha == 0.0 {
|
||||
@@ -86,7 +86,7 @@ class MainTimelineFeedCell: UITableViewCell {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private func applyTitleTextWithAttributes(_ state: UICellConfigurationState) {
|
||||
let attributedCellText = NSMutableAttributedString()
|
||||
let isSelected = state.isSelected || state.isHighlighted || state.isFocused || state.isSwiped
|
||||
@@ -119,17 +119,17 @@ class MainTimelineFeedCell: UITableViewCell {
|
||||
}
|
||||
articleTitle.attributedText = attributedCellText
|
||||
}
|
||||
|
||||
|
||||
override func updateConfiguration(using state: UICellConfigurationState) {
|
||||
super.updateConfiguration(using: state)
|
||||
|
||||
|
||||
var backgroundConfig = UIBackgroundConfiguration.listCell().updated(for: state)
|
||||
backgroundConfig.cornerRadius = 20
|
||||
if traitCollection.userInterfaceIdiom == .pad {
|
||||
backgroundConfig.edgesAddingLayoutMarginsToBackgroundInsets = [.leading, .trailing]
|
||||
backgroundConfig.backgroundInsets = NSDirectionalEdgeInsets(top: 0, leading: !isPreview ? -4 : -12, bottom: 0, trailing: !isPreview ? -4 : -12)
|
||||
}
|
||||
|
||||
|
||||
if state.isSelected || state.isHighlighted || state.isFocused || state.isSwiped {
|
||||
backgroundConfig.backgroundColor = AppAssets.primaryAccentColor
|
||||
applyTitleTextWithAttributes(state)
|
||||
@@ -140,9 +140,9 @@ class MainTimelineFeedCell: UITableViewCell {
|
||||
articleDate.textColor = .secondaryLabel
|
||||
authorByLine.textColor = .secondaryLabel
|
||||
}
|
||||
|
||||
|
||||
self.backgroundConfiguration = backgroundConfig
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -9,29 +9,29 @@
|
||||
import UIKit
|
||||
|
||||
class MainTimelineIconFeedCell: UITableViewCell {
|
||||
|
||||
|
||||
@IBOutlet weak var articleTitle: UILabel!
|
||||
@IBOutlet weak var authorByLine: UILabel!
|
||||
@IBOutlet weak var iconView: IconView!
|
||||
@IBOutlet weak var indicatorView: IconView!
|
||||
@IBOutlet weak var articleDate: UILabel!
|
||||
@IBOutlet weak var metaDataStackView: UIStackView!
|
||||
|
||||
|
||||
var cellData: MainTimelineCellData! {
|
||||
didSet {
|
||||
configure(cellData)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var isPreview: Bool = false
|
||||
|
||||
|
||||
override func awakeFromNib() {
|
||||
super.awakeFromNib()
|
||||
indicatorView.alpha = 0.0
|
||||
iconView.translatesAutoresizingMaskIntoConstraints = false
|
||||
configureStackView()
|
||||
}
|
||||
|
||||
|
||||
private func configureStackView() {
|
||||
switch traitCollection.preferredContentSizeCategory {
|
||||
case .accessibilityMedium, .accessibilityLarge, .accessibilityExtraLarge, .accessibilityExtraExtraLarge, .accessibilityExtraExtraExtraLarge:
|
||||
@@ -44,13 +44,13 @@ class MainTimelineIconFeedCell: UITableViewCell {
|
||||
metaDataStackView.distribution = .fill
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private func configure(_ cellData: MainTimelineCellData) {
|
||||
updateIndicatorView(cellData)
|
||||
articleTitle.numberOfLines = cellData.numberOfLines
|
||||
applyTitleTextWithAttributes(configurationState)
|
||||
|
||||
|
||||
if cellData.showFeedName == .feed {
|
||||
authorByLine.text = cellData.feedName
|
||||
} else if cellData.showFeedName == .byline {
|
||||
@@ -58,34 +58,34 @@ class MainTimelineIconFeedCell: UITableViewCell {
|
||||
} else if cellData.showFeedName == .none {
|
||||
authorByLine.text = ""
|
||||
}
|
||||
|
||||
|
||||
setIconImage(cellData.iconImage, with: cellData.iconSize)
|
||||
|
||||
|
||||
articleDate.text = cellData.dateString
|
||||
}
|
||||
|
||||
|
||||
private func setIconImage(_ iconImage: IconImage?, with size: IconSize) {
|
||||
iconView.iconImage = iconImage
|
||||
updateIconViewSizeConstraints(to: size.size)
|
||||
}
|
||||
|
||||
|
||||
func setIconImage(_ iconImage: IconImage?) {
|
||||
iconView.iconImage = iconImage
|
||||
}
|
||||
|
||||
|
||||
private func updateIconViewSizeConstraints(to size: CGSize) {
|
||||
for constraint in iconView.constraints {
|
||||
constraint.isActive = false
|
||||
}
|
||||
|
||||
|
||||
NSLayoutConstraint.activate([
|
||||
iconView.widthAnchor.constraint(equalToConstant: size.width),
|
||||
iconView.heightAnchor.constraint(equalToConstant: size.height)
|
||||
])
|
||||
|
||||
|
||||
setNeedsLayout()
|
||||
}
|
||||
|
||||
|
||||
private func updateIndicatorView(_ cellData: MainTimelineCellData) {
|
||||
if cellData.read == false {
|
||||
if indicatorView.alpha == 0.0 {
|
||||
@@ -112,12 +112,12 @@ class MainTimelineIconFeedCell: UITableViewCell {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private func applyTitleTextWithAttributes(_ state: UICellConfigurationState) {
|
||||
let attributedCellText = NSMutableAttributedString()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
let isSelected = state.isSelected || state.isHighlighted || state.isFocused || state.isSwiped
|
||||
if cellData.title != "" {
|
||||
let paragraphStyle = NSMutableParagraphStyle()
|
||||
@@ -148,17 +148,17 @@ class MainTimelineIconFeedCell: UITableViewCell {
|
||||
}
|
||||
articleTitle.attributedText = attributedCellText
|
||||
}
|
||||
|
||||
|
||||
override func updateConfiguration(using state: UICellConfigurationState) {
|
||||
super.updateConfiguration(using: state)
|
||||
|
||||
|
||||
var backgroundConfig = UIBackgroundConfiguration.listCell().updated(for: state)
|
||||
backgroundConfig.cornerRadius = 20
|
||||
if traitCollection.userInterfaceIdiom == .pad {
|
||||
backgroundConfig.edgesAddingLayoutMarginsToBackgroundInsets = [.leading, .trailing]
|
||||
backgroundConfig.backgroundInsets = NSDirectionalEdgeInsets(top: 0, leading: !isPreview ? -4 : -12, bottom: 0, trailing: !isPreview ? -4 : -12)
|
||||
}
|
||||
|
||||
|
||||
if state.isSelected || state.isHighlighted || state.isFocused || state.isSwiped {
|
||||
backgroundConfig.backgroundColor = AppAssets.primaryAccentColor
|
||||
applyTitleTextWithAttributes(state)
|
||||
@@ -169,9 +169,9 @@ class MainTimelineIconFeedCell: UITableViewCell {
|
||||
articleDate.textColor = .secondaryLabel
|
||||
authorByLine.textColor = .secondaryLabel
|
||||
}
|
||||
|
||||
|
||||
self.backgroundConfiguration = backgroundConfig
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user