Continue to fix build errors.
This commit is contained in:
parent
6631a9c2f8
commit
0336e30b0d
@ -43,8 +43,21 @@ private func accountAndArticlesDictionary(_ articles: Set<Article>) -> [String:
|
|||||||
|
|
||||||
extension Article {
|
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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -138,8 +138,7 @@ class ArticleRenderer {
|
|||||||
|
|
||||||
private func titleOrTitleLink() -> String {
|
private func titleOrTitleLink() -> String {
|
||||||
|
|
||||||
let link = preferredLink(for: article)
|
if let link = article.preferredLink {
|
||||||
if let link = link {
|
|
||||||
return linkWithText(title, link)
|
return linkWithText(title, link)
|
||||||
}
|
}
|
||||||
return title
|
return title
|
||||||
|
@ -24,7 +24,7 @@ class MainWindowController : NSWindowController, NSUserInterfaceValidations {
|
|||||||
|
|
||||||
detailSplitViewItem?.minimumThickness = 384
|
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)
|
NotificationCenter.default.addObserver(self, selector: #selector(appNavigationKeyPressed(_:)), name: .AppNavigationKeyPressed, object: nil)
|
||||||
|
|
||||||
@ -174,7 +174,7 @@ private extension MainWindowController {
|
|||||||
var currentLink: String? {
|
var currentLink: String? {
|
||||||
get {
|
get {
|
||||||
if let article = oneSelectedArticle {
|
if let article = oneSelectedArticle {
|
||||||
return preferredLink(for: article)
|
return article.preferredLink
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -91,8 +91,7 @@ private extension StatusBarView {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
let s = article.preferredLink()
|
if let s = article.preferredLink {
|
||||||
if let s = s {
|
|
||||||
urlLabel.stringValue = (s as NSString).rs_stringByStrippingHTTPOrHTTPSScheme()
|
urlLabel.stringValue = (s as NSString).rs_stringByStrippingHTTPOrHTTPSScheme()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -103,16 +103,16 @@ private func attributedTitleString(_ title: String, _ text: String, _ appearance
|
|||||||
|
|
||||||
if !title.isEmpty && !text.isEmpty {
|
if !title.isEmpty && !text.isEmpty {
|
||||||
|
|
||||||
let titleMutable = NSMutableAttributedString(string: title, attributes: [NSForegroundColorAttributeName: appearance.titleColor, NSFontAttributeName: appearance.titleFont])
|
let titleMutable = NSMutableAttributedString(string: title, attributes: [NSAttributedStringKey.foregroundColor: appearance.titleColor, NSAttributedStringKey.font: appearance.titleFont])
|
||||||
let attributedText = NSAttributedString(string: "\n" + text, attributes: [NSForegroundColorAttributeName: appearance.textColor, NSFontAttributeName: appearance.textFont])
|
let attributedText = NSAttributedString(string: "\n" + text, attributes: [NSAttributedStringKey.foregroundColor: appearance.textColor, NSAttributedStringKey.font: appearance.textFont])
|
||||||
titleMutable.append(attributedText)
|
titleMutable.append(attributedText)
|
||||||
return titleMutable
|
return titleMutable
|
||||||
}
|
}
|
||||||
|
|
||||||
if !title.isEmpty && text.isEmpty {
|
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])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,10 +135,7 @@ class TimelineViewController: NSViewController, NSTableViewDelegate, NSTableView
|
|||||||
|
|
||||||
@objc func openArticleInBrowser(_ sender: AnyObject) {
|
@objc func openArticleInBrowser(_ sender: AnyObject) {
|
||||||
|
|
||||||
guard let article = oneSelectedArticle else {
|
if let link = oneSelectedArticle?.preferredLink {
|
||||||
return
|
|
||||||
}
|
|
||||||
if let link = preferredLink(for: article) {
|
|
||||||
openInBrowser(link)
|
openInBrowser(link)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,6 +70,11 @@ public final class Account: DisplayNameProvider, Hashable {
|
|||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public func articleStatus(for article: Article) -> ArticleStatus? {
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
public func ensureFolder(with name: String) -> Folder? {
|
public func ensureFolder(with name: String) -> Folder? {
|
||||||
|
|
||||||
return nil //TODO
|
return nil //TODO
|
||||||
|
Loading…
x
Reference in New Issue
Block a user