Merge branch 'master' of https://github.com/brentsimmons/NetNewsWire
This commit is contained in:
commit
559218bc87
|
@ -129,7 +129,7 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
|
|||
public var folders: Set<Folder>? = Set<Folder>()
|
||||
private var feedDictionaryNeedsUpdate = true
|
||||
private var _idToFeedDictionary = [String: Feed]()
|
||||
var idToFeedDictionary: [String: Feed] {
|
||||
private var idToFeedDictionary: [String: Feed] {
|
||||
if feedDictionaryNeedsUpdate {
|
||||
rebuildFeedDictionaries()
|
||||
}
|
||||
|
@ -816,7 +816,7 @@ extension Account: FeedMetadataDelegate {
|
|||
|
||||
func valueDidChange(_ feedMetadata: FeedMetadata, key: FeedMetadata.CodingKeys) {
|
||||
feedMetadataDirty = true
|
||||
guard let feed = existingFeed(with: feedMetadata.feedID) else {
|
||||
guard let feed = existingFeed(withFeedID: feedMetadata.feedID) else {
|
||||
return
|
||||
}
|
||||
feed.postFeedSettingDidChangeNotification(key)
|
||||
|
@ -1213,7 +1213,7 @@ private extension Account {
|
|||
|
||||
extension Account {
|
||||
|
||||
public func existingFeed(with feedID: String) -> Feed? {
|
||||
public func existingFeed(withFeedID feedID: String) -> Feed? {
|
||||
return idToFeedDictionary[feedID]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ public protocol Container: class {
|
|||
func has(_ feed: Feed) -> Bool
|
||||
func hasFeed(with feedID: String) -> Bool
|
||||
func hasFeed(withURL url: String) -> Bool
|
||||
func existingFeed(with feedID: String) -> Feed?
|
||||
func existingFeed(withFeedID: String) -> Feed?
|
||||
func existingFeed(withURL url: String) -> Feed?
|
||||
func existingFolder(with name: String) -> Folder?
|
||||
func existingFolder(withID: Int) -> Folder?
|
||||
|
@ -88,7 +88,7 @@ public extension Container {
|
|||
}
|
||||
|
||||
func hasFeed(with feedID: String) -> Bool {
|
||||
return existingFeed(with: feedID) != nil
|
||||
return existingFeed(withFeedID: feedID) != nil
|
||||
}
|
||||
|
||||
func hasFeed(withURL url: String) -> Bool {
|
||||
|
@ -99,7 +99,7 @@ public extension Container {
|
|||
return flattenedFeeds().contains(feed)
|
||||
}
|
||||
|
||||
func existingFeed(with feedID: String) -> Feed? {
|
||||
func existingFeed(withFeedID feedID: String) -> Feed? {
|
||||
for feed in flattenedFeeds() {
|
||||
if feed.feedID == feedID {
|
||||
return feed
|
||||
|
|
|
@ -53,7 +53,7 @@ public extension Article {
|
|||
}
|
||||
|
||||
var feed: Feed? {
|
||||
return account?.existingFeed(with: feedID)
|
||||
return account?.existingFeed(withFeedID: feedID)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -39,6 +39,10 @@ public final class Feed: DisplayNameProvider, Renamable, UnreadCountProvider, Ha
|
|||
}
|
||||
}
|
||||
|
||||
// Note: this is available only if the icon URL was available in the feed.
|
||||
// The icon URL is a JSON-Feed-only feature.
|
||||
// Otherwise we find an icon URL via other means, but we don’t store it
|
||||
// as part of feed metadata.
|
||||
public var iconURL: String? {
|
||||
get {
|
||||
return metadata.iconURL
|
||||
|
@ -48,6 +52,10 @@ public final class Feed: DisplayNameProvider, Renamable, UnreadCountProvider, Ha
|
|||
}
|
||||
}
|
||||
|
||||
// Note: this is available only if the favicon URL was available in the feed.
|
||||
// The favicon URL is a JSON-Feed-only feature.
|
||||
// Otherwise we find a favicon URL via other means, but we don’t store it
|
||||
// as part of feed metadata.
|
||||
public var faviconURL: String? {
|
||||
get {
|
||||
return metadata.faviconURL
|
||||
|
|
|
@ -715,7 +715,7 @@ private extension FeedbinAccountDelegate {
|
|||
|
||||
let subFeedId = String(subscription.feedID)
|
||||
|
||||
if let feed = account.idToFeedDictionary[subFeedId] {
|
||||
if let feed = account.existingFeed(withFeedID: subFeedId) {
|
||||
feed.name = subscription.name
|
||||
// If the name has been changed on the server remove the locally edited name
|
||||
feed.editedName = nil
|
||||
|
@ -778,7 +778,7 @@ private extension FeedbinAccountDelegate {
|
|||
for tagging in groupedTaggings {
|
||||
let taggingFeedID = String(tagging.feedID)
|
||||
if !folderFeedIds.contains(taggingFeedID) {
|
||||
guard let feed = account.idToFeedDictionary[taggingFeedID] else {
|
||||
guard let feed = account.existingFeed(withFeedID: taggingFeedID) else {
|
||||
continue
|
||||
}
|
||||
saveFolderRelationship(for: feed, withFolderName: folderName, id: String(tagging.taggingID))
|
||||
|
@ -1072,7 +1072,7 @@ private extension FeedbinAccountDelegate {
|
|||
|
||||
group.enter()
|
||||
|
||||
if let feed = account.idToFeedDictionary[feedID] {
|
||||
if let feed = account.existingFeed(withFeedID: feedID) {
|
||||
DispatchQueue.main.async {
|
||||
account.update(feed, parsedItems: Set(mapItems), defaultRead: true) {
|
||||
group.leave()
|
||||
|
|
|
@ -549,7 +549,7 @@ private extension ReaderAPIAccountDelegate {
|
|||
subscriptions.forEach { subscription in
|
||||
|
||||
let subFeedId = String(subscription.feedID)
|
||||
if let feed = account.idToFeedDictionary[subFeedId] {
|
||||
if let feed = account.existingFeed(withFeedID: subFeedId) {
|
||||
feed.name = subscription.name
|
||||
feed.homePageURL = subscription.homePageURL
|
||||
} else {
|
||||
|
@ -619,8 +619,7 @@ private extension ReaderAPIAccountDelegate {
|
|||
for subscription in groupedTaggings {
|
||||
let taggingFeedID = String(subscription.feedID)
|
||||
if !folderFeedIds.contains(taggingFeedID) {
|
||||
let idDictionary = account.idToFeedDictionary
|
||||
guard let feed = idDictionary[taggingFeedID] else {
|
||||
guard let feed = account.existingFeed(withFeedID: taggingFeedID) else {
|
||||
continue
|
||||
}
|
||||
saveFolderRelationship(for: feed, withFolderName: folderName, id: String(subscription.feedID))
|
||||
|
@ -880,7 +879,7 @@ private extension ReaderAPIAccountDelegate {
|
|||
|
||||
group.enter()
|
||||
|
||||
if let feed = account.idToFeedDictionary[feedID] {
|
||||
if let feed = account.existingFeed(withFeedID: feedID) {
|
||||
DispatchQueue.main.async {
|
||||
account.update(feed, parsedItems: Set(mapItems), defaultRead: true) {
|
||||
group.leave()
|
||||
|
|
|
@ -43,7 +43,7 @@ private func accountAndArticlesDictionary(_ articles: Set<Article>) -> [String:
|
|||
extension Article {
|
||||
|
||||
var feed: Feed? {
|
||||
return account?.existingFeed(with: feedID)
|
||||
return account?.existingFeed(withFeedID: feedID)
|
||||
}
|
||||
|
||||
var preferredLink: String? {
|
||||
|
|
Loading…
Reference in New Issue