Fix BazQux feed adds since they we always deleting themselves.

This commit is contained in:
Maurice Parker 2020-10-24 21:51:14 -05:00
parent 7db18d2366
commit 45f5776b7e

View File

@ -657,14 +657,13 @@ private extension ReaderAPIAccountDelegate {
// Add any feeds we don't have and update any we do // Add any feeds we don't have and update any we do
subscriptions.forEach { subscription in subscriptions.forEach { subscription in
let subFeedId = String(subscription.feedID) if let feed = account.existingWebFeed(withWebFeedID: subscription.feedID) {
if let feed = account.existingWebFeed(withWebFeedID: subFeedId) {
feed.name = subscription.name feed.name = subscription.name
feed.homePageURL = subscription.homePageURL feed.homePageURL = subscription.homePageURL
} else { } else {
let feed = account.createWebFeed(with: subscription.name, url: subscription.url, webFeedID: subFeedId, homePageURL: subscription.homePageURL) let feed = account.createWebFeed(with: subscription.name, url: subscription.url, webFeedID: subscription.feedID, homePageURL: subscription.homePageURL)
feed.iconURL = subscription.iconURL feed.iconURL = subscription.iconURL
feed.externalID = String(subscription.feedID) feed.externalID = subscription.feedID
account.addWebFeed(feed) account.addWebFeed(feed)
} }
@ -728,15 +727,17 @@ private extension ReaderAPIAccountDelegate {
} }
} }
// I don't know what this is supposed to do.
let taggedFeedIDs = Set(subscriptions.map { String($0.feedID) }) // let taggedFeedIDs = Set(subscriptions.map { String($0.feedID) })
//
// Remove all feeds from the account container that have a tag // // Remove all feeds from the account container that have a tag
for feed in account.topLevelWebFeeds { // for feed in account.topLevelWebFeeds {
if taggedFeedIDs.contains(feed.webFeedID) { // if taggedFeedIDs.contains(feed.webFeedID) {
account.removeWebFeed(feed) // account.removeWebFeed(feed)
} // }
} // }
} }
func nameToFolderDictionary(with folders: Set<Folder>?) -> [String: Folder] { func nameToFolderDictionary(with folders: Set<Folder>?) -> [String: Folder] {