Renamed subscriptionID to externalD on WebFeed so that it matches what we did with Folder.
This commit is contained in:
parent
9315a00d19
commit
f2d9552c85
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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, Error>) -> 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, Error>) -> Void) {
|
||||
|
||||
// This error should never happen
|
||||
guard let subscriptionID = feed.subscriptionID else {
|
||||
guard let subscriptionID = feed.externalID else {
|
||||
completion(.failure(FeedbinAccountDelegateError.invalidParameter))
|
||||
return
|
||||
}
|
||||
|
|
|
@ -292,7 +292,7 @@ final class ReaderAPIAccountDelegate: AccountDelegate {
|
|||
func renameWebFeed(for account: Account, with feed: WebFeed, to name: String, completion: @escaping (Result<Void, Error>) -> 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, Error>) -> 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, Error>) -> 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, Error>) -> Void) {
|
||||
|
||||
// This error should never happen
|
||||
guard let subscriptionID = feed.subscriptionID else {
|
||||
guard let subscriptionID = feed.externalID else {
|
||||
completion(.failure(FeedbinAccountDelegateError.invalidParameter))
|
||||
return
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue