mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2024-12-20 14:33:04 +01:00
Update a Feed with settings taken from the raw feed. (Some Feeds had no homePageURL set, which meant, in most cases, no favicons.)
This commit is contained in:
parent
09c5d09c4e
commit
55166e0979
@ -150,12 +150,7 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
|
||||
|
||||
func update(_ feed: Feed, with parsedFeed: ParsedFeed, _ completion: @escaping RSVoidCompletionBlock) {
|
||||
|
||||
if feed.iconURL != parsedFeed.iconURL {
|
||||
feed.iconURL = parsedFeed.iconURL
|
||||
dirty = true
|
||||
}
|
||||
if feed.faviconURL != parsedFeed.faviconURL {
|
||||
feed.faviconURL = parsedFeed.faviconURL
|
||||
if feed.takeSettings(from: parsedFeed) {
|
||||
dirty = true
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
import Foundation
|
||||
import Data
|
||||
import RSParser
|
||||
|
||||
public extension Feed {
|
||||
|
||||
@ -25,6 +26,32 @@ public extension Feed {
|
||||
}
|
||||
return account.fetchArticles(for: self)
|
||||
}
|
||||
|
||||
public func takeSettings(from parsedFeed: ParsedFeed) -> Bool {
|
||||
|
||||
// Return true if anything changed.
|
||||
|
||||
var didChangeAtLeastOneSetting = false
|
||||
|
||||
if iconURL != parsedFeed.iconURL {
|
||||
iconURL = parsedFeed.iconURL
|
||||
didChangeAtLeastOneSetting = true
|
||||
}
|
||||
if faviconURL != parsedFeed.faviconURL {
|
||||
faviconURL = parsedFeed.faviconURL
|
||||
didChangeAtLeastOneSetting = true
|
||||
}
|
||||
if homePageURL != parsedFeed.homePageURL {
|
||||
homePageURL = parsedFeed.homePageURL
|
||||
didChangeAtLeastOneSetting = true
|
||||
}
|
||||
if name != parsedFeed.title {
|
||||
name = parsedFeed.title
|
||||
didChangeAtLeastOneSetting = true
|
||||
}
|
||||
|
||||
return didChangeAtLeastOneSetting
|
||||
}
|
||||
}
|
||||
|
||||
public extension Article {
|
||||
|
Loading…
Reference in New Issue
Block a user