From 0588426ac43488593ce58381ac7cd98247187c86 Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Tue, 12 Sep 2023 21:13:17 -0700 Subject: [PATCH] Consolidate a bunch of Feedly models in FeedlyModels. No need for many tiny separate files. --- .../Feedly/Models/FeedlyCategory.swift | 14 --- .../Feedly/Models/FeedlyCollection.swift | 15 --- .../Models/FeedlyCollectionParser.swift | 23 ----- .../Account/Feedly/Models/FeedlyFeed.swift | 16 --- .../Models/FeedlyFeedsSearchResponse.swift | 19 ---- .../Account/Feedly/Models/FeedlyLink.swift | 18 ---- .../Account/Feedly/Models/FeedlyModels.swift | 97 +++++++++++++++++++ .../Account/Feedly/Models/FeedlyOrigin.swift | 15 --- .../Account/Feedly/Models/FeedlyStream.swift | 26 ----- .../Feedly/Models/FeedlyStreamIds.swift | 18 ---- .../Account/Feedly/Models/FeedlyTag.swift | 14 --- 11 files changed, 97 insertions(+), 178 deletions(-) delete mode 100644 Account/Sources/Account/Feedly/Models/FeedlyCategory.swift delete mode 100644 Account/Sources/Account/Feedly/Models/FeedlyCollection.swift delete mode 100644 Account/Sources/Account/Feedly/Models/FeedlyCollectionParser.swift delete mode 100644 Account/Sources/Account/Feedly/Models/FeedlyFeed.swift delete mode 100644 Account/Sources/Account/Feedly/Models/FeedlyFeedsSearchResponse.swift delete mode 100644 Account/Sources/Account/Feedly/Models/FeedlyLink.swift create mode 100644 Account/Sources/Account/Feedly/Models/FeedlyModels.swift delete mode 100644 Account/Sources/Account/Feedly/Models/FeedlyOrigin.swift delete mode 100644 Account/Sources/Account/Feedly/Models/FeedlyStream.swift delete mode 100644 Account/Sources/Account/Feedly/Models/FeedlyStreamIds.swift delete mode 100644 Account/Sources/Account/Feedly/Models/FeedlyTag.swift diff --git a/Account/Sources/Account/Feedly/Models/FeedlyCategory.swift b/Account/Sources/Account/Feedly/Models/FeedlyCategory.swift deleted file mode 100644 index 534788692..000000000 --- a/Account/Sources/Account/Feedly/Models/FeedlyCategory.swift +++ /dev/null @@ -1,14 +0,0 @@ -// -// FeedlyCategory.swift -// Account -// -// Created by Kiel Gillard on 19/9/19. -// Copyright © 2019 Ranchero Software, LLC. All rights reserved. -// - -import Foundation - -struct FeedlyCategory: Decodable { - let label: String - let id: String -} diff --git a/Account/Sources/Account/Feedly/Models/FeedlyCollection.swift b/Account/Sources/Account/Feedly/Models/FeedlyCollection.swift deleted file mode 100644 index 80322ea51..000000000 --- a/Account/Sources/Account/Feedly/Models/FeedlyCollection.swift +++ /dev/null @@ -1,15 +0,0 @@ -// -// FeedlyCollection.swift -// Account -// -// Created by Kiel Gillard on 19/9/19. -// Copyright © 2019 Ranchero Software, LLC. All rights reserved. -// - -import Foundation - -struct FeedlyCollection: Codable { - let feeds: [FeedlyFeed] - let label: String - let id: String -} diff --git a/Account/Sources/Account/Feedly/Models/FeedlyCollectionParser.swift b/Account/Sources/Account/Feedly/Models/FeedlyCollectionParser.swift deleted file mode 100644 index 229498592..000000000 --- a/Account/Sources/Account/Feedly/Models/FeedlyCollectionParser.swift +++ /dev/null @@ -1,23 +0,0 @@ -// -// FeedlyCollectionParser.swift -// Account -// -// Created by Kiel Gillard on 28/1/20. -// Copyright © 2020 Ranchero Software, LLC. All rights reserved. -// - -import Foundation - -struct FeedlyCollectionParser { - let collection: FeedlyCollection - - private let rightToLeftTextSantizer = FeedlyRTLTextSanitizer() - - var folderName: String { - return rightToLeftTextSantizer.sanitize(collection.label) ?? "" - } - - var externalID: String { - return collection.id - } -} diff --git a/Account/Sources/Account/Feedly/Models/FeedlyFeed.swift b/Account/Sources/Account/Feedly/Models/FeedlyFeed.swift deleted file mode 100644 index eab1eb90a..000000000 --- a/Account/Sources/Account/Feedly/Models/FeedlyFeed.swift +++ /dev/null @@ -1,16 +0,0 @@ -// -// FeedlyFeed.swift -// Account -// -// Created by Kiel Gillard on 19/9/19. -// Copyright © 2019 Ranchero Software, LLC. All rights reserved. -// - -import Foundation - -struct FeedlyFeed: Codable { - let id: String - let title: String? - let updated: Date? - let website: String? -} diff --git a/Account/Sources/Account/Feedly/Models/FeedlyFeedsSearchResponse.swift b/Account/Sources/Account/Feedly/Models/FeedlyFeedsSearchResponse.swift deleted file mode 100644 index 8ddbd563b..000000000 --- a/Account/Sources/Account/Feedly/Models/FeedlyFeedsSearchResponse.swift +++ /dev/null @@ -1,19 +0,0 @@ -// -// FeedlyFeedsSearchResponse.swift -// Account -// -// Created by Kiel Gillard on 1/12/19. -// Copyright © 2019 Ranchero Software, LLC. All rights reserved. -// - -import Foundation - -struct FeedlyFeedsSearchResponse: Decodable { - - struct Feed: Decodable { - let title: String - let feedId: String - } - - let results: [Feed] -} diff --git a/Account/Sources/Account/Feedly/Models/FeedlyLink.swift b/Account/Sources/Account/Feedly/Models/FeedlyLink.swift deleted file mode 100644 index 879341a08..000000000 --- a/Account/Sources/Account/Feedly/Models/FeedlyLink.swift +++ /dev/null @@ -1,18 +0,0 @@ -// -// FeedlyLink.swift -// Account -// -// Created by Kiel Gillard on 3/10/19. -// Copyright © 2019 Ranchero Software, LLC. All rights reserved. -// - -import Foundation - -struct FeedlyLink: Decodable { - let href: String - - /// The mime type of the resource located by `href`. - /// When `nil`, it's probably a web page? - /// https://groups.google.com/forum/#!searchin/feedly-cloud/feed$20url%7Csort:date/feedly-cloud/Rx3dVd4aTFQ/Hf1ZfLJoCQAJ - let type: String? -} diff --git a/Account/Sources/Account/Feedly/Models/FeedlyModels.swift b/Account/Sources/Account/Feedly/Models/FeedlyModels.swift new file mode 100644 index 000000000..92de0872d --- /dev/null +++ b/Account/Sources/Account/Feedly/Models/FeedlyModels.swift @@ -0,0 +1,97 @@ +// +// FeedlyModels.swift +// Account +// +// Created by Kiel Gillard on 19/9/19. +// Copyright © 2019 Ranchero Software, LLC. All rights reserved. +// + +import Foundation + +struct FeedlyCategory: Decodable { + let label: String + let id: String +} + +struct FeedlyCollection: Codable { + let feeds: [FeedlyFeed] + let label: String + let id: String +} + +struct FeedlyCollectionParser { + let collection: FeedlyCollection + + private let rightToLeftTextSantizer = FeedlyRTLTextSanitizer() + + var folderName: String { + return rightToLeftTextSantizer.sanitize(collection.label) ?? "" + } + + var externalID: String { + return collection.id + } +} + +struct FeedlyFeed: Codable { + let id: String + let title: String? + let updated: Date? + let website: String? +} + +struct FeedlyFeedsSearchResponse: Decodable { + + struct Feed: Decodable { + let title: String + let feedId: String + } + + let results: [Feed] +} + +struct FeedlyLink: Decodable { + let href: String + + /// The mime type of the resource located by `href`. + /// When `nil`, it's probably a web page? + /// https://groups.google.com/forum/#!searchin/feedly-cloud/feed$20url%7Csort:date/feedly-cloud/Rx3dVd4aTFQ/Hf1ZfLJoCQAJ + let type: String? +} + +struct FeedlyOrigin: Decodable { + let title: String? + let streamId: String? + let htmlUrl: String? +} + +struct FeedlyStream: Decodable { + let id: String + + /// Of the most recent entry for this stream (regardless of continuation, newerThan, etc). + let updated: Date? + + /// the continuation id to pass to the next stream call, for pagination. + /// This id guarantees that no entry will be duplicated in a stream (meaning, there is no need to de-duplicate entries returned by this call). + /// If this value is not returned, it means the end of the stream has been reached. + let continuation: String? + let items: [FeedlyEntry] + + var isStreamEnd: Bool { + return continuation == nil + } +} + +struct FeedlyStreamIDs: Decodable { + let continuation: String? + let ids: [String] + + var isStreamEnd: Bool { + return continuation == nil + } +} + +struct FeedlyTag: Decodable { + let id: String + let label: String? +} diff --git a/Account/Sources/Account/Feedly/Models/FeedlyOrigin.swift b/Account/Sources/Account/Feedly/Models/FeedlyOrigin.swift deleted file mode 100644 index bd4a8cc86..000000000 --- a/Account/Sources/Account/Feedly/Models/FeedlyOrigin.swift +++ /dev/null @@ -1,15 +0,0 @@ -// -// FeedlyOrigin.swift -// Account -// -// Created by Kiel Gillard on 19/9/19. -// Copyright © 2019 Ranchero Software, LLC. All rights reserved. -// - -import Foundation - -struct FeedlyOrigin: Decodable { - let title: String? - let streamId: String? - let htmlUrl: String? -} diff --git a/Account/Sources/Account/Feedly/Models/FeedlyStream.swift b/Account/Sources/Account/Feedly/Models/FeedlyStream.swift deleted file mode 100644 index fc3e92f38..000000000 --- a/Account/Sources/Account/Feedly/Models/FeedlyStream.swift +++ /dev/null @@ -1,26 +0,0 @@ -// -// FeedlyStream.swift -// Account -// -// Created by Kiel Gillard on 19/9/19. -// Copyright © 2019 Ranchero Software, LLC. All rights reserved. -// - -import Foundation - -struct FeedlyStream: Decodable { - let id: String - - /// Of the most recent entry for this stream (regardless of continuation, newerThan, etc). - let updated: Date? - - /// the continuation id to pass to the next stream call, for pagination. - /// This id guarantees that no entry will be duplicated in a stream (meaning, there is no need to de-duplicate entries returned by this call). - /// If this value is not returned, it means the end of the stream has been reached. - let continuation: String? - let items: [FeedlyEntry] - - var isStreamEnd: Bool { - return continuation == nil - } -} diff --git a/Account/Sources/Account/Feedly/Models/FeedlyStreamIds.swift b/Account/Sources/Account/Feedly/Models/FeedlyStreamIds.swift deleted file mode 100644 index e014fd507..000000000 --- a/Account/Sources/Account/Feedly/Models/FeedlyStreamIds.swift +++ /dev/null @@ -1,18 +0,0 @@ -// -// FeedlyStreamIDs.swift -// Account -// -// Created by Kiel Gillard on 18/10/19. -// Copyright © 2019 Ranchero Software, LLC. All rights reserved. -// - -import Foundation - -struct FeedlyStreamIDs: Decodable { - let continuation: String? - let ids: [String] - - var isStreamEnd: Bool { - return continuation == nil - } -} diff --git a/Account/Sources/Account/Feedly/Models/FeedlyTag.swift b/Account/Sources/Account/Feedly/Models/FeedlyTag.swift deleted file mode 100644 index 0111b95e2..000000000 --- a/Account/Sources/Account/Feedly/Models/FeedlyTag.swift +++ /dev/null @@ -1,14 +0,0 @@ -// -// FeedlyTag.swift -// Account -// -// Created by Kiel Gillard on 3/10/19. -// Copyright © 2019 Ranchero Software, LLC. All rights reserved. -// - -import Foundation - -struct FeedlyTag: Decodable { - let id: String - let label: String? -}