diff --git a/Frameworks/Account/Feedbin/FeedbinAPICaller.swift b/Frameworks/Account/Feedbin/FeedbinAPICaller.swift index 86072b688..ba1e0fa94 100644 --- a/Frameworks/Account/Feedbin/FeedbinAPICaller.swift +++ b/Frameworks/Account/Feedbin/FeedbinAPICaller.swift @@ -358,9 +358,9 @@ final class FeedbinAPICaller: NSObject { let concatIDs = articleIDs.reduce("") { param, articleID in return param + ",\(articleID)" } let paramIDs = String(concatIDs.dropFirst()) - var callURL = URLComponents(url: feedbinBaseURL.appendingPathComponent("entries.json"), resolvingAgainstBaseURL: false)! - callURL.queryItems = [URLQueryItem(name: "ids", value: paramIDs)] - let request = URLRequest(url: callURL.url!, credentials: credentials) + var callComponents = URLComponents(url: feedbinBaseURL.appendingPathComponent("entries.json"), resolvingAgainstBaseURL: false)! + callComponents.queryItems = [URLQueryItem(name: "ids", value: paramIDs), URLQueryItem(name: "mode", value: "extended")] + let request = URLRequest(url: callComponents.url!, credentials: credentials) transport.send(request: request, resultType: [FeedbinEntry].self) { result in @@ -380,9 +380,9 @@ final class FeedbinAPICaller: NSObject { let since = Calendar.current.date(byAdding: .month, value: -3, to: Date()) ?? Date() let sinceString = FeedbinDate.formatter.string(from: since) - var callURL = URLComponents(url: feedbinBaseURL.appendingPathComponent("/feeds/\(feedID)/entries.json"), resolvingAgainstBaseURL: false)! - callURL.queryItems = [URLQueryItem(name: "since", value: sinceString), URLQueryItem(name: "per_page", value: "100")] - let request = URLRequest(url: callURL.url!, credentials: credentials) + var callComponents = URLComponents(url: feedbinBaseURL.appendingPathComponent("feeds/\(feedID)/entries.json"), resolvingAgainstBaseURL: false)! + callComponents.queryItems = [URLQueryItem(name: "since", value: sinceString), URLQueryItem(name: "per_page", value: "100"), URLQueryItem(name: "mode", value: "extended")] + let request = URLRequest(url: callComponents.url!, credentials: credentials) transport.send(request: request, resultType: [FeedbinEntry].self) { result in @@ -411,9 +411,9 @@ final class FeedbinAPICaller: NSObject { }() let sinceString = FeedbinDate.formatter.string(from: since) - var callURL = URLComponents(url: feedbinBaseURL.appendingPathComponent("entries.json"), resolvingAgainstBaseURL: false)! - callURL.queryItems = [URLQueryItem(name: "since", value: sinceString), URLQueryItem(name: "per_page", value: "100")] - let request = URLRequest(url: callURL.url!, credentials: credentials) + var callComponents = URLComponents(url: feedbinBaseURL.appendingPathComponent("entries.json"), resolvingAgainstBaseURL: false)! + callComponents.queryItems = [URLQueryItem(name: "since", value: sinceString), URLQueryItem(name: "per_page", value: "100"), URLQueryItem(name: "mode", value: "extended")] + let request = URLRequest(url: callComponents.url!, credentials: credentials) transport.send(request: request, resultType: [FeedbinEntry].self) { result in @@ -438,12 +438,13 @@ final class FeedbinAPICaller: NSObject { func retrieveEntries(page: String, completion: @escaping (Result<([FeedbinEntry]?, String?), Error>) -> Void) { - guard let callURL = URL(string: page) else { + guard let url = URL(string: page), var callComponents = URLComponents(url: url, resolvingAgainstBaseURL: false) else { completion(.success((nil, nil))) return } - let request = URLRequest(url: callURL, credentials: credentials) + callComponents.queryItems?.append(URLQueryItem(name: "mode", value: "extended")) + let request = URLRequest(url: callComponents.url!, credentials: credentials) transport.send(request: request, resultType: [FeedbinEntry].self) { result in diff --git a/Frameworks/Account/Feedbin/FeedbinAccountDelegate.swift b/Frameworks/Account/Feedbin/FeedbinAccountDelegate.swift index bb9294869..065d9b487 100644 --- a/Frameworks/Account/Feedbin/FeedbinAccountDelegate.swift +++ b/Frameworks/Account/Feedbin/FeedbinAccountDelegate.swift @@ -1098,7 +1098,7 @@ private extension FeedbinAccountDelegate { } let parsedItems: [ParsedItem] = entries.map { entry in - let authors = Set([ParsedAuthor(name: entry.authorName, url: nil, avatarURL: nil, emailAddress: nil)]) + let authors = Set([ParsedAuthor(name: entry.authorName, url: entry.jsonFeed?.jsonFeedAuthor?.url, avatarURL: entry.jsonFeed?.jsonFeedAuthor?.avatarURL, emailAddress: nil)]) return ParsedItem(syncServiceID: String(entry.articleID), uniqueID: String(entry.articleID), feedURL: String(entry.feedID), url: nil, externalURL: entry.url, title: entry.title, contentHTML: entry.contentHTML, contentText: nil, summary: entry.summary, imageURL: nil, bannerImageURL: nil, datePublished: entry.parseDatePublished(), dateModified: nil, authors: authors, tags: nil, attachments: nil) } diff --git a/Frameworks/Account/Feedbin/FeedbinEntry.swift b/Frameworks/Account/Feedbin/FeedbinEntry.swift index 2a604766e..8d73a51da 100644 --- a/Frameworks/Account/Feedbin/FeedbinEntry.swift +++ b/Frameworks/Account/Feedbin/FeedbinEntry.swift @@ -21,6 +21,7 @@ struct FeedbinEntry: Codable { let summary: String? let datePublished: String? let dateArrived: String? + let jsonFeed: FeedbinEntryJSONFeed? enum CodingKeys: String, CodingKey { case articleID = "id" @@ -32,6 +33,7 @@ struct FeedbinEntry: Codable { case summary = "summary" case datePublished = "published" case dateArrived = "created_at" + case jsonFeed = "json_feed" } // Feedbin dates can't be decoded by the JSONDecoding 8601 decoding strategy. Feedbin @@ -47,3 +49,19 @@ struct FeedbinEntry: Codable { } } + +struct FeedbinEntryJSONFeed: Codable { + let jsonFeedAuthor: FeedbinEntryJSONFeedAuthor? + enum CodingKeys: String, CodingKey { + case jsonFeedAuthor = "author" + } +} + +struct FeedbinEntryJSONFeedAuthor: Codable { + let url: String? + let avatarURL: String? + enum CodingKeys: String, CodingKey { + case url = "url" + case avatarURL = "avatar" + } +}