mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2026-12-01 09:50:16 +00:00
Share the summary fallback between the standard and column timeline cells.
This commit is contained in:
1 parent
1351724e92
commit
692efe5e69
2 files changed
+12
-13
No files matched your search
@@ -12,7 +12,7 @@ import Images
|
||||
|
||||
@MainActor struct TimelineCellData {
|
||||
|
||||
static let noText = NSLocalizedString("(No Text)", comment: "No Text")
|
||||
private static let noText = NSLocalizedString("(No Text)", comment: "No Text")
|
||||
|
||||
let title: String
|
||||
let attributedTitle: NSAttributedString
|
||||
@@ -30,13 +30,7 @@ import Images
|
||||
|
||||
self.title = ArticleStringFormatter.shared.truncatedTitle(article)
|
||||
self.attributedTitle = ArticleStringFormatter.shared.attributedTruncatedTitle(article)
|
||||
|
||||
let truncatedSummary = ArticleStringFormatter.shared.truncatedSummary(article)
|
||||
if self.title.isEmpty && truncatedSummary.isEmpty {
|
||||
self.text = Self.noText
|
||||
} else {
|
||||
self.text = truncatedSummary
|
||||
}
|
||||
self.text = Self.summaryText(for: article, title: self.title)
|
||||
|
||||
self.dateString = ArticleStringFormatter.shared.dateString(article.logicalDatePublished)
|
||||
|
||||
@@ -61,6 +55,15 @@ import Images
|
||||
self.starred = article.status.starred
|
||||
}
|
||||
|
||||
/// The article’s summary, or “(No Text)” when it has neither a title nor a summary.
|
||||
static func summaryText(for article: Article, title: String) -> String {
|
||||
let truncatedSummary = ArticleStringFormatter.shared.truncatedSummary(article)
|
||||
if title.isEmpty && truncatedSummary.isEmpty {
|
||||
return noText
|
||||
}
|
||||
return truncatedSummary
|
||||
}
|
||||
|
||||
init() { // Empty
|
||||
self.title = ""
|
||||
self.text = ""
|
||||
|
||||
@@ -162,11 +162,7 @@ private extension TimelineViewController {
|
||||
if !title.isEmpty {
|
||||
return title
|
||||
}
|
||||
let summary = ArticleStringFormatter.shared.truncatedSummary(article).collapsingWhitespace
|
||||
if !summary.isEmpty {
|
||||
return summary
|
||||
}
|
||||
return TimelineCellData.noText
|
||||
return TimelineCellData.summaryText(for: article, title: title).collapsingWhitespace
|
||||
}
|
||||
|
||||
func removeAllTableColumns() {
|
||||
|
||||
Reference in new issue
Block a user