diff --git a/Evergreen/MainWindow/Timeline/Cell/TimelineCellData.swift b/Evergreen/MainWindow/Timeline/Cell/TimelineCellData.swift index 0ea06ea66..42517ae43 100644 --- a/Evergreen/MainWindow/Timeline/Cell/TimelineCellData.swift +++ b/Evergreen/MainWindow/Timeline/Cell/TimelineCellData.swift @@ -66,7 +66,12 @@ struct TimelineCellData { self.showFeedName = showFeedName self.favicon = nil - self.read = article.read + if let status = article.status { + self.read = status.read + } + else { + self.read = false + } } init() { //Empty diff --git a/Evergreen/MainWindow/Timeline/TimelineViewController.swift b/Evergreen/MainWindow/Timeline/TimelineViewController.swift index 8c4d5bcc3..c8c30258e 100644 --- a/Evergreen/MainWindow/Timeline/TimelineViewController.swift +++ b/Evergreen/MainWindow/Timeline/TimelineViewController.swift @@ -414,7 +414,7 @@ class TimelineViewController: NSViewController, NSTableViewDelegate, NSTableView var fetchedArticles = [Article]() for (accountID, objects) in accountsDictionary { - guard let oneAccount = AccountManager.sharedInstance.existingAccountWithIdentifier(accountID) else { + guard let oneAccount = account(with: accountID) else { continue } @@ -437,11 +437,8 @@ class TimelineViewController: NSViewController, NSTableViewDelegate, NSTableView private func calculateRowHeight() -> CGFloat { - let prototypeArticle = LocalArticle(account: AccountManager.sharedInstance.localAccount, feedID: "prototype", articleID: "prototype") - prototypeArticle.title = "But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?" - - let prototypeArticleStatus = LocalArticleStatus(articleID: "prototype", read: false, starred: false, userDeleted: false, dateArrived: Date()) - prototypeArticle.status = prototypeArticleStatus + let longTitle = "But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?" + let prototypeArticle = Article(accountID: "prototype", articleID: "prototype", feedID: "prototype", uniqueID: "prototype", title: longTitle, contentHTML: nil, contentText: nil, url: nil, externalURL: nil, summary: nil, imageURL: nil, bannerImageURL: nil, datePublished: nil, dateModified: nil, authors: nil, tags: nil, attachments: nil, accountInfo: nil) let prototypeCellData = TimelineCellData(article: prototypeArticle, appearance: cellAppearance, showFeedName: false) let height = timelineCellHeight(100, cellData: prototypeCellData, appearance: cellAppearance) diff --git a/Frameworks/Account/AccountManager.swift b/Frameworks/Account/AccountManager.swift index a29397aac..8916bed12 100644 --- a/Frameworks/Account/AccountManager.swift +++ b/Frameworks/Account/AccountManager.swift @@ -75,7 +75,7 @@ public final class AccountManager: UnreadCountProvider { // MARK: API - public func existingAccountWithID(_ accountID: String) -> Account? { + public func existingAccount(with accountID: String) -> Account? { return accountsDictionary[accountID] } @@ -191,10 +191,10 @@ private func accountFilePathWithFolder(_ folderPath: String) -> String { return NSString(string: folderPath).appendingPathComponent(accountDataFileName) } -public func accountWithID(_ accountID: String) -> Account? { +public func account(with accountID: String) -> Account? { // Shortcut. - return AccountManager.sharedInstance.existingAccountWithID(accountID) + return AccountManager.sharedInstance.existingAccount(with: accountID) } private struct AccountSpecifier { diff --git a/Frameworks/Account/Extensions/Article+Account.swift b/Frameworks/Account/Extensions/Article+Account.swift index 796ad7dc4..4901607d7 100644 --- a/Frameworks/Account/Extensions/Article+Account.swift +++ b/Frameworks/Account/Extensions/Article+Account.swift @@ -13,7 +13,7 @@ public extension Article { var account: Account? { get { - return accountWithID(accountID) + return account(with: accountID) } } } diff --git a/Frameworks/Account/Extensions/Feed+Account.swift b/Frameworks/Account/Extensions/Feed+Account.swift index 3f032fecc..b9cf8a24b 100644 --- a/Frameworks/Account/Extensions/Feed+Account.swift +++ b/Frameworks/Account/Extensions/Feed+Account.swift @@ -13,7 +13,7 @@ public extension Feed { var account: Account? { get { - return accountWithID(accountID) + return account(with: accountID) } } } diff --git a/Frameworks/Account/Folder.swift b/Frameworks/Account/Folder.swift index d34c98597..c783fa541 100644 --- a/Frameworks/Account/Folder.swift +++ b/Frameworks/Account/Folder.swift @@ -16,7 +16,7 @@ public final class Folder: DisplayNameProvider, UnreadCountProvider { public var account: Account? { get { - return accountWithID(accountID) + return account(with: accountID) } }