From f87e96dc9e4fe4260147c104cba6a26d37d9796e Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Mon, 29 Apr 2024 22:09:23 -0700 Subject: [PATCH] Delete no-longer-used Feedly protocols. --- .../Account/Feedly/FeedlyAPICaller.swift | 10 ++-- Feedly/Sources/Feedly/FeedlyModel.swift | 44 +++++++------- .../Feedly/FeedlyResourceProviding.swift | 20 ------- Feedly/Sources/Feedly/FeedlyServices.swift | 57 ------------------- 4 files changed, 28 insertions(+), 103 deletions(-) delete mode 100644 Feedly/Sources/Feedly/FeedlyResourceProviding.swift delete mode 100644 Feedly/Sources/Feedly/FeedlyServices.swift diff --git a/Account/Sources/Account/Feedly/FeedlyAPICaller.swift b/Account/Sources/Account/Feedly/FeedlyAPICaller.swift index e7ab9044b..aa4393e84 100644 --- a/Account/Sources/Account/Feedly/FeedlyAPICaller.swift +++ b/Account/Sources/Account/Feedly/FeedlyAPICaller.swift @@ -362,7 +362,7 @@ func refreshAccessToken(_ refreshRequest: OAuthRefreshAccessTokenRequest) async } } -extension FeedlyAPICaller: FeedlyGetCollectionsService { +extension FeedlyAPICaller { func getCollections() async throws -> Set { @@ -379,7 +379,7 @@ extension FeedlyAPICaller: FeedlyGetCollectionsService { } } -extension FeedlyAPICaller: FeedlyGetStreamContentsService { +extension FeedlyAPICaller { @MainActor func getStreamContents(for resource: FeedlyResourceID, continuation: String?, newerThan: Date?, unreadOnly: Bool?) async throws -> FeedlyStream { @@ -432,7 +432,7 @@ extension FeedlyAPICaller: FeedlyGetStreamContentsService { } } -extension FeedlyAPICaller: FeedlyGetStreamIDsService { +extension FeedlyAPICaller { @MainActor func getStreamIDs(for resource: FeedlyResourceID, continuation: String? = nil, newerThan: Date?, unreadOnly: Bool?) async throws -> FeedlyStreamIDs { @@ -485,7 +485,7 @@ extension FeedlyAPICaller: FeedlyGetStreamIDsService { } } -extension FeedlyAPICaller: FeedlyGetEntriesService { +extension FeedlyAPICaller { @MainActor func getEntries(for ids: Set) async throws -> [FeedlyEntry] { @@ -505,7 +505,7 @@ extension FeedlyAPICaller: FeedlyGetEntriesService { } } -extension FeedlyAPICaller: FeedlyMarkArticlesService { +extension FeedlyAPICaller { private struct MarkerEntriesBody: Encodable { let type = "entries" diff --git a/Feedly/Sources/Feedly/FeedlyModel.swift b/Feedly/Sources/Feedly/FeedlyModel.swift index 390d5355e..265830848 100644 --- a/Feedly/Sources/Feedly/FeedlyModel.swift +++ b/Feedly/Sources/Feedly/FeedlyModel.swift @@ -124,27 +124,6 @@ public struct FeedlyEntry: Decodable, Sendable, Hashable { } } -public protocol FeedlyEntryIdentifierProviding: AnyObject { - @MainActor var entryIDs: Set { get } -} - -public final class FeedlyEntryIdentifierProvider: FeedlyEntryIdentifierProviding { - - private (set) public var entryIDs: Set - - public init(entryIDs: Set = Set()) { - self.entryIDs = entryIDs - } - - @MainActor public func addEntryIDs(from provider: FeedlyEntryIdentifierProviding) { - entryIDs.formUnion(provider.entryIDs) - } - - @MainActor public func addEntryIDs(in articleIDs: [String]) { - entryIDs.formUnion(articleIDs) - } -} - public struct FeedlyEntryParser: Sendable { public let entry: FeedlyEntry @@ -471,3 +450,26 @@ public struct FeedlyTag: Decodable, Sendable, Equatable { lhs.id == rhs.id && lhs.label == rhs.label } } + +public enum FeedlyMarkAction: String, Sendable { + + case read + case unread + case saved + case unsaved + + /// These values are paired with the "action" key in POST requests to the markers API. + /// See for example: https://developer.feedly.com/v3/markers/#mark-one-or-multiple-articles-as-read + public var actionValue: String { + switch self { + case .read: + return "markAsRead" + case .unread: + return "keepUnread" + case .saved: + return "markAsSaved" + case .unsaved: + return "markAsUnsaved" + } + } +} diff --git a/Feedly/Sources/Feedly/FeedlyResourceProviding.swift b/Feedly/Sources/Feedly/FeedlyResourceProviding.swift deleted file mode 100644 index 5b6c526d7..000000000 --- a/Feedly/Sources/Feedly/FeedlyResourceProviding.swift +++ /dev/null @@ -1,20 +0,0 @@ -// -// FeedlyResourceProviding.swift -// Account -// -// Created by Kiel Gillard on 11/10/19. -// Copyright © 2019 Ranchero Software, LLC. All rights reserved. -// - -import Foundation - -public protocol FeedlyResourceProviding { - @MainActor var resource: FeedlyResourceID { get } -} - -extension FeedlyFeedResourceID: FeedlyResourceProviding { - - public var resource: FeedlyResourceID { - return self - } -} diff --git a/Feedly/Sources/Feedly/FeedlyServices.swift b/Feedly/Sources/Feedly/FeedlyServices.swift deleted file mode 100644 index 5a487b8b4..000000000 --- a/Feedly/Sources/Feedly/FeedlyServices.swift +++ /dev/null @@ -1,57 +0,0 @@ -// -// FeedlyServices.swift -// -// -// Created by Brent Simmons on 4/27/24. -// Includes text of a bunch of files created by Kiel Gillard 2019 -// - -import Foundation - -public protocol FeedlyGetCollectionsService: AnyObject { - - @MainActor func getCollections() async throws -> Set -} - -public protocol FeedlyGetEntriesService: AnyObject { - - @MainActor func getEntries(for ids: Set) async throws -> [FeedlyEntry] -} - -public protocol FeedlyGetStreamContentsService: AnyObject { - - @MainActor func getStreamContents(for resource: FeedlyResourceID, continuation: String?, newerThan: Date?, unreadOnly: Bool?) async throws -> FeedlyStream -} - -public protocol FeedlyGetStreamIDsService: AnyObject { - - @MainActor func getStreamIDs(for resource: FeedlyResourceID, continuation: String?, newerThan: Date?, unreadOnly: Bool?) async throws -> FeedlyStreamIDs -} - -public enum FeedlyMarkAction: String, Sendable { - - case read - case unread - case saved - case unsaved - - /// These values are paired with the "action" key in POST requests to the markers API. - /// See for example: https://developer.feedly.com/v3/markers/#mark-one-or-multiple-articles-as-read - public var actionValue: String { - switch self { - case .read: - return "markAsRead" - case .unread: - return "keepUnread" - case .saved: - return "markAsSaved" - case .unsaved: - return "markAsUnsaved" - } - } -} - -public protocol FeedlyMarkArticlesService: AnyObject { - - @MainActor func mark(_ articleIDs: Set, as action: FeedlyMarkAction) async throws -}