mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Continue renaming Id to ID in Feedly code.
This commit is contained in:
@@ -132,7 +132,7 @@ final class FeedlyAPICaller {
|
||||
}
|
||||
}
|
||||
|
||||
func importOpml(_ opmlData: Data, completion: @escaping (Result<Void, Error>) -> ()) {
|
||||
func importOPML(_ opmlData: Data, completion: @escaping (Result<Void, Error>) -> ()) {
|
||||
guard !isSuspended else {
|
||||
return DispatchQueue.main.async {
|
||||
completion(.failure(TransportError.suspended))
|
||||
|
||||
@@ -223,7 +223,7 @@ final class FeedlyAccountDelegate: AccountDelegate, Logging {
|
||||
isOPMLImportInProgress = true
|
||||
refreshProgress.addToNumberOfTasksAndRemaining(1)
|
||||
|
||||
caller.importOpml(data) { result in
|
||||
caller.importOPML(data) { result in
|
||||
switch result {
|
||||
case .success:
|
||||
self.logger.debug("Import OPML done.")
|
||||
@@ -326,7 +326,7 @@ final class FeedlyAccountDelegate: AccountDelegate, Logging {
|
||||
feedName: name,
|
||||
searchService: caller,
|
||||
addToCollectionService: caller,
|
||||
syncUnreadIdsService: caller,
|
||||
syncUnreadIDsService: caller,
|
||||
getStreamContentsService: caller,
|
||||
database: database,
|
||||
container: container,
|
||||
|
||||
@@ -27,7 +27,7 @@ class FeedlyAddExistingFeedOperation: FeedlyOperation, FeedlyOperationDelegate,
|
||||
|
||||
self.downloadProgress = progress
|
||||
|
||||
let addRequest = FeedlyAddFeedToCollectionOperation(account: account, folder: folder, feedResource: resource, feedName: customFeedName, collectionId: collectionId, service: service)
|
||||
let addRequest = FeedlyAddFeedToCollectionOperation(account: account, folder: folder, feedResource: resource, feedName: customFeedName, collectionID: collectionId, service: service)
|
||||
addRequest.delegate = self
|
||||
addRequest.downloadProgress = progress
|
||||
self.operationQueue.add(addRequest)
|
||||
|
||||
@@ -10,24 +10,24 @@ import Foundation
|
||||
import AccountError
|
||||
|
||||
protocol FeedlyAddFeedToCollectionService {
|
||||
func addFeed(with feedId: FeedlyFeedResourceID, title: String?, toCollectionWith collectionId: String, completion: @escaping (Result<[FeedlyFeed], Error>) -> ())
|
||||
func addFeed(with feedID: FeedlyFeedResourceID, title: String?, toCollectionWith collectionID: String, completion: @escaping (Result<[FeedlyFeed], Error>) -> ())
|
||||
}
|
||||
|
||||
final class FeedlyAddFeedToCollectionOperation: FeedlyOperation, FeedlyFeedsAndFoldersProviding, FeedlyResourceProviding {
|
||||
|
||||
let feedName: String?
|
||||
let collectionId: String
|
||||
let collectionID: String
|
||||
let service: FeedlyAddFeedToCollectionService
|
||||
let account: Account
|
||||
let folder: Folder
|
||||
let feedResource: FeedlyFeedResourceID
|
||||
|
||||
init(account: Account, folder: Folder, feedResource: FeedlyFeedResourceID, feedName: String? = nil, collectionId: String, service: FeedlyAddFeedToCollectionService) {
|
||||
init(account: Account, folder: Folder, feedResource: FeedlyFeedResourceID, feedName: String? = nil, collectionID: String, service: FeedlyAddFeedToCollectionService) {
|
||||
self.account = account
|
||||
self.folder = folder
|
||||
self.feedResource = feedResource
|
||||
self.feedName = feedName
|
||||
self.collectionId = collectionId
|
||||
self.collectionID = collectionID
|
||||
self.service = service
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ final class FeedlyAddFeedToCollectionOperation: FeedlyOperation, FeedlyFeedsAndF
|
||||
}
|
||||
|
||||
override func run() {
|
||||
service.addFeed(with: feedResource, title: feedName, toCollectionWith: collectionId) { [weak self] result in
|
||||
service.addFeed(with: feedResource, title: feedName, toCollectionWith: collectionID) { [weak self] result in
|
||||
guard let self = self else {
|
||||
return
|
||||
}
|
||||
@@ -58,9 +58,9 @@ private extension FeedlyAddFeedToCollectionOperation {
|
||||
case .success(let feedlyFeeds):
|
||||
feedsAndFolders = [(feedlyFeeds, folder)]
|
||||
|
||||
let feedsWithCreatedFeedId = feedlyFeeds.filter { $0.id == resource.id }
|
||||
let feedsWithCreatedFeedID = feedlyFeeds.filter { $0.id == resource.id }
|
||||
|
||||
if feedsWithCreatedFeedId.isEmpty {
|
||||
if feedsWithCreatedFeedID.isEmpty {
|
||||
didFinish(with: AccountError.createErrorNotFound)
|
||||
} else {
|
||||
didFinish()
|
||||
|
||||
@@ -17,23 +17,23 @@ class FeedlyAddNewFeedOperation: FeedlyOperation, FeedlyOperationDelegate, Feedl
|
||||
|
||||
private let operationQueue = MainThreadOperationQueue()
|
||||
private let folder: Folder
|
||||
private let collectionId: String
|
||||
private let collectionID: String
|
||||
private let url: String
|
||||
private let account: Account
|
||||
private let credentials: Credentials
|
||||
private let database: SyncDatabase
|
||||
private let feedName: String?
|
||||
private let addToCollectionService: FeedlyAddFeedToCollectionService
|
||||
private let syncUnreadIdsService: FeedlyGetStreamIDsService
|
||||
private let syncUnreadIDsService: FeedlyGetStreamIDsService
|
||||
private let getStreamContentsService: FeedlyGetStreamContentsService
|
||||
private var feedResourceId: FeedlyFeedResourceID?
|
||||
private var feedResourceID: FeedlyFeedResourceID?
|
||||
var addCompletionHandler: ((Result<Feed, Error>) -> ())?
|
||||
|
||||
init(account: Account, credentials: Credentials, url: String, feedName: String?, searchService: FeedlySearchService, addToCollectionService: FeedlyAddFeedToCollectionService, syncUnreadIdsService: FeedlyGetStreamIDsService, getStreamContentsService: FeedlyGetStreamContentsService, database: SyncDatabase, container: Container, progress: DownloadProgress) throws {
|
||||
init(account: Account, credentials: Credentials, url: String, feedName: String?, searchService: FeedlySearchService, addToCollectionService: FeedlyAddFeedToCollectionService, syncUnreadIDsService: FeedlyGetStreamIDsService, getStreamContentsService: FeedlyGetStreamContentsService, database: SyncDatabase, container: Container, progress: DownloadProgress) throws {
|
||||
|
||||
|
||||
let validator = FeedlyFeedContainerValidator(container: container)
|
||||
(self.folder, self.collectionId) = try validator.getValidContainer()
|
||||
(self.folder, self.collectionID) = try validator.getValidContainer()
|
||||
|
||||
self.url = url
|
||||
self.operationQueue.suspend()
|
||||
@@ -42,7 +42,7 @@ class FeedlyAddNewFeedOperation: FeedlyOperation, FeedlyOperationDelegate, Feedl
|
||||
self.database = database
|
||||
self.feedName = feedName
|
||||
self.addToCollectionService = addToCollectionService
|
||||
self.syncUnreadIdsService = syncUnreadIdsService
|
||||
self.syncUnreadIDsService = syncUnreadIDsService
|
||||
self.getStreamContentsService = getStreamContentsService
|
||||
|
||||
super.init()
|
||||
@@ -81,10 +81,10 @@ class FeedlyAddNewFeedOperation: FeedlyOperation, FeedlyOperationDelegate, Feedl
|
||||
return didFinish(with: AccountError.createErrorNotFound)
|
||||
}
|
||||
|
||||
let feedResourceId = FeedlyFeedResourceID(id: first.feedId)
|
||||
self.feedResourceId = feedResourceId
|
||||
let feedResourceID = FeedlyFeedResourceID(id: first.feedId)
|
||||
self.feedResourceID = feedResourceID
|
||||
|
||||
let addRequest = FeedlyAddFeedToCollectionOperation(account: account, folder: folder, feedResource: feedResourceId, feedName: feedName, collectionId: collectionId, service: addToCollectionService)
|
||||
let addRequest = FeedlyAddFeedToCollectionOperation(account: account, folder: folder, feedResource: feedResourceID, feedName: feedName, collectionID: collectionID, service: addToCollectionService)
|
||||
addRequest.delegate = self
|
||||
addRequest.downloadProgress = downloadProgress
|
||||
operationQueue.add(addRequest)
|
||||
@@ -95,13 +95,13 @@ class FeedlyAddNewFeedOperation: FeedlyOperation, FeedlyOperationDelegate, Feedl
|
||||
createFeeds.downloadProgress = downloadProgress
|
||||
operationQueue.add(createFeeds)
|
||||
|
||||
let syncUnread = FeedlyIngestUnreadArticleIDsOperation(account: account, userID: credentials.username, service: syncUnreadIdsService, database: database, newerThan: nil)
|
||||
let syncUnread = FeedlyIngestUnreadArticleIDsOperation(account: account, userID: credentials.username, service: syncUnreadIDsService, database: database, newerThan: nil)
|
||||
syncUnread.addDependency(createFeeds)
|
||||
syncUnread.downloadProgress = downloadProgress
|
||||
syncUnread.delegate = self
|
||||
operationQueue.add(syncUnread)
|
||||
|
||||
let syncFeed = FeedlySyncStreamContentsOperation(account: account, resource: feedResourceId, service: getStreamContentsService, isPagingEnabled: false, newerThan: nil)
|
||||
let syncFeed = FeedlySyncStreamContentsOperation(account: account, resource: feedResourceID, service: getStreamContentsService, isPagingEnabled: false, newerThan: nil)
|
||||
syncFeed.addDependency(syncUnread)
|
||||
syncFeed.downloadProgress = downloadProgress
|
||||
syncFeed.delegate = self
|
||||
@@ -135,7 +135,7 @@ class FeedlyAddNewFeedOperation: FeedlyOperation, FeedlyOperationDelegate, Feedl
|
||||
guard let handler = addCompletionHandler else {
|
||||
return
|
||||
}
|
||||
if let feedResource = feedResourceId, let feed = folder.existingFeed(withFeedID: feedResource.id) {
|
||||
if let feedResource = feedResourceID, let feed = folder.existingFeed(withFeedID: feedResource.id) {
|
||||
handler(.success(feed))
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -13,17 +13,17 @@ import RSWeb
|
||||
class FeedlyDownloadArticlesOperation: FeedlyOperation, Logging {
|
||||
|
||||
private let account: Account
|
||||
private let missingArticleEntryIdProvider: FeedlyEntryIdentifierProviding
|
||||
private let updatedArticleEntryIdProvider: FeedlyEntryIdentifierProviding
|
||||
private let missingArticleEntryIDProvider: FeedlyEntryIdentifierProviding
|
||||
private let updatedArticleEntryIDProvider: FeedlyEntryIdentifierProviding
|
||||
private let getEntriesService: FeedlyGetEntriesService
|
||||
private let operationQueue = MainThreadOperationQueue()
|
||||
private let finishOperation: FeedlyCheckpointOperation
|
||||
|
||||
init(account: Account, missingArticleEntryIdProvider: FeedlyEntryIdentifierProviding, updatedArticleEntryIdProvider: FeedlyEntryIdentifierProviding, getEntriesService: FeedlyGetEntriesService) {
|
||||
init(account: Account, missingArticleEntryIDProvider: FeedlyEntryIdentifierProviding, updatedArticleEntryIDProvider: FeedlyEntryIdentifierProviding, getEntriesService: FeedlyGetEntriesService) {
|
||||
self.account = account
|
||||
self.operationQueue.suspend()
|
||||
self.missingArticleEntryIdProvider = missingArticleEntryIdProvider
|
||||
self.updatedArticleEntryIdProvider = updatedArticleEntryIdProvider
|
||||
self.missingArticleEntryIDProvider = missingArticleEntryIDProvider
|
||||
self.updatedArticleEntryIDProvider = updatedArticleEntryIDProvider
|
||||
self.getEntriesService = getEntriesService
|
||||
self.finishOperation = FeedlyCheckpointOperation()
|
||||
super.init()
|
||||
@@ -32,8 +32,8 @@ class FeedlyDownloadArticlesOperation: FeedlyOperation, Logging {
|
||||
}
|
||||
|
||||
override func run() {
|
||||
var articleIds = missingArticleEntryIdProvider.entryIDs
|
||||
articleIds.formUnion(updatedArticleEntryIdProvider.entryIDs)
|
||||
var articleIds = missingArticleEntryIDProvider.entryIDs
|
||||
articleIds.formUnion(updatedArticleEntryIDProvider.entryIDs)
|
||||
|
||||
self.logger.debug("Requesting \(articleIds.count, privacy: .public) articles.")
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// FeedlyFetchIdsForMissingArticlesOperation.swift
|
||||
// FeedlyFetchIDsForMissingArticlesOperation.swift
|
||||
// Account
|
||||
//
|
||||
// Created by Kiel Gillard on 7/1/20.
|
||||
@@ -9,7 +9,7 @@
|
||||
import Foundation
|
||||
import RSCore
|
||||
|
||||
final class FeedlyFetchIdsForMissingArticlesOperation: FeedlyOperation, FeedlyEntryIdentifierProviding, Logging {
|
||||
final class FeedlyFetchIDsForMissingArticlesOperation: FeedlyOperation, FeedlyEntryIdentifierProviding, Logging {
|
||||
|
||||
private let account: Account
|
||||
|
||||
|
||||
@@ -37,9 +37,9 @@ final class FeedlyGetEntriesOperation: FeedlyOperation, FeedlyEntryProviding, Fe
|
||||
})
|
||||
|
||||
if parsed.count != entries.count {
|
||||
let entryIds = Set(entries.map { $0.id })
|
||||
let parsedIds = Set(parsed.map { $0.uniqueID })
|
||||
let difference = entryIds.subtracting(parsedIds)
|
||||
let entryIDs = Set(entries.map { $0.id })
|
||||
let parsedIDs = Set(parsed.map { $0.uniqueID })
|
||||
let difference = entryIDs.subtracting(parsedIDs)
|
||||
self.logger.debug("\(String(describing: self), privacy: .public) dropping articles with ids: \(difference)).")
|
||||
}
|
||||
|
||||
|
||||
@@ -55,9 +55,9 @@ final class FeedlyGetStreamContentsOperation: FeedlyOperation, FeedlyEntryProvid
|
||||
})
|
||||
|
||||
if parsed.count != entries.count {
|
||||
let entryIds = Set(entries.map { $0.id })
|
||||
let parsedIds = Set(parsed.map { $0.uniqueID })
|
||||
let difference = entryIds.subtracting(parsedIds)
|
||||
let entryIDs = Set(entries.map { $0.id })
|
||||
let parsedIDs = Set(parsed.map { $0.uniqueID })
|
||||
let difference = entryIDs.subtracting(parsedIDs)
|
||||
logger.debug("Dropping articles with ids: \(difference, privacy: .public)")
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ final class FeedlySyncAllOperation: FeedlyOperation, Logging {
|
||||
///
|
||||
/// Download articles for statuses at the union of those statuses without its corresponding article and those included in 3 (changed since last successful sync).
|
||||
///
|
||||
init(account: Account, feedlyUserID: String, lastSuccessfulFetchStartDate: Date?, markArticlesService: FeedlyMarkArticlesService, getUnreadService: FeedlyGetStreamIDsService, getCollectionsService: FeedlyGetCollectionsService, getStreamContentsService: FeedlyGetStreamContentsService, getStarredService: FeedlyGetStreamIDsService, getStreamIdsService: FeedlyGetStreamIDsService, getEntriesService: FeedlyGetEntriesService, database: SyncDatabase, downloadProgress: DownloadProgress) {
|
||||
init(account: Account, feedlyUserID: String, lastSuccessfulFetchStartDate: Date?, markArticlesService: FeedlyMarkArticlesService, getUnreadService: FeedlyGetStreamIDsService, getCollectionsService: FeedlyGetCollectionsService, getStreamContentsService: FeedlyGetStreamContentsService, getStarredService: FeedlyGetStreamIDsService, getStreamIDsService: FeedlyGetStreamIDsService, getEntriesService: FeedlyGetEntriesService, database: SyncDatabase, downloadProgress: DownloadProgress) {
|
||||
self.syncUUID = UUID()
|
||||
self.operationQueue.suspend()
|
||||
|
||||
@@ -65,7 +65,7 @@ final class FeedlySyncAllOperation: FeedlyOperation, Logging {
|
||||
createFeedsOperation.addDependency(mirrorCollectionsAsFolders)
|
||||
self.operationQueue.add(createFeedsOperation)
|
||||
|
||||
let getAllArticleIDs = FeedlyIngestStreamArticleIDsOperation(account: account, userId: feedlyUserID, service: getStreamIdsService)
|
||||
let getAllArticleIDs = FeedlyIngestStreamArticleIDsOperation(account: account, userId: feedlyUserID, service: getStreamIDsService)
|
||||
getAllArticleIDs.delegate = self
|
||||
getAllArticleIDs.downloadProgress = downloadProgress
|
||||
getAllArticleIDs.addDependency(createFeedsOperation)
|
||||
@@ -80,7 +80,7 @@ final class FeedlySyncAllOperation: FeedlyOperation, Logging {
|
||||
|
||||
// Get each page of the article ids which have been update since the last successful fetch start date.
|
||||
// If the date is nil, this operation provides an empty set (everything is new, nothing is updated).
|
||||
let getUpdated = FeedlyGetUpdatedArticleIDsOperation(account: account, userID: feedlyUserID, service: getStreamIdsService, newerThan: lastSuccessfulFetchStartDate)
|
||||
let getUpdated = FeedlyGetUpdatedArticleIDsOperation(account: account, userID: feedlyUserID, service: getStreamIDsService, newerThan: lastSuccessfulFetchStartDate)
|
||||
getUpdated.delegate = self
|
||||
getUpdated.downloadProgress = downloadProgress
|
||||
getUpdated.addDependency(createFeedsOperation)
|
||||
@@ -94,7 +94,7 @@ final class FeedlySyncAllOperation: FeedlyOperation, Logging {
|
||||
self.operationQueue.add(getStarred)
|
||||
|
||||
// Now all the possible article ids we need have a status, fetch the article ids for missing articles.
|
||||
let getMissingIDs = FeedlyFetchIdsForMissingArticlesOperation(account: account)
|
||||
let getMissingIDs = FeedlyFetchIDsForMissingArticlesOperation(account: account)
|
||||
getMissingIDs.delegate = self
|
||||
getMissingIDs.downloadProgress = downloadProgress
|
||||
getMissingIDs.addDependency(getAllArticleIDs)
|
||||
@@ -105,8 +105,8 @@ final class FeedlySyncAllOperation: FeedlyOperation, Logging {
|
||||
|
||||
// Download all the missing and updated articles
|
||||
let downloadMissingArticles = FeedlyDownloadArticlesOperation(account: account,
|
||||
missingArticleEntryIdProvider: getMissingIDs,
|
||||
updatedArticleEntryIdProvider: getUpdated,
|
||||
missingArticleEntryIDProvider: getMissingIDs,
|
||||
updatedArticleEntryIDProvider: getUpdated,
|
||||
getEntriesService: getEntriesService)
|
||||
downloadMissingArticles.delegate = self
|
||||
downloadMissingArticles.downloadProgress = downloadProgress
|
||||
@@ -123,7 +123,7 @@ final class FeedlySyncAllOperation: FeedlyOperation, Logging {
|
||||
}
|
||||
|
||||
convenience init(account: Account, feedlyUserID: String, caller: FeedlyAPICaller, database: SyncDatabase, lastSuccessfulFetchStartDate: Date?, downloadProgress: DownloadProgress) {
|
||||
self.init(account: account, feedlyUserID: feedlyUserID, lastSuccessfulFetchStartDate: lastSuccessfulFetchStartDate, markArticlesService: caller, getUnreadService: caller, getCollectionsService: caller, getStreamContentsService: caller, getStarredService: caller, getStreamIdsService: caller, getEntriesService: caller, database: database, downloadProgress: downloadProgress)
|
||||
self.init(account: account, feedlyUserID: feedlyUserID, lastSuccessfulFetchStartDate: lastSuccessfulFetchStartDate, markArticlesService: caller, getUnreadService: caller, getCollectionsService: caller, getStreamContentsService: caller, getStarredService: caller, getStreamIDsService: caller, getEntriesService: caller, database: database, downloadProgress: downloadProgress)
|
||||
}
|
||||
|
||||
override func run() {
|
||||
|
||||
Reference in New Issue
Block a user