From ae2ffed911ed4069221659bc5ad1ff13f7e42caa Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Thu, 14 Sep 2023 22:41:16 -0700 Subject: [PATCH] Continue renaming Id to ID in Feedly code. --- .../Feedly/FeedlyAccountDelegate.swift | 2 +- ...edlyIngestStarredArticleIdsOperation.swift | 30 +++++++++---------- ...lyOrganiseParsedItemsByFeedOperation.swift | 10 +++---- .../FeedlySendArticleStatusesOperation.swift | 6 ++-- .../Operations/FeedlySyncAllOperation.swift | 2 +- ...UpdateAccountFeedsWithItemsOperation.swift | 2 +- 6 files changed, 26 insertions(+), 26 deletions(-) diff --git a/Account/Sources/Account/Feedly/FeedlyAccountDelegate.swift b/Account/Sources/Account/Feedly/FeedlyAccountDelegate.swift index c10addea2..ed5263d21 100644 --- a/Account/Sources/Account/Feedly/FeedlyAccountDelegate.swift +++ b/Account/Sources/Account/Feedly/FeedlyAccountDelegate.swift @@ -195,7 +195,7 @@ final class FeedlyAccountDelegate: AccountDelegate, Logging { } - let ingestStarred = FeedlyIngestStarredArticleIdsOperation(account: account, userId: credentials.username, service: caller, database: database, newerThan: nil) + let ingestStarred = FeedlyIngestStarredArticleIDsOperation(account: account, userId: credentials.username, service: caller, database: database, newerThan: nil) group.enter() ingestStarred.completionBlock = { _ in diff --git a/Account/Sources/Account/Feedly/Operations/FeedlyIngestStarredArticleIdsOperation.swift b/Account/Sources/Account/Feedly/Operations/FeedlyIngestStarredArticleIdsOperation.swift index 72cb20cb5..0c38db4bb 100644 --- a/Account/Sources/Account/Feedly/Operations/FeedlyIngestStarredArticleIdsOperation.swift +++ b/Account/Sources/Account/Feedly/Operations/FeedlyIngestStarredArticleIdsOperation.swift @@ -1,5 +1,5 @@ // -// FeedlyIngestStarredArticleIdsOperation.swift +// FeedlyIngestStarredArticleIDsOperation.swift // Account // // Created by Kiel Gillard on 15/10/19. @@ -17,13 +17,13 @@ import Secrets /// When all the article ids are collected, a status is created for each. /// The article ids previously marked as starred but not collected become unstarred. /// So this operation has side effects *for the entire account* it operates on. -final class FeedlyIngestStarredArticleIdsOperation: FeedlyOperation, Logging { +final class FeedlyIngestStarredArticleIDsOperation: FeedlyOperation, Logging { private let account: Account private let resource: FeedlyResourceID private let service: FeedlyGetStreamIDsService private let database: SyncDatabase - private var remoteEntryIds = Set() + private var remoteEntryIDs = Set() convenience init(account: Account, userId: String, service: FeedlyGetStreamIDsService, database: SyncDatabase, newerThan: Date?) { let resource = FeedlyTagResourceID.Global.saved(for: userId) @@ -38,30 +38,30 @@ final class FeedlyIngestStarredArticleIdsOperation: FeedlyOperation, Logging { } override func run() { - getStreamIds(nil) + getStreamIDs(nil) } - private func getStreamIds(_ continuation: String?) { - service.streamIDs(for: resource, continuation: continuation, newerThan: nil, unreadOnly: nil, completion: didGetStreamIds(_:)) + private func getStreamIDs(_ continuation: String?) { + service.streamIDs(for: resource, continuation: continuation, newerThan: nil, unreadOnly: nil, completion: didGetStreamIDs(_:)) } - private func didGetStreamIds(_ result: Result) { + private func didGetStreamIDs(_ result: Result) { guard !isCanceled else { didFinish() return } switch result { - case .success(let streamIds): + case .success(let streamIDs): - remoteEntryIds.formUnion(streamIds.ids) + remoteEntryIDs.formUnion(streamIDs.ids) - guard let continuation = streamIds.continuation else { - removeEntryIdsWithPendingStatus() + guard let continuation = streamIDs.continuation else { + removeEntryIDsWithPendingStatus() return } - getStreamIds(continuation) + getStreamIDs(continuation) case .failure(let error): didFinish(with: error) @@ -69,7 +69,7 @@ final class FeedlyIngestStarredArticleIdsOperation: FeedlyOperation, Logging { } /// Do not override pending statuses with the remote statuses of the same articles, otherwise an article will temporarily re-acquire the remote status before the pending status is pushed and subseqently pulled. - private func removeEntryIdsWithPendingStatus() { + private func removeEntryIDsWithPendingStatus() { guard !isCanceled else { didFinish() return @@ -78,7 +78,7 @@ final class FeedlyIngestStarredArticleIdsOperation: FeedlyOperation, Logging { Task { @MainActor in do { let pendingArticleIDs = try await database.selectPendingStarredArticleIDs() - self.remoteEntryIds.subtract(pendingArticleIDs) + self.remoteEntryIDs.subtract(pendingArticleIDs) self.updateStarredStatuses() } catch { self.didFinish(with: error) @@ -115,7 +115,7 @@ final class FeedlyIngestStarredArticleIdsOperation: FeedlyOperation, Logging { return } - let remoteStarredArticleIDs = remoteEntryIds + let remoteStarredArticleIDs = remoteEntryIDs let group = DispatchGroup() diff --git a/Account/Sources/Account/Feedly/Operations/FeedlyOrganiseParsedItemsByFeedOperation.swift b/Account/Sources/Account/Feedly/Operations/FeedlyOrganiseParsedItemsByFeedOperation.swift index 7923416d7..91d161f5e 100644 --- a/Account/Sources/Account/Feedly/Operations/FeedlyOrganiseParsedItemsByFeedOperation.swift +++ b/Account/Sources/Account/Feedly/Operations/FeedlyOrganiseParsedItemsByFeedOperation.swift @@ -12,7 +12,7 @@ import RSCore protocol FeedlyParsedItemsByFeedProviding { var parsedItemsByFeedProviderName: String { get } - var parsedItemsKeyedByFeedId: [String: Set] { get } + var parsedItemsKeyedByFeedID: [String: Set] { get } } /// Group articles by their feeds. @@ -25,12 +25,12 @@ final class FeedlyOrganiseParsedItemsByFeedOperation: FeedlyOperation, FeedlyPar return name ?? String(describing: Self.self) } - var parsedItemsKeyedByFeedId: [String : Set] { + var parsedItemsKeyedByFeedID: [String : Set] { precondition(Thread.isMainThread) // Needs to be on main thread because Feed is a main-thread-only model type. - return itemsKeyedByFeedId + return itemsKeyedByFeedID } - private var itemsKeyedByFeedId = [String: Set]() + private var itemsKeyedByFeedID = [String: Set]() init(account: Account, parsedItemProvider: FeedlyParsedItemProviding) { self.account = account @@ -60,6 +60,6 @@ final class FeedlyOrganiseParsedItemsByFeedOperation: FeedlyOperation, FeedlyPar self.logger.debug("Grouped \(items.count, privacy: .public) items by \(dict.count, privacy: .public) feeds for \(self.parsedItemProvider.parsedItemProviderName, privacy: .public).") - itemsKeyedByFeedId = dict + itemsKeyedByFeedID = dict } } diff --git a/Account/Sources/Account/Feedly/Operations/FeedlySendArticleStatusesOperation.swift b/Account/Sources/Account/Feedly/Operations/FeedlySendArticleStatusesOperation.swift index dfa69095d..c381d7229 100644 --- a/Account/Sources/Account/Feedly/Operations/FeedlySendArticleStatusesOperation.swift +++ b/Account/Sources/Account/Feedly/Operations/FeedlySendArticleStatusesOperation.swift @@ -50,12 +50,12 @@ private extension FeedlySendArticleStatusesOperation { let group = DispatchGroup() for pairing in statuses { - let articleIds = pending.filter { $0.key == pairing.status && $0.flag == pairing.flag } - guard !articleIds.isEmpty else { + let articleIDs = pending.filter { $0.key == pairing.status && $0.flag == pairing.flag } + guard !articleIDs.isEmpty else { continue } - let ids = Set(articleIds.map { $0.articleID }) + let ids = Set(articleIDs.map { $0.articleID }) let database = self.database group.enter() service.mark(ids, as: pairing.action) { result in diff --git a/Account/Sources/Account/Feedly/Operations/FeedlySyncAllOperation.swift b/Account/Sources/Account/Feedly/Operations/FeedlySyncAllOperation.swift index 25c265e54..3c25e37f2 100644 --- a/Account/Sources/Account/Feedly/Operations/FeedlySyncAllOperation.swift +++ b/Account/Sources/Account/Feedly/Operations/FeedlySyncAllOperation.swift @@ -87,7 +87,7 @@ final class FeedlySyncAllOperation: FeedlyOperation, Logging { self.operationQueue.add(getUpdated) // Get each page of the article ids for starred articles. - let getStarred = FeedlyIngestStarredArticleIdsOperation(account: account, userId: feedlyUserID, service: getStarredService, database: database, newerThan: nil) + let getStarred = FeedlyIngestStarredArticleIDsOperation(account: account, userId: feedlyUserID, service: getStarredService, database: database, newerThan: nil) getStarred.delegate = self getStarred.downloadProgress = downloadProgress getStarred.addDependency(createFeedsOperation) diff --git a/Account/Sources/Account/Feedly/Operations/FeedlyUpdateAccountFeedsWithItemsOperation.swift b/Account/Sources/Account/Feedly/Operations/FeedlyUpdateAccountFeedsWithItemsOperation.swift index 758564a68..957de5160 100644 --- a/Account/Sources/Account/Feedly/Operations/FeedlyUpdateAccountFeedsWithItemsOperation.swift +++ b/Account/Sources/Account/Feedly/Operations/FeedlyUpdateAccountFeedsWithItemsOperation.swift @@ -22,7 +22,7 @@ final class FeedlyUpdateAccountFeedsWithItemsOperation: FeedlyOperation, Logging } override func run() { - let feedIDsAndItems = organisedItemsProvider.parsedItemsKeyedByFeedId + let feedIDsAndItems = organisedItemsProvider.parsedItemsKeyedByFeedID account.update(feedIDsAndItems: feedIDsAndItems, defaultRead: true) { databaseError in if let error = databaseError {