From a1c2a2b43a2d3ce57659341846bb29edfa9ef4a5 Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Wed, 1 May 2024 21:03:59 -0700 Subject: [PATCH] Create folders in Account module for each account type. --- .../CloudKitAccountDelegate.swift | 0 .../FeedbinAccountDelegate.swift | 0 .../FeedlyAccountDelegate.swift | 16 ++++++++++++ .../Feedly/FeedlyFeedContainerValidator.swift | 26 ------------------- .../LocalAccountDelegate.swift | 0 .../LocalAccountRefresher.swift | 0 .../NewsBlurAccountDelegate+Internal.swift | 0 .../NewsBlurAccountDelegate.swift | 0 .../ReaderAPIAccountDelegate.swift | 0 9 files changed, 16 insertions(+), 26 deletions(-) rename Account/Sources/Account/{AccountDelegates => CloudKit}/CloudKitAccountDelegate.swift (100%) rename Account/Sources/Account/{AccountDelegates => Feedbin}/FeedbinAccountDelegate.swift (100%) rename Account/Sources/Account/{AccountDelegates => Feedly}/FeedlyAccountDelegate.swift (98%) delete mode 100644 Account/Sources/Account/Feedly/FeedlyFeedContainerValidator.swift rename Account/Sources/Account/{AccountDelegates => LocalAccount}/LocalAccountDelegate.swift (100%) rename Account/Sources/Account/{ => LocalAccount}/LocalAccountRefresher.swift (100%) rename Account/Sources/Account/{AccountDelegates => NewsBlur}/NewsBlurAccountDelegate+Internal.swift (100%) rename Account/Sources/Account/{AccountDelegates => NewsBlur}/NewsBlurAccountDelegate.swift (100%) rename Account/Sources/Account/{AccountDelegates => ReaderAPI}/ReaderAPIAccountDelegate.swift (100%) diff --git a/Account/Sources/Account/AccountDelegates/CloudKitAccountDelegate.swift b/Account/Sources/Account/CloudKit/CloudKitAccountDelegate.swift similarity index 100% rename from Account/Sources/Account/AccountDelegates/CloudKitAccountDelegate.swift rename to Account/Sources/Account/CloudKit/CloudKitAccountDelegate.swift diff --git a/Account/Sources/Account/AccountDelegates/FeedbinAccountDelegate.swift b/Account/Sources/Account/Feedbin/FeedbinAccountDelegate.swift similarity index 100% rename from Account/Sources/Account/AccountDelegates/FeedbinAccountDelegate.swift rename to Account/Sources/Account/Feedbin/FeedbinAccountDelegate.swift diff --git a/Account/Sources/Account/AccountDelegates/FeedlyAccountDelegate.swift b/Account/Sources/Account/Feedly/FeedlyAccountDelegate.swift similarity index 98% rename from Account/Sources/Account/AccountDelegates/FeedlyAccountDelegate.swift rename to Account/Sources/Account/Feedly/FeedlyAccountDelegate.swift index 691df611c..de0647995 100644 --- a/Account/Sources/Account/AccountDelegates/FeedlyAccountDelegate.swift +++ b/Account/Sources/Account/Feedly/FeedlyAccountDelegate.swift @@ -765,6 +765,22 @@ final class FeedlyAccountDelegate: AccountDelegate { try await updateAccountFeeds(parsedItems: parsedItems) } + @MainActor struct FeedlyFeedContainerValidator { + var container: Container + + func getValidContainer() throws -> (Folder, String) { + guard let folder = container as? Folder else { + throw FeedlyAccountDelegateError.addFeedChooseFolder + } + + guard let collectionID = folder.externalID else { + throw FeedlyAccountDelegateError.addFeedInvalidFolder(folder.nameForDisplay) + } + + return (folder, collectionID) + } + } + func addNewFeed(url: String, feedName: String?, container: Container) async throws { let validator = FeedlyFeedContainerValidator(container: container) diff --git a/Account/Sources/Account/Feedly/FeedlyFeedContainerValidator.swift b/Account/Sources/Account/Feedly/FeedlyFeedContainerValidator.swift deleted file mode 100644 index 7a3c708bb..000000000 --- a/Account/Sources/Account/Feedly/FeedlyFeedContainerValidator.swift +++ /dev/null @@ -1,26 +0,0 @@ -// -// FeedlyFeedContainerValidator.swift -// Account -// -// Created by Kiel Gillard on 10/10/19. -// Copyright © 2019 Ranchero Software, LLC. All rights reserved. -// - -import Foundation -import Feedly - -@MainActor struct FeedlyFeedContainerValidator { - var container: Container - - func getValidContainer() throws -> (Folder, String) { - guard let folder = container as? Folder else { - throw FeedlyAccountDelegateError.addFeedChooseFolder - } - - guard let collectionID = folder.externalID else { - throw FeedlyAccountDelegateError.addFeedInvalidFolder(folder.nameForDisplay) - } - - return (folder, collectionID) - } -} diff --git a/Account/Sources/Account/AccountDelegates/LocalAccountDelegate.swift b/Account/Sources/Account/LocalAccount/LocalAccountDelegate.swift similarity index 100% rename from Account/Sources/Account/AccountDelegates/LocalAccountDelegate.swift rename to Account/Sources/Account/LocalAccount/LocalAccountDelegate.swift diff --git a/Account/Sources/Account/LocalAccountRefresher.swift b/Account/Sources/Account/LocalAccount/LocalAccountRefresher.swift similarity index 100% rename from Account/Sources/Account/LocalAccountRefresher.swift rename to Account/Sources/Account/LocalAccount/LocalAccountRefresher.swift diff --git a/Account/Sources/Account/AccountDelegates/NewsBlurAccountDelegate+Internal.swift b/Account/Sources/Account/NewsBlur/NewsBlurAccountDelegate+Internal.swift similarity index 100% rename from Account/Sources/Account/AccountDelegates/NewsBlurAccountDelegate+Internal.swift rename to Account/Sources/Account/NewsBlur/NewsBlurAccountDelegate+Internal.swift diff --git a/Account/Sources/Account/AccountDelegates/NewsBlurAccountDelegate.swift b/Account/Sources/Account/NewsBlur/NewsBlurAccountDelegate.swift similarity index 100% rename from Account/Sources/Account/AccountDelegates/NewsBlurAccountDelegate.swift rename to Account/Sources/Account/NewsBlur/NewsBlurAccountDelegate.swift diff --git a/Account/Sources/Account/AccountDelegates/ReaderAPIAccountDelegate.swift b/Account/Sources/Account/ReaderAPI/ReaderAPIAccountDelegate.swift similarity index 100% rename from Account/Sources/Account/AccountDelegates/ReaderAPIAccountDelegate.swift rename to Account/Sources/Account/ReaderAPI/ReaderAPIAccountDelegate.swift