diff --git a/Frameworks/Account/FeedWrangler/FeedWranglerAccountDelegate.swift b/Frameworks/Account/FeedWrangler/FeedWranglerAccountDelegate.swift index 8186e378b..9c760fd88 100644 --- a/Frameworks/Account/FeedWrangler/FeedWranglerAccountDelegate.swift +++ b/Frameworks/Account/FeedWrangler/FeedWranglerAccountDelegate.swift @@ -493,7 +493,7 @@ private extension FeedWranglerAccountDelegate { feed.name = subscription.title feed.editedName = nil feed.homePageURL = subscription.siteURL - feed.subscriptionID = nil // MARK: TODO What should this be? + feed.externalID = nil // MARK: TODO What should this be? } else { subscriptionsToAdd.insert(subscription) } @@ -502,7 +502,7 @@ private extension FeedWranglerAccountDelegate { subscriptionsToAdd.forEach { subscription in let feedId = String(subscription.feedID) let feed = account.createWebFeed(with: subscription.title, url: subscription.feedURL, webFeedID: feedId, homePageURL: subscription.siteURL) - feed.subscriptionID = nil + feed.externalID = nil account.addWebFeed(feed) } } diff --git a/Frameworks/Account/Feedbin/FeedbinAccountDelegate.swift b/Frameworks/Account/Feedbin/FeedbinAccountDelegate.swift index 35818a012..af2cda43a 100644 --- a/Frameworks/Account/Feedbin/FeedbinAccountDelegate.swift +++ b/Frameworks/Account/Feedbin/FeedbinAccountDelegate.swift @@ -334,7 +334,7 @@ final class FeedbinAccountDelegate: AccountDelegate { } else { - if let subscriptionID = feed.subscriptionID { + if let subscriptionID = feed.externalID { group.enter() refreshProgress.addToNumberOfTasksAndRemaining(1) caller.deleteSubscription(subscriptionID: subscriptionID) { result in @@ -398,7 +398,7 @@ final class FeedbinAccountDelegate: AccountDelegate { func renameWebFeed(for account: Account, with feed: WebFeed, to name: String, completion: @escaping (Result) -> Void) { // This error should never happen - guard let subscriptionID = feed.subscriptionID else { + guard let subscriptionID = feed.externalID else { completion(.failure(FeedbinAccountDelegateError.invalidParameter)) return } @@ -812,7 +812,7 @@ private extension FeedbinAccountDelegate { // If the name has been changed on the server remove the locally edited name feed.editedName = nil feed.homePageURL = subscription.homePageURL - feed.subscriptionID = String(subscription.subscriptionID) + feed.externalID = String(subscription.subscriptionID) feed.faviconURL = subscription.jsonFeed?.favicon feed.iconURL = subscription.jsonFeed?.icon } @@ -824,7 +824,7 @@ private extension FeedbinAccountDelegate { // Actually add subscriptions all in one go, so we don’t trigger various rebuilding things that Account does. subscriptionsToAdd.forEach { subscription in let feed = account.createWebFeed(with: subscription.name, url: subscription.url, webFeedID: String(subscription.feedID), homePageURL: subscription.homePageURL) - feed.subscriptionID = String(subscription.subscriptionID) + feed.externalID = String(subscription.subscriptionID) account.addWebFeed(feed) } } @@ -1004,7 +1004,7 @@ private extension FeedbinAccountDelegate { DispatchQueue.main.async { let feed = account.createWebFeed(with: sub.name, url: sub.url, webFeedID: String(sub.feedID), homePageURL: sub.homePageURL) - feed.subscriptionID = String(sub.subscriptionID) + feed.externalID = String(sub.subscriptionID) feed.iconURL = sub.jsonFeed?.icon feed.faviconURL = sub.jsonFeed?.favicon @@ -1351,7 +1351,7 @@ private extension FeedbinAccountDelegate { func deleteSubscription(for account: Account, with feed: WebFeed, from container: Container?, completion: @escaping (Result) -> Void) { // This error should never happen - guard let subscriptionID = feed.subscriptionID else { + guard let subscriptionID = feed.externalID else { completion(.failure(FeedbinAccountDelegateError.invalidParameter)) return } diff --git a/Frameworks/Account/ReaderAPI/ReaderAPIAccountDelegate.swift b/Frameworks/Account/ReaderAPI/ReaderAPIAccountDelegate.swift index ad55d4e6c..ab36e98d6 100644 --- a/Frameworks/Account/ReaderAPI/ReaderAPIAccountDelegate.swift +++ b/Frameworks/Account/ReaderAPI/ReaderAPIAccountDelegate.swift @@ -292,7 +292,7 @@ final class ReaderAPIAccountDelegate: AccountDelegate { func renameWebFeed(for account: Account, with feed: WebFeed, to name: String, completion: @escaping (Result) -> Void) { // This error should never happen - guard let subscriptionID = feed.subscriptionID else { + guard let subscriptionID = feed.externalID else { completion(.failure(FeedbinAccountDelegateError.invalidParameter)) return } @@ -340,12 +340,12 @@ final class ReaderAPIAccountDelegate: AccountDelegate { func addWebFeed(for account: Account, with feed: WebFeed, to container: Container, completion: @escaping (Result) -> Void) { - if let folder = container as? Folder, let feedName = feed.subscriptionID { + if let folder = container as? Folder, let feedName = feed.externalID { caller.createTagging(subscriptionID: feedName, tagName: folder.name ?? "") { result in switch result { case .success: DispatchQueue.main.async { - self.saveFolderRelationship(for: feed, withFolderName: folder.name ?? "", id: feed.subscriptionID!) + self.saveFolderRelationship(for: feed, withFolderName: folder.name ?? "", id: feed.externalID!) account.removeWebFeed(feed) folder.addWebFeed(feed) completion(.success(())) @@ -582,7 +582,7 @@ private extension ReaderAPIAccountDelegate { } else { let feed = account.createWebFeed(with: subscription.name, url: subscription.url, webFeedID: subFeedId, homePageURL: subscription.homePageURL) feed.iconURL = subscription.iconURL - feed.subscriptionID = String(subscription.feedID) + feed.externalID = String(subscription.feedID) account.addWebFeed(feed) } @@ -758,7 +758,7 @@ private extension ReaderAPIAccountDelegate { DispatchQueue.main.async { let feed = account.createWebFeed(with: sub.name, url: sub.url, webFeedID: String(sub.feedID), homePageURL: sub.homePageURL) - feed.subscriptionID = String(sub.feedID) + feed.externalID = String(sub.feedID) account.addWebFeed(feed, to: container) { result in switch result { @@ -985,7 +985,7 @@ private extension ReaderAPIAccountDelegate { func deleteTagging(for account: Account, with feed: WebFeed, from container: Container?, completion: @escaping (Result) -> Void) { - if let folder = container as? Folder, let feedName = feed.subscriptionID { + if let folder = container as? Folder, let feedName = feed.externalID { caller.deleteTagging(subscriptionID: feedName, tagName: folder.name ?? "") { result in switch result { case .success: @@ -1014,7 +1014,7 @@ private extension ReaderAPIAccountDelegate { func deleteSubscription(for account: Account, with feed: WebFeed, from container: Container?, completion: @escaping (Result) -> Void) { // This error should never happen - guard let subscriptionID = feed.subscriptionID else { + guard let subscriptionID = feed.externalID else { completion(.failure(FeedbinAccountDelegateError.invalidParameter)) return } diff --git a/Frameworks/Account/WebFeed.swift b/Frameworks/Account/WebFeed.swift index 179b7720d..a63d28fb0 100644 --- a/Frameworks/Account/WebFeed.swift +++ b/Frameworks/Account/WebFeed.swift @@ -153,12 +153,12 @@ public final class WebFeed: Feed, Renamable, Hashable { } } - public var subscriptionID: String? { + public var externalID: String? { get { - return metadata.subscriptionID + return metadata.externalID } set { - metadata.subscriptionID = newValue + metadata.externalID = newValue } } diff --git a/Frameworks/Account/WebFeedMetadata.swift b/Frameworks/Account/WebFeedMetadata.swift index 8af4eaa6a..424cdc638 100644 --- a/Frameworks/Account/WebFeedMetadata.swift +++ b/Frameworks/Account/WebFeedMetadata.swift @@ -27,7 +27,7 @@ final class WebFeedMetadata: Codable { case isNotifyAboutNewArticles case isArticleExtractorAlwaysOn case conditionalGetInfo - case subscriptionID + case externalID = "subscriptionID" case folderRelationship } @@ -111,10 +111,10 @@ final class WebFeedMetadata: Codable { } } - var subscriptionID: String? { + var externalID: String? { didSet { - if subscriptionID != oldValue { - valueDidChange(.subscriptionID) + if externalID != oldValue { + valueDidChange(.externalID) } } }