From cd85e52fdd5c796994debbcd1575d84bab0d3f14 Mon Sep 17 00:00:00 2001 From: Tom Grimwood-Taylor Date: Mon, 3 Jun 2019 17:04:30 +0100 Subject: [PATCH 1/8] Fix updating local feed list when no remote feeds. When there were no remote feeds the logic to remove local feeds was skipped. --- Frameworks/Account/Feedbin/FeedbinAccountDelegate.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Frameworks/Account/Feedbin/FeedbinAccountDelegate.swift b/Frameworks/Account/Feedbin/FeedbinAccountDelegate.swift index f7788af52..09ba4c9ff 100644 --- a/Frameworks/Account/Feedbin/FeedbinAccountDelegate.swift +++ b/Frameworks/Account/Feedbin/FeedbinAccountDelegate.swift @@ -612,7 +612,7 @@ private extension FeedbinAccountDelegate { func syncFeeds(_ account: Account, _ subscriptions: [FeedbinSubscription]?) { - guard let subscriptions = subscriptions else { return } + let subscriptions = subscriptions ?? [] os_log(.debug, log: log, "Syncing feeds with %ld subscriptions.", subscriptions.count) From 3c1b84dd7381e299834ff670e99c6b1d7e453213 Mon Sep 17 00:00:00 2001 From: Tom Grimwood-Taylor Date: Thu, 6 Jun 2019 10:23:14 +0100 Subject: [PATCH 2/8] Fix a Feedbin subscriptionID going out of sync. If, for example, a user deleted a feed and recreated it on the server without a sync in between, the subscription ID for the feed would update on the server, but remain unchanged locally. If the user then wanted to delete or rename the feed they'd get a 404 error. --- Frameworks/Account/Feedbin/FeedbinAccountDelegate.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Frameworks/Account/Feedbin/FeedbinAccountDelegate.swift b/Frameworks/Account/Feedbin/FeedbinAccountDelegate.swift index 09ba4c9ff..1964830ee 100644 --- a/Frameworks/Account/Feedbin/FeedbinAccountDelegate.swift +++ b/Frameworks/Account/Feedbin/FeedbinAccountDelegate.swift @@ -648,6 +648,7 @@ private extension FeedbinAccountDelegate { if let feed = account.idToFeedDictionary[subFeedId] { feed.name = subscription.name feed.homePageURL = subscription.homePageURL + feed.subscriptionID = String(subscription.subscriptionID) } else { let feed = account.createFeed(with: subscription.name, url: subscription.url, feedID: subFeedId, homePageURL: subscription.homePageURL) feed.subscriptionID = String(subscription.subscriptionID) From b4d7042a7b562e26e4da6c3423635d7d10c032b8 Mon Sep 17 00:00:00 2001 From: Tom Grimwood-Taylor Date: Wed, 5 Jun 2019 21:17:43 +0100 Subject: [PATCH 3/8] Ensure status changes are sent before refresh. When the refresh button was manually clicked a full refresh would occur, but locally changed statuses wouldn't be sent. This meant the statuses of items in NetNewsWire would revert to their remote values until an automatic status sync was triggered. --- Frameworks/Account/Account.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Frameworks/Account/Account.swift b/Frameworks/Account/Account.swift index 8d5564215..efcec7bb7 100644 --- a/Frameworks/Account/Account.swift +++ b/Frameworks/Account/Account.swift @@ -298,7 +298,9 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container, } public func refreshAll(completion: @escaping (Result) -> Void) { - self.delegate.refreshAll(for: self, completion: completion) + delegate.sendArticleStatus(for: self) { [unowned self] in + self.delegate.refreshAll(for: self, completion: completion) + } } public func syncArticleStatus(completion: (() -> Void)? = nil) { From f3505e45375961c9c215635034ac6a90ad363c06 Mon Sep 17 00:00:00 2001 From: Tom Grimwood-Taylor Date: Wed, 5 Jun 2019 12:53:30 +0100 Subject: [PATCH 4/8] Fix posting name notifications when name changes. --- Frameworks/Account/Feed.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Frameworks/Account/Feed.swift b/Frameworks/Account/Feed.swift index 5b416bcf8..c0b3cb9cd 100644 --- a/Frameworks/Account/Feed.swift +++ b/Frameworks/Account/Feed.swift @@ -64,7 +64,7 @@ public final class Feed: DisplayNameProvider, Renamable, UnreadCountProvider, Ha set { let oldNameForDisplay = nameForDisplay metadata.name = newValue - if oldNameForDisplay != nameForDisplay { + if oldNameForDisplay != newValue { postDisplayNameDidChangeNotification() } } From ac9057299a8931177aba2aac52cc8b834ed7b7eb Mon Sep 17 00:00:00 2001 From: Tom Grimwood-Taylor Date: Wed, 5 Jun 2019 12:54:00 +0100 Subject: [PATCH 5/8] Remove edited name when remote feed name changes. --- Frameworks/Account/Feedbin/FeedbinAccountDelegate.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Frameworks/Account/Feedbin/FeedbinAccountDelegate.swift b/Frameworks/Account/Feedbin/FeedbinAccountDelegate.swift index 1964830ee..2ee47df57 100644 --- a/Frameworks/Account/Feedbin/FeedbinAccountDelegate.swift +++ b/Frameworks/Account/Feedbin/FeedbinAccountDelegate.swift @@ -647,6 +647,8 @@ private extension FeedbinAccountDelegate { DispatchQueue.main.sync { if let feed = account.idToFeedDictionary[subFeedId] { feed.name = subscription.name + // 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) } else { From 044769414286d8791fe678c6eddd583ed3d997a4 Mon Sep 17 00:00:00 2001 From: Tom Grimwood-Taylor Date: Mon, 3 Jun 2019 17:11:16 +0100 Subject: [PATCH 6/8] Fix feed selection when the max feed score is 0. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This occurs, for example, when searching for “macrumors.com” and adding to the Feedbin account. All four feeds have a score of 0 since their source is set as HTMLLink. This would also fix a case in which there are two feeds: one with a negative score and one with a score of 0. Since the method uses a Set the feed selected when there are multiple feeds with an identical maximum score will be random. --- Frameworks/Account/FeedFinder/FeedSpecifier.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Frameworks/Account/FeedFinder/FeedSpecifier.swift b/Frameworks/Account/FeedFinder/FeedSpecifier.swift index 68073198e..f90e956fe 100644 --- a/Frameworks/Account/FeedFinder/FeedSpecifier.swift +++ b/Frameworks/Account/FeedFinder/FeedSpecifier.swift @@ -46,7 +46,7 @@ struct FeedSpecifier: Hashable { return feedSpecifiers.anyObject() } - var currentHighScore = 0 + var currentHighScore = Int.min var currentBestFeed: FeedSpecifier? = nil for oneFeedSpecifier in feedSpecifiers { From 534da0bca6c6caaac975808cddbcdd0b17774aec Mon Sep 17 00:00:00 2001 From: Tom Grimwood-Taylor Date: Thu, 6 Jun 2019 14:22:29 +0100 Subject: [PATCH 7/8] Move call to sendArticleStatus to delegate. --- Frameworks/Account/Account.swift | 4 +--- .../Account/Feedbin/FeedbinAccountDelegate.swift | 12 +++++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Frameworks/Account/Account.swift b/Frameworks/Account/Account.swift index efcec7bb7..8d5564215 100644 --- a/Frameworks/Account/Account.swift +++ b/Frameworks/Account/Account.swift @@ -298,9 +298,7 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container, } public func refreshAll(completion: @escaping (Result) -> Void) { - delegate.sendArticleStatus(for: self) { [unowned self] in - self.delegate.refreshAll(for: self, completion: completion) - } + self.delegate.refreshAll(for: self, completion: completion) } public func syncArticleStatus(completion: (() -> Void)? = nil) { diff --git a/Frameworks/Account/Feedbin/FeedbinAccountDelegate.swift b/Frameworks/Account/Feedbin/FeedbinAccountDelegate.swift index 2ee47df57..1c7a75971 100644 --- a/Frameworks/Account/Feedbin/FeedbinAccountDelegate.swift +++ b/Frameworks/Account/Feedbin/FeedbinAccountDelegate.swift @@ -88,11 +88,13 @@ final class FeedbinAccountDelegate: AccountDelegate { case .success(): self.refreshArticles(account) { - self.refreshArticleStatus(for: account) { - self.refreshMissingArticles(account) { - self.refreshProgress.clear() - DispatchQueue.main.async { - completion(.success(())) + self.sendArticleStatus(for: account) { + self.refreshArticleStatus(for: account) { + self.refreshMissingArticles(account) { + self.refreshProgress.clear() + DispatchQueue.main.async { + completion(.success(())) + } } } } From b0a24b6f17732bf9f2f3eafe32b06e3843bdbd7c Mon Sep 17 00:00:00 2001 From: Tom Grimwood-Taylor Date: Thu, 6 Jun 2019 14:23:06 +0100 Subject: [PATCH 8/8] Revert "Fix updating local feed list when no remote feeds." cd85e52fdd5c796994debbcd1575d84bab0d3f14 --- Frameworks/Account/Feedbin/FeedbinAccountDelegate.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Frameworks/Account/Feedbin/FeedbinAccountDelegate.swift b/Frameworks/Account/Feedbin/FeedbinAccountDelegate.swift index 1c7a75971..00c494a82 100644 --- a/Frameworks/Account/Feedbin/FeedbinAccountDelegate.swift +++ b/Frameworks/Account/Feedbin/FeedbinAccountDelegate.swift @@ -614,7 +614,7 @@ private extension FeedbinAccountDelegate { func syncFeeds(_ account: Account, _ subscriptions: [FeedbinSubscription]?) { - let subscriptions = subscriptions ?? [] + guard let subscriptions = subscriptions else { return } os_log(.debug, log: log, "Syncing feeds with %ld subscriptions.", subscriptions.count)