Continue renaming webFeed to feed.

This commit is contained in:
Brent Simmons
2024-11-01 22:09:22 -07:00
parent fac4eded60
commit 2d3ef95619
40 changed files with 286 additions and 286 deletions

View File

@@ -143,7 +143,7 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
}
}
public var topLevelWebFeeds = Set<Feed>()
public var topLevelFeeds = Set<Feed>()
public var folders: Set<Folder>? = Set<Folder>()
public var externalID: String? {
@@ -179,7 +179,7 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
}
var flattenedWebFeedURLs: Set<String> {
return Set(flattenedWebFeeds().map({ $0.url }))
return Set(flattenedFeeds().map({ $0.url }))
}
var username: String? {
@@ -339,7 +339,7 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
self.metadata.performedApril2020RetentionPolicyChange = true
}
self.database.cleanupDatabaseAtStartup(subscribedToWebFeedIDs: self.flattenedWebFeeds().webFeedIDs())
self.database.cleanupDatabaseAtStartup(subscribedToWebFeedIDs: self.flattenedFeeds().webFeedIDs())
self.fetchAllUnreadCounts()
}
@@ -537,11 +537,11 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
func existingContainers(withWebFeed webFeed: Feed) -> [Container] {
var containers = [Container]()
if topLevelWebFeeds.contains(webFeed) {
if topLevelFeeds.contains(webFeed) {
containers.append(self)
}
folders?.forEach { folder in
if folder.topLevelWebFeeds.contains(webFeed) {
if folder.topLevelFeeds.contains(webFeed) {
containers.append(folder)
}
}
@@ -588,7 +588,7 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
func newWebFeed(with opmlFeedSpecifier: RSOPMLFeedSpecifier) -> Feed {
let feedURL = opmlFeedSpecifier.feedURL
let metadata = webFeedMetadata(feedURL: feedURL, webFeedID: feedURL)
let metadata = webFeedMetadata(feedURL: feedURL, feedID: feedURL)
let feed = Feed(account: self, url: opmlFeedSpecifier.feedURL, metadata: metadata)
if let feedTitle = opmlFeedSpecifier.title {
if feed.name == nil {
@@ -598,16 +598,16 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
return feed
}
public func addWebFeed(_ feed: Feed, to container: Container, completion: @escaping (Result<Void, Error>) -> Void) {
public func addFeed(_ feed: Feed, to container: Container, completion: @escaping (Result<Void, Error>) -> Void) {
delegate.addWebFeed(for: self, with: feed, to: container, completion: completion)
}
public func createWebFeed(url: String, name: String?, container: Container, validateFeed: Bool, completion: @escaping (Result<Feed, Error>) -> Void) {
public func createFeed(url: String, name: String?, container: Container, validateFeed: Bool, completion: @escaping (Result<Feed, Error>) -> Void) {
delegate.createWebFeed(for: self, url: url, name: name, container: container, validateFeed: validateFeed, completion: completion)
}
func createWebFeed(with name: String?, url: String, webFeedID: String, homePageURL: String?) -> Feed {
let metadata = webFeedMetadata(feedURL: url, webFeedID: webFeedID)
let metadata = webFeedMetadata(feedURL: url, feedID: webFeedID)
let feed = Feed(account: self, url: url, metadata: metadata)
feed.name = name
feed.homePageURL = homePageURL
@@ -618,7 +618,7 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
delegate.removeWebFeed(for: self, with: feed, from: container, completion: completion)
}
public func moveWebFeed(_ feed: Feed, from: Container, to: Container, completion: @escaping (Result<Void, Error>) -> Void) {
public func moveFeed(_ feed: Feed, from: Container, to: Container, completion: @escaping (Result<Void, Error>) -> Void) {
delegate.moveWebFeed(for: self, with: feed, from: from, to: to, completion: completion)
}
@@ -711,15 +711,15 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
}
public func fetchUnreadCountForToday(_ completion: @escaping SingleUnreadCountCompletionBlock) {
database.fetchUnreadCountForToday(for: flattenedWebFeeds().webFeedIDs(), completion: completion)
database.fetchUnreadCountForToday(for: flattenedFeeds().webFeedIDs(), completion: completion)
}
public func fetchUnreadCountForStarredArticles(_ completion: @escaping SingleUnreadCountCompletionBlock) {
database.fetchStarredAndUnreadCount(for: flattenedWebFeeds().webFeedIDs(), completion: completion)
database.fetchStarredAndUnreadCount(for: flattenedFeeds().webFeedIDs(), completion: completion)
}
public func fetchCountForStarredArticles() throws -> Int {
return try database.fetchStarredArticlesCount(flattenedWebFeeds().webFeedIDs())
return try database.fetchStarredArticlesCount(flattenedFeeds().webFeedIDs())
}
public func fetchUnreadArticleIDs(_ completion: @escaping ArticleIDsCompletionBlock) {
@@ -736,11 +736,11 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
}
public func unreadCount(for webFeed: Feed) -> Int {
return unreadCounts[webFeed.webFeedID] ?? 0
return unreadCounts[webFeed.feedID] ?? 0
}
public func setUnreadCount(_ unreadCount: Int, for webFeed: Feed) {
unreadCounts[webFeed.webFeedID] = unreadCount
unreadCounts[webFeed.feedID] = unreadCount
}
public func structureDidChange() {
@@ -763,7 +763,7 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
return
}
update(webFeed.webFeedID, with: parsedItems, completion: completion)
update(webFeed.feedID, with: parsedItems, completion: completion)
}
func update(_ webFeedID: String, with parsedItems: Set<ParsedItem>, deleteOlder: Bool = true, completion: @escaping UpdateArticlesCompletionBlock) {
@@ -899,7 +899,7 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
// MARK: - Container
public func flattenedWebFeeds() -> Set<Feed> {
public func flattenedFeeds() -> Set<Feed> {
assert(Thread.isMainThread)
if flattenedWebFeedsNeedUpdate {
updateFlattenedWebFeeds()
@@ -908,7 +908,7 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
}
public func removeWebFeed(_ webFeed: Feed) {
topLevelWebFeeds.remove(webFeed)
topLevelFeeds.remove(webFeed)
structureDidChange()
postChildrenDidChangeNotification()
}
@@ -917,19 +917,19 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
guard !webFeeds.isEmpty else {
return
}
topLevelWebFeeds.subtract(webFeeds)
topLevelFeeds.subtract(webFeeds)
structureDidChange()
postChildrenDidChangeNotification()
}
public func addWebFeed(_ webFeed: Feed) {
topLevelWebFeeds.insert(webFeed)
topLevelFeeds.insert(webFeed)
structureDidChange()
postChildrenDidChangeNotification()
}
func addFeedIfNotInAnyFolder(_ webFeed: Feed) {
if !flattenedWebFeeds().contains(webFeed) {
if !flattenedFeeds().contains(webFeed) {
addWebFeed(webFeed)
}
}
@@ -944,7 +944,7 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
public func debugDropConditionalGetInfo() {
#if DEBUG
flattenedWebFeeds().forEach{ $0.dropConditionalGetInfo() }
flattenedFeeds().forEach{ $0.dropConditionalGetInfo() }
#endif
}
@@ -1027,7 +1027,7 @@ extension Account: WebFeedMetadataDelegate {
func valueDidChange(_ feedMetadata: WebFeedMetadata, key: WebFeedMetadata.CodingKeys) {
webFeedMetadataFile.markAsDirty()
guard let feed = existingWebFeed(withWebFeedID: feedMetadata.webFeedID) else {
guard let feed = existingWebFeed(withWebFeedID: feedMetadata.feedID) else {
return
}
feed.postFeedSettingDidChangeNotification(key)
@@ -1039,11 +1039,11 @@ extension Account: WebFeedMetadataDelegate {
private extension Account {
func fetchStarredArticles(limit: Int?) throws -> Set<Article> {
return try database.fetchStarredArticles(flattenedWebFeeds().webFeedIDs(), limit)
return try database.fetchStarredArticles(flattenedFeeds().webFeedIDs(), limit)
}
func fetchStarredArticlesAsync(limit: Int?, _ completion: @escaping ArticleSetResultBlock) {
database.fetchedStarredArticlesAsync(flattenedWebFeeds().webFeedIDs(), limit, completion)
database.fetchedStarredArticlesAsync(flattenedFeeds().webFeedIDs(), limit, completion)
}
func fetchUnreadArticles(limit: Int?) throws -> Set<Article> {
@@ -1055,11 +1055,11 @@ private extension Account {
}
func fetchTodayArticles(limit: Int?) throws -> Set<Article> {
return try database.fetchTodayArticles(flattenedWebFeeds().webFeedIDs(), limit)
return try database.fetchTodayArticles(flattenedFeeds().webFeedIDs(), limit)
}
func fetchTodayArticlesAsync(limit: Int?, _ completion: @escaping ArticleSetResultBlock) {
database.fetchTodayArticlesAsync(flattenedWebFeeds().webFeedIDs(), limit, completion)
database.fetchTodayArticlesAsync(flattenedFeeds().webFeedIDs(), limit, completion)
}
func fetchArticles(folder: Folder) throws -> Set<Article> {
@@ -1079,13 +1079,13 @@ private extension Account {
}
func fetchArticles(webFeed: Feed) throws -> Set<Article> {
let articles = try database.fetchArticles(webFeed.webFeedID)
let articles = try database.fetchArticles(webFeed.feedID)
validateUnreadCount(webFeed, articles)
return articles
}
func fetchArticlesAsync(webFeed: Feed, _ completion: @escaping ArticleSetResultBlock) {
database.fetchArticlesAsync(webFeed.webFeedID) { [weak self] articleSetResult in
database.fetchArticlesAsync(webFeed.feedID) { [weak self] articleSetResult in
switch articleSetResult {
case .success(let articles):
self?.validateUnreadCount(webFeed, articles)
@@ -1097,7 +1097,7 @@ private extension Account {
}
func fetchArticlesMatching(_ searchString: String) throws -> Set<Article> {
return try database.fetchArticlesMatching(searchString, flattenedWebFeeds().webFeedIDs())
return try database.fetchArticlesMatching(searchString, flattenedFeeds().webFeedIDs())
}
func fetchArticlesMatchingWithArticleIDs(_ searchString: String, _ articleIDs: Set<String>) throws -> Set<Article> {
@@ -1105,7 +1105,7 @@ private extension Account {
}
func fetchArticlesMatchingAsync(_ searchString: String, _ completion: @escaping ArticleSetResultBlock) {
database.fetchArticlesMatchingAsync(searchString, flattenedWebFeeds().webFeedIDs(), completion)
database.fetchArticlesMatchingAsync(searchString, flattenedFeeds().webFeedIDs(), completion)
}
func fetchArticlesMatchingWithArticleIDsAsync(_ searchString: String, _ articleIDs: Set<String>, _ completion: @escaping ArticleSetResultBlock) {
@@ -1121,20 +1121,20 @@ private extension Account {
}
func fetchUnreadArticles(webFeed: Feed) throws -> Set<Article> {
let articles = try database.fetchUnreadArticles(Set([webFeed.webFeedID]), nil)
let articles = try database.fetchUnreadArticles(Set([webFeed.feedID]), nil)
validateUnreadCount(webFeed, articles)
return articles
}
func fetchArticles(forContainer container: Container) throws -> Set<Article> {
let feeds = container.flattenedWebFeeds()
let feeds = container.flattenedFeeds()
let articles = try database.fetchArticles(feeds.webFeedIDs())
validateUnreadCountsAfterFetchingUnreadArticles(feeds, articles)
return articles
}
func fetchArticlesAsync(forContainer container: Container, _ completion: @escaping ArticleSetResultBlock) {
let webFeeds = container.flattenedWebFeeds()
let webFeeds = container.flattenedFeeds()
database.fetchArticlesAsync(webFeeds.webFeedIDs()) { [weak self] (articleSetResult) in
switch articleSetResult {
case .success(let articles):
@@ -1147,7 +1147,7 @@ private extension Account {
}
func fetchUnreadArticles(forContainer container: Container, limit: Int?) throws -> Set<Article> {
let feeds = container.flattenedWebFeeds()
let feeds = container.flattenedFeeds()
let articles = try database.fetchUnreadArticles(feeds.webFeedIDs(), limit)
// We don't validate limit queries because they, by definition, won't correctly match the
@@ -1160,7 +1160,7 @@ private extension Account {
}
func fetchUnreadArticlesAsync(forContainer container: Container, limit: Int?, _ completion: @escaping ArticleSetResultBlock) {
let webFeeds = container.flattenedWebFeeds()
let webFeeds = container.flattenedFeeds()
database.fetchUnreadArticlesAsync(webFeeds.webFeedIDs(), limit) { [weak self] (articleSetResult) in
switch articleSetResult {
case .success(let articles):
@@ -1189,7 +1189,7 @@ private extension Account {
unreadCountStorage[article.webFeedID, default: 0] += 1
}
webFeeds.forEach { (webFeed) in
let unreadCount = unreadCountStorage[webFeed.webFeedID, default: 0]
let unreadCount = unreadCountStorage[webFeed.feedID, default: 0]
webFeed.unreadCount = unreadCount
}
}
@@ -1213,12 +1213,12 @@ private extension Account {
private extension Account {
func webFeedMetadata(feedURL: String, webFeedID: String) -> WebFeedMetadata {
func webFeedMetadata(feedURL: String, feedID: String) -> WebFeedMetadata {
if let d = webFeedMetadata[feedURL] {
assert(d.delegate === self)
return d
}
let d = WebFeedMetadata(webFeedID: webFeedID)
let d = WebFeedMetadata(feedID: feedID)
d.delegate = self
webFeedMetadata[feedURL] = d
return d
@@ -1226,9 +1226,9 @@ private extension Account {
func updateFlattenedWebFeeds() {
var feeds = Set<Feed>()
feeds.formUnion(topLevelWebFeeds)
feeds.formUnion(topLevelFeeds)
for folder in folders! {
feeds.formUnion(folder.flattenedWebFeeds())
feeds.formUnion(folder.flattenedFeeds())
}
_flattenedWebFeeds = feeds
@@ -1239,8 +1239,8 @@ private extension Account {
var idDictionary = [String: Feed]()
var externalIDDictionary = [String: Feed]()
flattenedWebFeeds().forEach { (feed) in
idDictionary[feed.webFeedID] = feed
flattenedFeeds().forEach { (feed) in
idDictionary[feed.feedID] = feed
if let externalID = feed.externalID {
externalIDDictionary[externalID] = feed
}
@@ -1256,7 +1256,7 @@ private extension Account {
return
}
var updatedUnreadCount = 0
for feed in flattenedWebFeeds() {
for feed in flattenedFeeds() {
updatedUnreadCount += feed.unreadCount
}
unreadCount = updatedUnreadCount
@@ -1304,7 +1304,7 @@ private extension Account {
}
func fetchUnreadCount(_ feed: Feed, _ completion: VoidCompletionBlock?) {
database.fetchUnreadCount(feed.webFeedID) { result in
database.fetchUnreadCount(feed.feedID) { result in
if let unreadCount = try? result.get() {
feed.unreadCount = unreadCount
}
@@ -1313,7 +1313,7 @@ private extension Account {
}
func fetchUnreadCounts(_ feeds: Set<Feed>, _ completion: VoidCompletionBlock?) {
let webFeedIDs = Set(feeds.map { $0.webFeedID })
let webFeedIDs = Set(feeds.map { $0.feedID })
database.fetchUnreadCounts(for: webFeedIDs) { result in
if let unreadCountDictionary = try? result.get() {
self.processUnreadCounts(unreadCountDictionary: unreadCountDictionary, feeds: feeds)
@@ -1329,7 +1329,7 @@ private extension Account {
completion?()
return
}
self.processUnreadCounts(unreadCountDictionary: unreadCountDictionary, feeds: self.flattenedWebFeeds())
self.processUnreadCounts(unreadCountDictionary: unreadCountDictionary, feeds: self.flattenedFeeds())
self.fetchingAllUnreadCounts = false
self.updateUnreadCount()
@@ -1345,7 +1345,7 @@ private extension Account {
func processUnreadCounts(unreadCountDictionary: UnreadCountDictionary, feeds: Set<Feed>) {
for feed in feeds {
// When the unread count is zero, it wont appear in unreadCountDictionary.
let unreadCount = unreadCountDictionary[feed.webFeedID] ?? 0
let unreadCount = unreadCountDictionary[feed.feedID] ?? 0
feed.unreadCount = unreadCount
}
}
@@ -1410,7 +1410,7 @@ extension Account: OPMLRepresentable {
public func OPMLString(indentLevel: Int, allowCustomAttributes: Bool) -> String {
var s = ""
for feed in topLevelWebFeeds.sorted() {
for feed in topLevelFeeds.sorted() {
s += feed.OPMLString(indentLevel: indentLevel + 1, allowCustomAttributes: allowCustomAttributes)
}
for folder in folders!.sorted() {

View File

@@ -344,7 +344,7 @@ public final class AccountManager: UnreadCountProvider {
public func anyAccountHasFeedWithURL(_ urlString: String) -> Bool {
for account in activeAccounts {
if let _ = account.existingWebFeed(withURL: urlString) {
if let _ = account.existingFeed(withURL: urlString) {
return true
}
}

View File

@@ -358,7 +358,7 @@ final class CloudKitAccountDelegate: AccountDelegate {
return
}
let feedsToRestore = folder.topLevelWebFeeds
let feedsToRestore = folder.topLevelFeeds
refreshProgress.addToNumberOfTasksAndRemaining(1 + feedsToRestore.count)
accountZone.createFolder(name: name) { result in
@@ -371,7 +371,7 @@ final class CloudKitAccountDelegate: AccountDelegate {
let group = DispatchGroup()
for feed in feedsToRestore {
folder.topLevelWebFeeds.remove(feed)
folder.topLevelFeeds.remove(feed)
group.enter()
self.restoreWebFeed(for: account, feed: feed, container: folder) { result in
@@ -485,7 +485,7 @@ private extension CloudKitAccountDelegate {
accountZone.fetchChangesInZone() { result in
self.refreshProgress.completeTask()
let webFeeds = account.flattenedWebFeeds()
let webFeeds = account.flattenedFeeds()
self.refreshProgress.addToNumberOfTasksAndRemaining(webFeeds.count)
switch result {
@@ -518,7 +518,7 @@ private extension CloudKitAccountDelegate {
func standardRefreshAll(for account: Account, completion: @escaping (Result<Void, Error>) -> Void) {
let intialWebFeedsCount = account.flattenedWebFeeds().count
let intialWebFeedsCount = account.flattenedFeeds().count
refreshProgress.addToNumberOfTasksAndRemaining(3 + intialWebFeedsCount)
func fail(_ error: Error) {
@@ -532,7 +532,7 @@ private extension CloudKitAccountDelegate {
case .success:
self.refreshProgress.completeTask()
let webFeeds = account.flattenedWebFeeds()
let webFeeds = account.flattenedFeeds()
self.refreshProgress.addToNumberOfTasksAndRemaining(webFeeds.count - intialWebFeedsCount)
self.refreshArticleStatus(for: account) { result in
@@ -617,7 +617,7 @@ private extension CloudKitAccountDelegate {
return
}
if account.hasWebFeed(withURL: bestFeedSpecifier.urlString) {
if account.hasFeed(withURL: bestFeedSpecifier.urlString) {
self.refreshProgress.completeTasks(4)
completion(.failure(AccountError.createErrorAlreadySubscribed))
return
@@ -706,7 +706,7 @@ private extension CloudKitAccountDelegate {
func processAccountError(_ account: Account, _ error: Error) {
if case CloudKitZoneError.userDeletedZone = error {
account.removeFeeds(account.topLevelWebFeeds)
account.removeFeeds(account.topLevelFeeds)
for folder in account.folders ?? Set<Folder>() {
account.removeFolder(folder)
}

View File

@@ -171,7 +171,7 @@ private extension CloudKitSendStatusOperation {
func processAccountError(_ account: Account, _ error: Error) {
if case CloudKitZoneError.userDeletedZone = error {
account.removeFeeds(account.topLevelWebFeeds)
account.removeFeeds(account.topLevelFeeds)
for folder in account.folders ?? Set<Folder>() {
account.removeFolder(folder)
}

View File

@@ -19,7 +19,7 @@ extension Notification.Name {
public protocol Container: AnyObject, ContainerIdentifiable {
var account: Account? { get }
var topLevelWebFeeds: Set<Feed> { get set }
var topLevelFeeds: Set<Feed> { get set }
var folders: Set<Folder>? { get set }
var externalID: String? { get set }
@@ -33,12 +33,12 @@ public protocol Container: AnyObject, ContainerIdentifiable {
func addWebFeed(_ webFeed: Feed)
//Recursive  checks subfolders
func flattenedWebFeeds() -> Set<Feed>
func flattenedFeeds() -> Set<Feed>
func has(_ webFeed: Feed) -> Bool
func hasWebFeed(with webFeedID: String) -> Bool
func hasWebFeed(withURL url: String) -> Bool
func hasFeed(withURL url: String) -> Bool
func existingWebFeed(withWebFeedID: String) -> Feed?
func existingWebFeed(withURL url: String) -> Feed?
func existingFeed(withURL url: String) -> Feed?
func existingWebFeed(withExternalID externalID: String) -> Feed?
func existingFolder(with name: String) -> Folder?
func existingFolder(withID: Int) -> Folder?
@@ -49,7 +49,7 @@ public protocol Container: AnyObject, ContainerIdentifiable {
public extension Container {
func hasAtLeastOneWebFeed() -> Bool {
return topLevelWebFeeds.count > 0
return topLevelFeeds.count > 0
}
func hasChildFolder(with name: String) -> Bool {
@@ -70,7 +70,7 @@ public extension Container {
func objectIsChild(_ object: AnyObject) -> Bool {
if let feed = object as? Feed {
return topLevelWebFeeds.contains(feed)
return topLevelFeeds.contains(feed)
}
if let folder = object as? Folder {
return folders?.contains(folder) ?? false
@@ -78,12 +78,12 @@ public extension Container {
return false
}
func flattenedWebFeeds() -> Set<Feed> {
func flattenedFeeds() -> Set<Feed> {
var feeds = Set<Feed>()
feeds.formUnion(topLevelWebFeeds)
feeds.formUnion(topLevelFeeds)
if let folders = folders {
for folder in folders {
feeds.formUnion(folder.flattenedWebFeeds())
feeds.formUnion(folder.flattenedFeeds())
}
}
return feeds
@@ -93,25 +93,25 @@ public extension Container {
return existingWebFeed(withWebFeedID: webFeedID) != nil
}
func hasWebFeed(withURL url: String) -> Bool {
return existingWebFeed(withURL: url) != nil
func hasFeed(withURL url: String) -> Bool {
return existingFeed(withURL: url) != nil
}
func has(_ webFeed: Feed) -> Bool {
return flattenedWebFeeds().contains(webFeed)
func has(_ feed: Feed) -> Bool {
return flattenedFeeds().contains(feed)
}
func existingWebFeed(withWebFeedID webFeedID: String) -> Feed? {
for feed in flattenedWebFeeds() {
if feed.webFeedID == webFeedID {
for feed in flattenedFeeds() {
if feed.feedID == webFeedID {
return feed
}
}
return nil
}
func existingWebFeed(withURL url: String) -> Feed? {
for feed in flattenedWebFeeds() {
func existingFeed(withURL url: String) -> Feed? {
for feed in flattenedFeeds() {
if feed.url == url {
return feed
}
@@ -120,7 +120,7 @@ public extension Container {
}
func existingWebFeed(withExternalID externalID: String) -> Feed? {
for feed in flattenedWebFeeds() {
for feed in flattenedFeeds() {
if feed.externalID == externalID {
return feed
}

View File

@@ -22,18 +22,18 @@ public final class Feed: SidebarItem, Renamable, Hashable {
assertionFailure("Expected feed.account, but got nil.")
return nil
}
return SidebarItemIdentifier.webFeed(accountID, webFeedID)
return SidebarItemIdentifier.webFeed(accountID, feedID)
}
public weak var account: Account?
public let url: String
public var webFeedID: String {
public var feedID: String {
get {
return metadata.webFeedID
return metadata.feedID
}
set {
metadata.webFeedID = newValue
metadata.feedID = newValue
}
}
@@ -264,13 +264,13 @@ public final class Feed: SidebarItem, Renamable, Hashable {
// MARK: - Hashable
public func hash(into hasher: inout Hasher) {
hasher.combine(webFeedID)
hasher.combine(feedID)
}
// MARK: - Equatable
public class func ==(lhs: Feed, rhs: Feed) -> Bool {
return lhs.webFeedID == rhs.webFeedID && lhs.accountID == rhs.accountID
return lhs.feedID == rhs.feedID && lhs.accountID == rhs.accountID
}
}
@@ -307,7 +307,7 @@ extension Feed: OPMLRepresentable {
extension Set where Element == Feed {
func webFeedIDs() -> Set<String> {
return Set<String>(map { $0.webFeedID })
return Set<String>(map { $0.feedID })
}
func sorted() -> Array<Feed> {

View File

@@ -173,7 +173,7 @@ final class FeedWranglerAPICaller: NSObject {
let queryItems = [
URLQueryItem(name: "read", value: "false"),
URLQueryItem(name: "offset", value: String(page * FeedWranglerConfig.pageSize)),
feed.map { URLQueryItem(name: "feed_id", value: $0.webFeedID) }
feed.map { URLQueryItem(name: "feed_id", value: $0.feedID) }
].compactMap { $0 }
let url = FeedWranglerConfig.clientURL
.appendingPathComponent("feed_items/list")

View File

@@ -340,7 +340,7 @@ final class FeedWranglerAccountDelegate: AccountDelegate {
DispatchQueue.main.async {
let feed = account.createWebFeed(with: sub.title, url: sub.feedURL, webFeedID: String(sub.feedID), homePageURL: sub.siteURL)
account.addWebFeed(feed, to: container) { result in
account.addFeed(feed, to: container) { result in
switch result {
case .success:
if let name = name {
@@ -388,7 +388,7 @@ final class FeedWranglerAccountDelegate: AccountDelegate {
self.refreshCredentials(for: account) {
self.refreshProgress.completeTask()
self.caller.renameSubscription(feedID: feed.webFeedID, newName: name) { result in
self.caller.renameSubscription(feedID: feed.feedID, newName: name) { result in
self.refreshProgress.completeTask()
switch result {
@@ -421,7 +421,7 @@ final class FeedWranglerAccountDelegate: AccountDelegate {
self.refreshCredentials(for: account) {
self.refreshProgress.completeTask()
self.caller.removeSubscription(feedID: feed.webFeedID) { result in
self.caller.removeSubscription(feedID: feed.feedID) { result in
self.refreshProgress.completeTask()
switch result {
@@ -447,8 +447,8 @@ final class FeedWranglerAccountDelegate: AccountDelegate {
}
func restoreWebFeed(for account: Account, feed: Feed, container: Container, completion: @escaping (Result<Void, Error>) -> Void) {
if let existingFeed = account.existingWebFeed(withURL: feed.url) {
account.addWebFeed(existingFeed, to: container) { result in
if let existingFeed = account.existingFeed(withURL: feed.url) {
account.addFeed(existingFeed, to: container) { result in
switch result {
case .success:
completion(.success(()))
@@ -533,7 +533,7 @@ private extension FeedWranglerAccountDelegate {
assert(Thread.isMainThread)
let feedIds = subscriptions.map { String($0.feedID) }
let feedsToRemove = account.topLevelWebFeeds.filter { !feedIds.contains($0.webFeedID) }
let feedsToRemove = account.topLevelFeeds.filter { !feedIds.contains($0.feedID) }
account.removeFeeds(feedsToRemove)
var subscriptionsToAdd = Set<FeedWranglerSubscription>()

View File

@@ -336,7 +336,7 @@ final class FeedbinAccountDelegate: AccountDelegate {
let group = DispatchGroup()
for feed in folder.topLevelWebFeeds {
for feed in folder.topLevelFeeds {
if feed.folderRelationship?.count ?? 0 > 1 {
@@ -472,7 +472,7 @@ final class FeedbinAccountDelegate: AccountDelegate {
func addWebFeed(for account: Account, with feed: Feed, to container: Container, completion: @escaping (Result<Void, Error>) -> Void) {
if let folder = container as? Folder, let webFeedID = Int(feed.webFeedID) {
if let folder = container as? Folder, let webFeedID = Int(feed.feedID) {
refreshProgress.addToNumberOfTasksAndRemaining(1)
caller.createTagging(webFeedID: webFeedID, name: folder.name ?? "") { result in
self.refreshProgress.completeTask()
@@ -504,8 +504,8 @@ final class FeedbinAccountDelegate: AccountDelegate {
func restoreWebFeed(for account: Account, feed: Feed, container: Container, completion: @escaping (Result<Void, Error>) -> Void) {
if let existingFeed = account.existingWebFeed(withURL: feed.url) {
account.addWebFeed(existingFeed, to: container) { result in
if let existingFeed = account.existingFeed(withURL: feed.url) {
account.addFeed(existingFeed, to: container) { result in
switch result {
case .success:
completion(.success(()))
@@ -530,9 +530,9 @@ final class FeedbinAccountDelegate: AccountDelegate {
let group = DispatchGroup()
for feed in folder.topLevelWebFeeds {
for feed in folder.topLevelFeeds {
folder.topLevelWebFeeds.remove(feed)
folder.topLevelFeeds.remove(feed)
group.enter()
restoreWebFeed(for: account, feed: feed, container: folder) { result in
@@ -780,7 +780,7 @@ private extension FeedbinAccountDelegate {
if let folders = account.folders {
folders.forEach { folder in
if !tagNames.contains(folder.name ?? "") {
for feed in folder.topLevelWebFeeds {
for feed in folder.topLevelFeeds {
account.addWebFeed(feed)
clearFolderRelationship(for: feed, withFolderName: folder.name ?? "")
}
@@ -818,16 +818,16 @@ private extension FeedbinAccountDelegate {
// Remove any feeds that are no longer in the subscriptions
if let folders = account.folders {
for folder in folders {
for feed in folder.topLevelWebFeeds {
if !subFeedIds.contains(feed.webFeedID) {
for feed in folder.topLevelFeeds {
if !subFeedIds.contains(feed.feedID) {
folder.removeWebFeed(feed)
}
}
}
}
for feed in account.topLevelWebFeeds {
if !subFeedIds.contains(feed.webFeedID) {
for feed in account.topLevelFeeds {
if !subFeedIds.contains(feed.feedID) {
account.removeWebFeed(feed)
}
}
@@ -888,8 +888,8 @@ private extension FeedbinAccountDelegate {
let taggingFeedIDs = groupedTaggings.map { String($0.feedID) }
// Move any feeds not in the folder to the account
for feed in folder.topLevelWebFeeds {
if !taggingFeedIDs.contains(feed.webFeedID) {
for feed in folder.topLevelFeeds {
if !taggingFeedIDs.contains(feed.feedID) {
folder.removeWebFeed(feed)
clearFolderRelationship(for: feed, withFolderName: folder.name ?? "")
account.addWebFeed(feed)
@@ -897,7 +897,7 @@ private extension FeedbinAccountDelegate {
}
// Add any feeds not in the folder
let folderFeedIds = folder.topLevelWebFeeds.map { $0.webFeedID }
let folderFeedIds = folder.topLevelFeeds.map { $0.feedID }
for tagging in groupedTaggings {
let taggingFeedID = String(tagging.feedID)
@@ -915,8 +915,8 @@ private extension FeedbinAccountDelegate {
let taggedFeedIDs = Set(taggings.map { String($0.feedID) })
// Remove all feeds from the account container that have a tag
for feed in account.topLevelWebFeeds {
if taggedFeedIDs.contains(feed.webFeedID) {
for feed in account.topLevelFeeds {
if taggedFeedIDs.contains(feed.feedID) {
account.removeWebFeed(feed)
}
}
@@ -980,7 +980,7 @@ private extension FeedbinAccountDelegate {
}
func renameFolderRelationship(for account: Account, fromName: String, toName: String) {
for feed in account.flattenedWebFeeds() {
for feed in account.flattenedFeeds() {
if var folderRelationship = feed.folderRelationship {
let relationship = folderRelationship[fromName]
folderRelationship[fromName] = nil
@@ -1034,7 +1034,7 @@ private extension FeedbinAccountDelegate {
feed.iconURL = sub.jsonFeed?.icon
feed.faviconURL = sub.jsonFeed?.favicon
account.addWebFeed(feed, to: container) { result in
account.addFeed(feed, to: container) { result in
switch result {
case .success:
if let name = name {
@@ -1064,7 +1064,7 @@ private extension FeedbinAccountDelegate {
refreshProgress.addToNumberOfTasksAndRemaining(4)
// Download the initial articles
self.caller.retrieveEntries(feedID: feed.webFeedID) { result in
self.caller.retrieveEntries(feedID: feed.feedID) { result in
self.refreshProgress.completeTask()
switch result {

View File

@@ -354,7 +354,7 @@ final class FeedlyAccountDelegate: AccountDelegate {
return
}
let feedId = FeedlyFeedResourceId(id: feed.webFeedID)
let feedId = FeedlyFeedResourceId(id: feed.feedID)
let editedNameBefore = feed.editedName
// Adding an existing feed updates it.
@@ -381,7 +381,7 @@ final class FeedlyAccountDelegate: AccountDelegate {
throw FeedlyAccountDelegateError.notLoggedIn
}
let resource = FeedlyFeedResourceId(id: feed.webFeedID)
let resource = FeedlyFeedResourceId(id: feed.feedID)
let addExistingFeed = try FeedlyAddExistingFeedOperation(account: account,
credentials: credentials,
resource: resource,
@@ -412,7 +412,7 @@ final class FeedlyAccountDelegate: AccountDelegate {
}
}
caller.removeFeed(feed.webFeedID, fromCollectionWith: collectionId) { result in
caller.removeFeed(feed.feedID, fromCollectionWith: collectionId) { result in
switch result {
case .success:
completion(.success(()))
@@ -459,8 +459,8 @@ final class FeedlyAccountDelegate: AccountDelegate {
}
func restoreWebFeed(for account: Account, feed: Feed, container: Container, completion: @escaping (Result<Void, Error>) -> Void) {
if let existingFeed = account.existingWebFeed(withURL: feed.url) {
account.addWebFeed(existingFeed, to: container) { result in
if let existingFeed = account.existingFeed(withURL: feed.url) {
account.addFeed(existingFeed, to: container) { result in
switch result {
case .success:
completion(.success(()))
@@ -483,9 +483,9 @@ final class FeedlyAccountDelegate: AccountDelegate {
func restoreFolder(for account: Account, folder: Folder, completion: @escaping (Result<Void, Error>) -> Void) {
let group = DispatchGroup()
for feed in folder.topLevelWebFeeds {
for feed in folder.topLevelFeeds {
folder.topLevelWebFeeds.remove(feed)
folder.topLevelFeeds.remove(feed)
group.enter()
restoreWebFeed(for: account, feed: feed, container: folder) { result in

View File

@@ -31,13 +31,13 @@ final class FeedlyCreateFeedsForCollectionFoldersOperation: FeedlyOperation {
let feedsBefore = Set(pairs
.map { $0.1 }
.flatMap { $0.topLevelWebFeeds })
.flatMap { $0.topLevelFeeds })
// Remove feeds in a folder which are not in the corresponding collection.
for (collectionFeeds, folder) in pairs {
let feedsInFolder = folder.topLevelWebFeeds
let feedsInFolder = folder.topLevelFeeds
let feedsInCollection = Set(collectionFeeds.map { $0.id })
let feedsToRemove = feedsInFolder.filter { !feedsInCollection.contains($0.webFeedID) }
let feedsToRemove = feedsInFolder.filter { !feedsInCollection.contains($0.feedID) }
if !feedsToRemove.isEmpty {
folder.removeFeeds(feedsToRemove)
// os_log(.debug, log: log, "\"%@\" - removed: %@", collection.label, feedsToRemove.map { $0.feedID }, feedsInCollection)
@@ -76,7 +76,7 @@ final class FeedlyCreateFeedsForCollectionFoldersOperation: FeedlyOperation {
return (feed, folder)
} else {
// find an existing feed we created below in an earlier value
for feed in feedsAdded where feed.webFeedID == collectionFeed.id {
for feed in feedsAdded where feed.feedID == collectionFeed.id {
return (feed, folder)
}
}

View File

@@ -33,7 +33,7 @@ public final class Folder: SidebarItem, Renamable, Container, Hashable {
}
public weak var account: Account?
public var topLevelWebFeeds: Set<Feed> = Set<Feed>()
public var topLevelFeeds: Set<Feed> = Set<Feed>()
public var folders: Set<Folder>? = nil // subfolders are not supported, so this is always nil
public var name: String? {
@@ -100,9 +100,9 @@ public final class Folder: SidebarItem, Renamable, Container, Hashable {
// MARK: Container
public func flattenedWebFeeds() -> Set<Feed> {
public func flattenedFeeds() -> Set<Feed> {
// Since sub-folders are not supported, its always the top-level feeds.
return topLevelWebFeeds
return topLevelFeeds
}
public func objectIsChild(_ object: AnyObject) -> Bool {
@@ -110,11 +110,11 @@ public final class Folder: SidebarItem, Renamable, Container, Hashable {
guard let feed = object as? Feed else {
return false
}
return topLevelWebFeeds.contains(feed)
return topLevelFeeds.contains(feed)
}
public func addWebFeed(_ feed: Feed) {
topLevelWebFeeds.insert(feed)
topLevelFeeds.insert(feed)
postChildrenDidChangeNotification()
}
@@ -122,12 +122,12 @@ public final class Folder: SidebarItem, Renamable, Container, Hashable {
guard !feeds.isEmpty else {
return
}
topLevelWebFeeds.formUnion(feeds)
topLevelFeeds.formUnion(feeds)
postChildrenDidChangeNotification()
}
public func removeWebFeed(_ feed: Feed) {
topLevelWebFeeds.remove(feed)
topLevelFeeds.remove(feed)
postChildrenDidChangeNotification()
}
@@ -135,7 +135,7 @@ public final class Folder: SidebarItem, Renamable, Container, Hashable {
guard !feeds.isEmpty else {
return
}
topLevelWebFeeds.subtract(feeds)
topLevelFeeds.subtract(feeds)
postChildrenDidChangeNotification()
}
@@ -158,14 +158,14 @@ private extension Folder {
func updateUnreadCount() {
var updatedUnreadCount = 0
for feed in topLevelWebFeeds {
for feed in topLevelFeeds {
updatedUnreadCount += feed.unreadCount
}
unreadCount = updatedUnreadCount
}
func childrenContain(_ feed: Feed) -> Bool {
return topLevelWebFeeds.contains(feed)
return topLevelFeeds.contains(feed)
}
}
@@ -189,7 +189,7 @@ extension Folder: OPMLRepresentable {
var hasAtLeastOneChild = false
for feed in topLevelWebFeeds.sorted() {
for feed in topLevelFeeds.sorted() {
s += feed.OPMLString(indentLevel: indentLevel + 1, allowCustomAttributes: allowCustomAttributes)
hasAtLeastOneChild = true
}

View File

@@ -50,7 +50,7 @@ final class LocalAccountDelegate: AccountDelegate {
return
}
let webFeeds = account.flattenedWebFeeds()
let webFeeds = account.flattenedFeeds()
refreshProgress.addToNumberOfTasksAndRemaining(webFeeds.count)
let group = DispatchGroup()
@@ -250,7 +250,7 @@ private extension LocalAccountDelegate {
return
}
if account.hasWebFeed(withURL: bestFeedSpecifier.urlString) {
if account.hasFeed(withURL: bestFeedSpecifier.urlString) {
self.refreshProgress.completeTask()
BatchUpdate.shared.end()
completion(.failure(AccountError.createErrorAlreadySubscribed))

View File

@@ -47,7 +47,7 @@ extension NewsBlurAccountDelegate {
if let folders = account.folders {
folders.forEach { folder in
if !folderNames.contains(folder.name ?? "") {
for feed in folder.topLevelWebFeeds {
for feed in folder.topLevelFeeds {
account.addWebFeed(feed)
clearFolderRelationship(for: feed, withFolderName: folder.name ?? "")
}
@@ -84,16 +84,16 @@ extension NewsBlurAccountDelegate {
// Remove any feeds that are no longer in the subscriptions
if let folders = account.folders {
for folder in folders {
for feed in folder.topLevelWebFeeds {
if !newsBlurFeedIds.contains(feed.webFeedID) {
for feed in folder.topLevelFeeds {
if !newsBlurFeedIds.contains(feed.feedID) {
folder.removeWebFeed(feed)
}
}
}
}
for feed in account.topLevelWebFeeds {
if !newsBlurFeedIds.contains(feed.webFeedID) {
for feed in account.topLevelFeeds {
if !newsBlurFeedIds.contains(feed.feedID) {
account.removeWebFeed(feed)
}
}
@@ -155,8 +155,8 @@ extension NewsBlurAccountDelegate {
guard let folder = folderDict[folderName] else { return }
// Move any feeds not in the folder to the account
for feed in folder.topLevelWebFeeds {
if !newsBlurFolderFeedIDs.contains(feed.webFeedID) {
for feed in folder.topLevelFeeds {
if !newsBlurFolderFeedIDs.contains(feed.feedID) {
folder.removeWebFeed(feed)
clearFolderRelationship(for: feed, withFolderName: folder.name ?? "")
account.addWebFeed(feed)
@@ -164,7 +164,7 @@ extension NewsBlurAccountDelegate {
}
// Add any feeds not in the folder
let folderFeedIds = folder.topLevelWebFeeds.map { $0.webFeedID }
let folderFeedIds = folder.topLevelFeeds.map { $0.feedID }
for relationship in folderRelationships {
let folderFeedID = String(relationship.feedID)
@@ -182,13 +182,13 @@ extension NewsBlurAccountDelegate {
// in folders and we need to remove them all from the account level.
if let folderRelationships = newsBlurFolderDict[" "] {
let newsBlurFolderFeedIDs = folderRelationships.map { String($0.feedID) }
for feed in account.topLevelWebFeeds {
if !newsBlurFolderFeedIDs.contains(feed.webFeedID) {
for feed in account.topLevelFeeds {
if !newsBlurFolderFeedIDs.contains(feed.feedID) {
account.removeWebFeed(feed)
}
}
} else {
for feed in account.topLevelWebFeeds {
for feed in account.topLevelFeeds {
account.removeWebFeed(feed)
}
}
@@ -423,7 +423,7 @@ extension NewsBlurAccountDelegate {
webFeed.externalID = String(feed.feedID)
webFeed.faviconURL = feed.faviconURL
account.addWebFeed(webFeed, to: container) { result in
account.addFeed(webFeed, to: container) { result in
switch result {
case .success:
if let name = name {
@@ -448,7 +448,7 @@ extension NewsBlurAccountDelegate {
func downloadFeed(account: Account, feed: Feed, page: Int, completion: @escaping (Result<Void, Error>) -> Void) {
refreshProgress.addToNumberOfTasksAndRemaining(1)
caller.retrieveStories(feedID: feed.webFeedID, page: page) { result in
caller.retrieveStories(feedID: feed.feedID, page: page) { result in
switch result {
case .success((let stories, _)):
// No more stories
@@ -529,7 +529,7 @@ extension NewsBlurAccountDelegate {
switch result {
case .success:
DispatchQueue.main.async {
let feedID = feed.webFeedID
let feedID = feed.feedID
if folderName == nil {
account.removeWebFeed(feed)

View File

@@ -400,7 +400,7 @@ final class NewsBlurAccountDelegate: AccountDelegate {
}
var feedIDs: [String] = []
for feed in folder.topLevelWebFeeds {
for feed in folder.topLevelFeeds {
if (feed.folderRelationship?.count ?? 0) > 1 {
clearFolderRelationship(for: feed, withFolderName: folderToRemove)
} else if let feedID = feed.externalID {
@@ -520,8 +520,8 @@ final class NewsBlurAccountDelegate: AccountDelegate {
}
func restoreWebFeed(for account: Account, feed: Feed, container: Container, completion: @escaping (Result<Void, Error>) -> ()) {
if let existingFeed = account.existingWebFeed(withURL: feed.url) {
account.addWebFeed(existingFeed, to: container) { result in
if let existingFeed = account.existingFeed(withURL: feed.url) {
account.addFeed(existingFeed, to: container) { result in
switch result {
case .success:
completion(.success(()))
@@ -548,9 +548,9 @@ final class NewsBlurAccountDelegate: AccountDelegate {
}
var feedsToRestore: [Feed] = []
for feed in folder.topLevelWebFeeds {
for feed in folder.topLevelFeeds {
feedsToRestore.append(feed)
folder.topLevelWebFeeds.remove(feed)
folder.topLevelFeeds.remove(feed)
}
let group = DispatchGroup()

View File

@@ -326,7 +326,7 @@ final class ReaderAPIAccountDelegate: AccountDelegate {
let group = DispatchGroup()
for feed in folder.topLevelWebFeeds {
for feed in folder.topLevelFeeds {
if feed.folderRelationship?.count ?? 0 > 1 {
@@ -556,8 +556,8 @@ final class ReaderAPIAccountDelegate: AccountDelegate {
func restoreWebFeed(for account: Account, feed: Feed, container: Container, completion: @escaping (Result<Void, Error>) -> Void) {
if let existingFeed = account.existingWebFeed(withURL: feed.url) {
account.addWebFeed(existingFeed, to: container) { result in
if let existingFeed = account.existingFeed(withURL: feed.url) {
account.addFeed(existingFeed, to: container) { result in
switch result {
case .success:
completion(.success(()))
@@ -582,9 +582,9 @@ final class ReaderAPIAccountDelegate: AccountDelegate {
let group = DispatchGroup()
for feed in folder.topLevelWebFeeds {
for feed in folder.topLevelFeeds {
folder.topLevelWebFeeds.remove(feed)
folder.topLevelFeeds.remove(feed)
group.enter()
restoreWebFeed(for: account, feed: feed, container: folder) { result in
@@ -719,7 +719,7 @@ private extension ReaderAPIAccountDelegate {
if let folders = account.folders {
folders.forEach { folder in
if !readerFolderExternalIDs.contains(folder.externalID ?? "") {
for feed in folder.topLevelWebFeeds {
for feed in folder.topLevelFeeds {
account.addWebFeed(feed)
clearFolderRelationship(for: feed, folderExternalID: folder.externalID)
}
@@ -758,16 +758,16 @@ private extension ReaderAPIAccountDelegate {
// Remove any feeds that are no longer in the subscriptions
if let folders = account.folders {
for folder in folders {
for feed in folder.topLevelWebFeeds {
if !subFeedIds.contains(feed.webFeedID) {
for feed in folder.topLevelFeeds {
if !subFeedIds.contains(feed.feedID) {
folder.removeWebFeed(feed)
}
}
}
}
for feed in account.topLevelWebFeeds {
if !subFeedIds.contains(feed.webFeedID) {
for feed in account.topLevelFeeds {
if !subFeedIds.contains(feed.feedID) {
account.clearWebFeedMetadata(feed)
account.removeWebFeed(feed)
}
@@ -818,8 +818,8 @@ private extension ReaderAPIAccountDelegate {
let taggingFeedIDs = groupedTaggings.map { $0.feedID }
// Move any feeds not in the folder to the account
for feed in folder.topLevelWebFeeds {
if !taggingFeedIDs.contains(feed.webFeedID) {
for feed in folder.topLevelFeeds {
if !taggingFeedIDs.contains(feed.feedID) {
folder.removeWebFeed(feed)
clearFolderRelationship(for: feed, folderExternalID: folder.externalID)
account.addWebFeed(feed)
@@ -827,7 +827,7 @@ private extension ReaderAPIAccountDelegate {
}
// Add any feeds not in the folder
let folderFeedIds = folder.topLevelWebFeeds.map { $0.webFeedID }
let folderFeedIds = folder.topLevelFeeds.map { $0.feedID }
for subscription in groupedTaggings {
let taggingFeedID = subscription.feedID
@@ -845,8 +845,8 @@ private extension ReaderAPIAccountDelegate {
let taggedFeedIDs = Set(subscriptions.filter({ !$0.categories.isEmpty }).map { String($0.feedID) })
// Remove all feeds from the account container that have a tag
for feed in account.topLevelWebFeeds {
if taggedFeedIDs.contains(feed.webFeedID) {
for feed in account.topLevelFeeds {
if taggedFeedIDs.contains(feed.feedID) {
account.removeWebFeed(feed)
}
}
@@ -924,7 +924,7 @@ private extension ReaderAPIAccountDelegate {
let feed = account.createWebFeed(with: sub.name, url: sub.url, webFeedID: String(sub.feedID), homePageURL: sub.homePageURL)
feed.externalID = String(sub.feedID)
account.addWebFeed(feed, to: container) { result in
account.addFeed(feed, to: container) { result in
switch result {
case .success:
if let name = name {
@@ -952,7 +952,7 @@ private extension ReaderAPIAccountDelegate {
refreshProgress.addToNumberOfTasksAndRemaining(5)
// Download the initial articles
self.caller.retrieveItemIDs(type: .allForFeed, webFeedID: feed.webFeedID) { result in
self.caller.retrieveItemIDs(type: .allForFeed, webFeedID: feed.feedID) { result in
self.refreshProgress.completeTask()
switch result {
case .success(let articleIDs):

View File

@@ -17,7 +17,7 @@ protocol WebFeedMetadataDelegate: AnyObject {
final class WebFeedMetadata: Codable {
enum CodingKeys: String, CodingKey {
case webFeedID = "feedID"
case feedID
case homePageURL
case iconURL
case faviconURL
@@ -32,10 +32,10 @@ final class WebFeedMetadata: Codable {
case folderRelationship
}
var webFeedID: String {
var feedID: String {
didSet {
if webFeedID != oldValue {
valueDidChange(.webFeedID)
if feedID != oldValue {
valueDidChange(.feedID)
}
}
}
@@ -139,8 +139,8 @@ final class WebFeedMetadata: Codable {
weak var delegate: WebFeedMetadataDelegate?
init(webFeedID: String) {
self.webFeedID = webFeedID
init(feedID: String) {
self.feedID = feedID
}
func valueDidChange(_ key: CodingKeys) {

View File

@@ -75,7 +75,7 @@ private extension WebFeedMetadataFile {
private func metadataForOnlySubscribedToFeeds() -> Account.WebFeedMetadataDictionary {
let webFeedIDs = account.idToWebFeedDictionary.keys
return account.webFeedMetadata.filter { (feedID: String, metadata: WebFeedMetadata) -> Bool in
return webFeedIDs.contains(metadata.webFeedID)
return webFeedIDs.contains(metadata.feedID)
}
}