Renamed TimelineStringFormatter to ArticleStringFormatter now that it is used for much more than the timelines

This commit is contained in:
Maurice Parker 2019-10-20 02:28:00 -05:00
parent cab2c1f26a
commit 00f100e3a3
7 changed files with 21 additions and 21 deletions

View File

@ -255,7 +255,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations,
func applicationDidResignActive(_ notification: Notification) {
TimelineStringFormatter.emptyCaches()
ArticleStringFormatter.emptyCaches()
saveState()
}
@ -649,4 +649,4 @@ extension AppDelegate : ScriptingAppDelegate {
internal var scriptingSelectedArticles: [Article] {
return self.scriptingMainWindowController?.scriptingSelectedArticles ?? []
}
}
}

View File

@ -24,13 +24,13 @@ struct TimelineCellData {
init(article: Article, showFeedName: Bool, feedName: String?, avatar: NSImage?, showAvatar: Bool, featuredImage: NSImage?) {
self.title = TimelineStringFormatter.truncatedTitle(article)
self.text = TimelineStringFormatter.truncatedSummary(article)
self.title = ArticleStringFormatter.truncatedTitle(article)
self.text = ArticleStringFormatter.truncatedSummary(article)
self.dateString = TimelineStringFormatter.dateString(article.logicalDatePublished)
self.dateString = ArticleStringFormatter.dateString(article.logicalDatePublished)
if let feedName = feedName {
self.feedName = TimelineStringFormatter.truncatedFeedName(feedName)
self.feedName = ArticleStringFormatter.truncatedFeedName(feedName)
}
else {
self.feedName = ""

View File

@ -189,7 +189,7 @@
51C452A922650DC600C03939 /* ArticleRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 849A977D1ED9EC42007D329B /* ArticleRenderer.swift */; };
51C452AB22650DC600C03939 /* template.html in Resources */ = {isa = PBXBuildFile; fileRef = 848362FE2262A30E00DA1D35 /* template.html */; };
51C452AC22650FD200C03939 /* AppNotifications.swift in Sources */ = {isa = PBXBuildFile; fileRef = 842E45CD1ED8C308000A8B52 /* AppNotifications.swift */; };
51C452AE2265104D00C03939 /* TimelineStringFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 849A97731ED9EC04007D329B /* TimelineStringFormatter.swift */; };
51C452AE2265104D00C03939 /* ArticleStringFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 849A97731ED9EC04007D329B /* ArticleStringFormatter.swift */; };
51C452AF2265108300C03939 /* ArticleArray.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84F204DF1FAACBB30076E152 /* ArticleArray.swift */; };
51C452B42265141B00C03939 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 51C452B32265141B00C03939 /* WebKit.framework */; };
51C452B82265178500C03939 /* styleSheet.css in Resources */ = {isa = PBXBuildFile; fileRef = 51C452B72265178500C03939 /* styleSheet.css */; };
@ -308,7 +308,7 @@
849A97761ED9EC04007D329B /* TimelineCellAppearance.swift in Sources */ = {isa = PBXBuildFile; fileRef = 849A97701ED9EC04007D329B /* TimelineCellAppearance.swift */; };
849A97771ED9EC04007D329B /* TimelineCellData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 849A97711ED9EC04007D329B /* TimelineCellData.swift */; };
849A97781ED9EC04007D329B /* TimelineCellLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 849A97721ED9EC04007D329B /* TimelineCellLayout.swift */; };
849A97791ED9EC04007D329B /* TimelineStringFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 849A97731ED9EC04007D329B /* TimelineStringFormatter.swift */; };
849A97791ED9EC04007D329B /* ArticleStringFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 849A97731ED9EC04007D329B /* ArticleStringFormatter.swift */; };
849A977A1ED9EC04007D329B /* TimelineTableCellView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 849A97741ED9EC04007D329B /* TimelineTableCellView.swift */; };
849A977B1ED9EC04007D329B /* UnreadIndicatorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 849A97751ED9EC04007D329B /* UnreadIndicatorView.swift */; };
849A977F1ED9EC42007D329B /* ArticleRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 849A977D1ED9EC42007D329B /* ArticleRenderer.swift */; };
@ -952,7 +952,7 @@
849A97701ED9EC04007D329B /* TimelineCellAppearance.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TimelineCellAppearance.swift; sourceTree = "<group>"; };
849A97711ED9EC04007D329B /* TimelineCellData.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TimelineCellData.swift; sourceTree = "<group>"; };
849A97721ED9EC04007D329B /* TimelineCellLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TimelineCellLayout.swift; sourceTree = "<group>"; };
849A97731ED9EC04007D329B /* TimelineStringFormatter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TimelineStringFormatter.swift; sourceTree = "<group>"; };
849A97731ED9EC04007D329B /* ArticleStringFormatter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArticleStringFormatter.swift; sourceTree = "<group>"; };
849A97741ED9EC04007D329B /* TimelineTableCellView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TimelineTableCellView.swift; sourceTree = "<group>"; };
849A97751ED9EC04007D329B /* UnreadIndicatorView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UnreadIndicatorView.swift; sourceTree = "<group>"; };
849A977D1ED9EC42007D329B /* ArticleRenderer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArticleRenderer.swift; sourceTree = "<group>"; };
@ -1463,7 +1463,6 @@
FF3ABF1423259DDB0074C542 /* ArticleSorter.swift */,
84CAFCAE22BC8C35007694F0 /* FetchRequestOperation.swift */,
84CAFCA322BC8C08007694F0 /* FetchRequestQueue.swift */,
849A97731ED9EC04007D329B /* TimelineStringFormatter.swift */,
);
path = Timeline;
sourceTree = "<group>";
@ -1684,6 +1683,7 @@
849A97561ED9EB0D007D329B /* Data */ = {
isa = PBXGroup;
children = (
849A97731ED9EC04007D329B /* ArticleStringFormatter.swift */,
849A97581ED9EB0D007D329B /* ArticleUtilities.swift */,
84411E701FE5FBFA004B527F /* SmallIconProvider.swift */,
);
@ -2973,7 +2973,7 @@
51C4527F2265092C00C03939 /* ArticleViewController.swift in Sources */,
51C4526A226508F600C03939 /* MasterFeedTableViewCellLayout.swift in Sources */,
51E149C2234D852F0004F7A5 /* ShowHidePasswordView.swift in Sources */,
51C452AE2265104D00C03939 /* TimelineStringFormatter.swift in Sources */,
51C452AE2265104D00C03939 /* ArticleStringFormatter.swift in Sources */,
512E08E62268800D00BDCFDD /* FolderTreeControllerDelegate.swift in Sources */,
51C4529922650A0000C03939 /* ArticleStylesManager.swift in Sources */,
5123DB9F233EC6FD00282CC9 /* FeedInspectorView.swift in Sources */,
@ -3093,7 +3093,7 @@
519B8D332143397200FA689C /* SharingServiceDelegate.swift in Sources */,
FF3ABF1523259DDB0074C542 /* ArticleSorter.swift in Sources */,
84E8E0DB202EC49300562D8F /* TimelineViewController+ContextualMenus.swift in Sources */,
849A97791ED9EC04007D329B /* TimelineStringFormatter.swift in Sources */,
849A97791ED9EC04007D329B /* ArticleStringFormatter.swift in Sources */,
84E185C3203BB12600F69BFA /* MultilineTextFieldSizer.swift in Sources */,
8477ACBE22238E9500DF7F37 /* SearchFeedDelegate.swift in Sources */,
51E3EB33229AB02C00645299 /* ErrorHandler.swift in Sources */,

View File

@ -1,5 +1,5 @@
//
// TimelineStringFormatter.swift
// ArticleStringFormatter.swift
// NetNewsWire
//
// Created by Brent Simmons on 8/31/15.
@ -10,7 +10,7 @@ import Foundation
import Articles
import RSParser
struct TimelineStringFormatter {
struct ArticleStringFormatter {
private static var feedNameCache = [String: String]()
private static var titleCache = [String: String]()

View File

@ -47,9 +47,9 @@ private extension UserNotificationManager {
let content = UNMutableNotificationContent()
content.title = feed.nameForDisplay
content.body = TimelineStringFormatter.truncatedTitle(article)
content.body = ArticleStringFormatter.truncatedTitle(article)
if content.body.isEmpty {
content.body = TimelineStringFormatter.truncatedSummary(article)
content.body = ArticleStringFormatter.truncatedSummary(article)
}
content.sound = UNNotificationSound.default

View File

@ -25,13 +25,13 @@ struct MasterTimelineCellData {
init(article: Article, showFeedName: Bool, feedName: String?, avatar: UIImage?, showAvatar: Bool, featuredImage: UIImage?, numberOfLines: Int) {
self.title = TimelineStringFormatter.truncatedTitle(article)
self.summary = TimelineStringFormatter.truncatedSummary(article)
self.title = ArticleStringFormatter.truncatedTitle(article)
self.summary = ArticleStringFormatter.truncatedSummary(article)
self.dateString = TimelineStringFormatter.dateString(article.logicalDatePublished)
self.dateString = ArticleStringFormatter.dateString(article.logicalDatePublished)
if let feedName = feedName {
self.feedName = TimelineStringFormatter.truncatedFeedName(feedName)
self.feedName = ArticleStringFormatter.truncatedFeedName(feedName)
}
else {
self.feedName = ""

View File

@ -52,7 +52,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
}
func sceneDidEnterBackground(_ scene: UIScene) {
TimelineStringFormatter.emptyCaches()
ArticleStringFormatter.emptyCaches()
appDelegate.prepareAccountsForBackground()
}