Add addExistingFeed function to replace FeedlyAddExistingFeedOperation.

This commit is contained in:
Brent Simmons 2024-04-28 22:26:25 -07:00
parent e85e449dcc
commit ec8cfa91e8
1 changed files with 13 additions and 3 deletions

View File

@ -954,7 +954,7 @@ final class FeedlyAccountDelegate: AccountDelegate {
try await updateAccountFeeds(parsedItems: parsedItems)
}
func addNewFeed(url: String, feedName: String?) async throws {
func addNewFeed(url: String, feedName: String?, container: Container) async throws {
// To replace FeedlyAddNewFeedOperation
@ -962,7 +962,7 @@ final class FeedlyAccountDelegate: AccountDelegate {
let (folder, collectionID) = try validator.getValidContainer()
let searchResponse = try await searchForFeed(url: url)
guard let firstFeed = response.results.first else {
guard let firstFeed = searchResponse.results.first else {
throw AccountError.createErrorNotFound
}
let feedResourceID = FeedlyFeedResourceID(id: firstFeed.feedID)
@ -972,10 +972,20 @@ final class FeedlyAccountDelegate: AccountDelegate {
// TODO: FeedlyCreateFeedsForCollectionFoldersOperation replacement
// let createFeeds = TODO
try await fetchAndProcessUnreadArticleIDs()
//try await fetchAndProcessUnreadArticleIDs() // TODO
try await syncStreamContents(feedResourceID: feedResourceID)
}
func addExistingFeed(resourceID: FeedlyFeedResourceID, container: Container, customFeedName: String? = nil) async throws {
// To replace FeedlyAddExistingFeedOperation
let validator = FeedlyFeedContainerValidator(container: container)
let (folder, collectionID) = try validator.getValidContainer()
try await addFeedToCollection(feedResource: resourceID, feedName: customFeedName, collectionID: collectionID, folder: folder)
}
// MARK: Suspend and Resume (for iOS)
/// Suspend all network activity