Skip to content
This repository was archived by the owner on Sep 15, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ let package = Package(
targets: [
.binaryTarget(
name: "WordPressKit",
url: "https://github.com/user-attachments/files/16531883/WordPressKit.zip",
checksum: "ca916824c64a6061814a69a37bc9a6560aafcc35559983e945fdfa5c3bbcc23d"
url: "https://github.com/user-attachments/files/17435956/WordPressKit.zip",
checksum: "b3babe54d211d862e485ab3a742080dc9f2a5f04e2a6fa1d675545b0d00a795e"
),
]
)
5 changes: 4 additions & 1 deletion Sources/WordPressKit/Models/RemoteReaderPost.m
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@ - (instancetype)initWithDictionary:(NSDictionary *)dict;
self.authorDisplayName = [[self stringOrEmptyString:[authorDict stringForKey:PostRESTKeyName]] wpkit_stringByDecodingXMLCharacters]; // Typically the author's given name
self.authorEmail = [self authorEmailFromAuthorDictionary:authorDict];
self.authorURL = [self stringOrEmptyString:[authorDict stringForKey:PostRESTKeyURL]];
self.siteIconURL = [self stringOrEmptyString:[dict stringForKeyPath:@"meta.data.site.icon.img"]];
self.siteIconURL = [self stringOrEmptyString:[dict stringForKeyPath:@"site_icon.img"]];
if (self.siteIconURL.length == 0) {
self.siteIconURL = [self stringOrEmptyString:[dict stringForKeyPath:@"meta.data.site.icon.img"]];
}
self.blogName = [self siteNameFromPostDictionary:dict];
self.blogDescription = [self siteDescriptionFromPostDictionary:dict];
self.blogURL = [self siteURLFromPostDictionary:dict];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ public enum ReaderSortingOption: String, CaseIterable {
}
}

public enum ReaderStream: String {
case discover = "discover"
case firstPosts = "first-posts"
}

extension ReaderPostServiceRemote {
/// Returns a collection of RemoteReaderCard using the tags API
/// a Reader Card can represent an item for the reader feed, such as
Expand Down Expand Up @@ -46,20 +51,22 @@ extension ReaderPostServiceRemote {
/// - Topics you may like
/// - Blogs you may like and so on
///
/// - Parameter stream: The name of the stream. By default, `.discover`.
/// - Parameter topics: an array of String representing the topics
/// - Parameter page: a String that represents a page handle
/// - Parameter sortingOption: a ReaderSortingOption that represents a sorting option
/// - Parameter count: the number of cards to fetch. Warning: This also changes the number of objects returned for recommended sites/tags.
/// - Parameter success: Called when the request succeeds and the data returned is valid
/// - Parameter failure: Called if the request fails for any reason, or the response data is invalid
public func fetchStreamCards(for topics: [String],
public func fetchStreamCards(stream: ReaderStream = .discover,
for topics: [String],
page: String? = nil,
sortingOption: ReaderSortingOption = .noSorting,
refreshCount: Int? = nil,
count: Int? = nil,
success: @escaping ([RemoteReaderCard], String?) -> Void,
failure: @escaping (Error) -> Void) {
let path = "read/streams/discover"
let path = "read/streams/\(stream.rawValue)"
guard let requestUrl = cardsEndpoint(with: path,
topics: topics,
page: page,
Expand Down