Continue to fix build errors.

This commit is contained in:
Brent Simmons 2017-09-17 16:30:45 -07:00
parent 6631a9c2f8
commit 0336e30b0d
7 changed files with 30 additions and 17 deletions

View File

@ -43,8 +43,21 @@ private func accountAndArticlesDictionary(_ articles: Set<Article>) -> [String:
extension Article {
func preferredLink() -> String? {
var status: ArticleStatus? {
get {
return account?.articleStatus(for: self)
}
}
return url ?? externalURL
var preferredLink: String? {
get {
return url ?? externalURL
}
}
var body: String? {
get {
return contentHTML ?? contentText ?? summary
}
}
}

View File

@ -138,8 +138,7 @@ class ArticleRenderer {
private func titleOrTitleLink() -> String {
let link = preferredLink(for: article)
if let link = link {
if let link = article.preferredLink {
return linkWithText(title, link)
}
return title

View File

@ -24,7 +24,7 @@ class MainWindowController : NSWindowController, NSUserInterfaceValidations {
detailSplitViewItem?.minimumThickness = 384
NotificationCenter.default.addObserver(self, selector: #selector(applicationWillTerminate(_:)), name: .NSApplicationWillTerminate, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(applicationWillTerminate(_:)), name: NSApplication.willTerminateNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(appNavigationKeyPressed(_:)), name: .AppNavigationKeyPressed, object: nil)
@ -174,7 +174,7 @@ private extension MainWindowController {
var currentLink: String? {
get {
if let article = oneSelectedArticle {
return preferredLink(for: article)
return article.preferredLink
}
return nil
}

View File

@ -91,8 +91,7 @@ private extension StatusBarView {
return
}
let s = article.preferredLink()
if let s = s {
if let s = article.preferredLink {
urlLabel.stringValue = (s as NSString).rs_stringByStrippingHTTPOrHTTPSScheme()
}
else {

View File

@ -103,16 +103,16 @@ private func attributedTitleString(_ title: String, _ text: String, _ appearance
if !title.isEmpty && !text.isEmpty {
let titleMutable = NSMutableAttributedString(string: title, attributes: [NSForegroundColorAttributeName: appearance.titleColor, NSFontAttributeName: appearance.titleFont])
let attributedText = NSAttributedString(string: "\n" + text, attributes: [NSForegroundColorAttributeName: appearance.textColor, NSFontAttributeName: appearance.textFont])
let titleMutable = NSMutableAttributedString(string: title, attributes: [NSAttributedStringKey.foregroundColor: appearance.titleColor, NSAttributedStringKey.font: appearance.titleFont])
let attributedText = NSAttributedString(string: "\n" + text, attributes: [NSAttributedStringKey.foregroundColor: appearance.textColor, NSAttributedStringKey.font: appearance.textFont])
titleMutable.append(attributedText)
return titleMutable
}
if !title.isEmpty && text.isEmpty {
return NSAttributedString(string: title, attributes: [NSForegroundColorAttributeName: appearance.titleColor, NSFontAttributeName: appearance.titleFont])
return NSAttributedString(string: title, attributes: [NSAttributedStringKey.foregroundColor: appearance.titleColor, NSAttributedStringKey.font: appearance.titleFont])
}
return NSAttributedString(string: text, attributes: [NSForegroundColorAttributeName: appearance.textColor, NSFontAttributeName: appearance.textFont])
return NSAttributedString(string: text, attributes: [NSAttributedStringKey.foregroundColor: appearance.textColor, NSAttributedStringKey.font: appearance.textFont])
}

View File

@ -135,10 +135,7 @@ class TimelineViewController: NSViewController, NSTableViewDelegate, NSTableView
@objc func openArticleInBrowser(_ sender: AnyObject) {
guard let article = oneSelectedArticle else {
return
}
if let link = preferredLink(for: article) {
if let link = oneSelectedArticle?.preferredLink {
openInBrowser(link)
}
}

View File

@ -70,6 +70,11 @@ public final class Account: DisplayNameProvider, Hashable {
// TODO
}
public func articleStatus(for article: Article) -> ArticleStatus? {
// TODO
}
public func ensureFolder(with name: String) -> Folder? {
return nil //TODO