Merge branch 'ios-candidate' of https://github.com/Ranchero-Software/NetNewsWire into ios-candidate
This commit is contained in:
commit
f76385ce64
|
@ -1225,7 +1225,7 @@ private extension FeedbinAccountDelegate {
|
|||
|
||||
let parsedItems: [ParsedItem] = entries.map { entry in
|
||||
let authors = Set([ParsedAuthor(name: entry.authorName, url: entry.jsonFeed?.jsonFeedAuthor?.url, avatarURL: entry.jsonFeed?.jsonFeedAuthor?.avatarURL, emailAddress: nil)])
|
||||
return ParsedItem(syncServiceID: String(entry.articleID), uniqueID: String(entry.articleID), feedURL: String(entry.feedID), url: nil, externalURL: entry.url, title: entry.title, contentHTML: entry.contentHTML, contentText: nil, summary: entry.summary, imageURL: nil, bannerImageURL: nil, datePublished: entry.parsedDatePublished, dateModified: nil, authors: authors, tags: nil, attachments: nil)
|
||||
return ParsedItem(syncServiceID: String(entry.articleID), uniqueID: String(entry.articleID), feedURL: String(entry.feedID), url: entry.url, externalURL: nil, title: entry.title, contentHTML: entry.contentHTML, contentText: nil, summary: entry.summary, imageURL: nil, bannerImageURL: nil, datePublished: entry.parsedDatePublished, dateModified: nil, authors: authors, tags: nil, attachments: nil)
|
||||
}
|
||||
|
||||
return Set(parsedItems)
|
||||
|
|
|
@ -157,7 +157,7 @@ private extension ArticleRenderer {
|
|||
let mediumDate = dateString(datePublished, .medium, .short)
|
||||
let shortDate = dateString(datePublished, .short, .short)
|
||||
|
||||
if dateShouldBeLink() || self.title == "", let permalink = article.url {
|
||||
if let permalink = article.url {
|
||||
d["date_long"] = longDate.htmlByAddingLink(permalink)
|
||||
d["date_medium"] = mediumDate.htmlByAddingLink(permalink)
|
||||
d["date_short"] = shortDate.htmlByAddingLink(permalink)
|
||||
|
@ -173,16 +173,6 @@ private extension ArticleRenderer {
|
|||
return d
|
||||
}
|
||||
|
||||
func dateShouldBeLink() -> Bool {
|
||||
guard let permalink = article?.url else {
|
||||
return false
|
||||
}
|
||||
guard let preferredLink = article?.preferredLink else { // Title uses preferredLink
|
||||
return false
|
||||
}
|
||||
return permalink != preferredLink // Make date a link if it’s a different link from the title’s link
|
||||
}
|
||||
|
||||
func byline() -> String {
|
||||
guard let authors = article?.authors ?? article?.webFeed?.authors, !authors.isEmpty else {
|
||||
return ""
|
||||
|
|
|
@ -116,6 +116,10 @@ body > .systemMessage {
|
|||
font-weight: bold;
|
||||
}
|
||||
|
||||
.articleDateline a:link, .articleDateline a:visited {
|
||||
color: var(--article-title-color);
|
||||
}
|
||||
|
||||
.articleBody {
|
||||
line-height: 1.6em;
|
||||
}
|
||||
|
|
|
@ -290,6 +290,7 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
|
|||
}
|
||||
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(unreadCountDidInitialize(_:)), name: .UnreadCountDidInitialize, object: nil)
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(unreadCountDidChange(_:)), name: .UnreadCountDidChange, object: nil)
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(statusesDidChange(_:)), name: .StatusesDidChange, object: nil)
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(containerChildrenDidChange(_:)), name: .ChildrenDidChange, object: nil)
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(batchUpdateDidPerform(_:)), name: .BatchUpdateDidPerform, object: nil)
|
||||
|
@ -429,6 +430,24 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
|
|||
treeControllerDelegate.resetFilterExceptions()
|
||||
}
|
||||
|
||||
@objc func unreadCountDidChange(_ note: Notification) {
|
||||
// If we are filtering reads, the new unread count is greater than 1, and the feed isn't shown then continue
|
||||
guard let feed = note.object as? Feed, isReadFeedsFiltered, feed.unreadCount > 0, !shadowTableContains(feed) else {
|
||||
return
|
||||
}
|
||||
|
||||
for section in shadowTable {
|
||||
for node in section {
|
||||
if let feed = node.representedObject as? Feed, let feedID = feed.feedID {
|
||||
treeControllerDelegate.addFilterException(feedID)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rebuildBackingStores()
|
||||
treeControllerDelegate.resetFilterExceptions()
|
||||
}
|
||||
|
||||
@objc func statusesDidChange(_ note: Notification) {
|
||||
updateUnreadCount()
|
||||
}
|
||||
|
@ -1211,6 +1230,17 @@ private extension SceneCoordinator {
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
func shadowTableContains(_ feed: Feed) -> Bool {
|
||||
for section in shadowTable {
|
||||
for node in section {
|
||||
if let nodeFeed = node.representedObject as? Feed, nodeFeed.feedID == feed.feedID {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func nodeFor(_ indexPath: IndexPath) -> Node? {
|
||||
guard indexPath.section < shadowTable.count && indexPath.row < shadowTable[indexPath.section].count else {
|
||||
|
|
Loading…
Reference in New Issue