Skip to content
This repository was archived by the owner on Sep 15, 2025. It is now read-only.

Commit 05af184

Browse files
committed
Update Reader APIs
1 parent c3eeb90 commit 05af184

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ let package = Package(
1111
targets: [
1212
.binaryTarget(
1313
name: "WordPressKit",
14-
url: "https://github.com/user-attachments/files/16531883/WordPressKit.zip",
15-
checksum: "ca916824c64a6061814a69a37bc9a6560aafcc35559983e945fdfa5c3bbcc23d"
14+
url: "https://github.com/user-attachments/files/17435861/WordPressKit.zip",
15+
checksum: "af7239442da8470a91ef5ab923fd91222bb3c0ea345b18f581bfafd63f0dd6b6"
1616
),
1717
]
1818
)

Sources/WordPressKit/Models/RemoteReaderPost.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,10 @@ - (instancetype)initWithDictionary:(NSDictionary *)dict;
9797
self.authorDisplayName = [[self stringOrEmptyString:[authorDict stringForKey:PostRESTKeyName]] wpkit_stringByDecodingXMLCharacters]; // Typically the author's given name
9898
self.authorEmail = [self authorEmailFromAuthorDictionary:authorDict];
9999
self.authorURL = [self stringOrEmptyString:[authorDict stringForKey:PostRESTKeyURL]];
100-
self.siteIconURL = [self stringOrEmptyString:[dict stringForKeyPath:@"meta.data.site.icon.img"]];
100+
self.siteIconURL = [self stringOrEmptyString:[dict stringForKeyPath:@"site_icon.img"]];
101+
if (self.siteIconURL.length == 0) {
102+
self.siteIconURL = [self stringOrEmptyString:[dict stringForKeyPath:@"meta.data.site.icon.img"]];
103+
}
101104
self.blogName = [self siteNameFromPostDictionary:dict];
102105
self.blogDescription = [self siteDescriptionFromPostDictionary:dict];
103106
self.blogURL = [self siteURLFromPostDictionary:dict];

Sources/WordPressKit/Services/ReaderPostServiceRemote+Cards.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,20 +46,22 @@ extension ReaderPostServiceRemote {
4646
/// - Topics you may like
4747
/// - Blogs you may like and so on
4848
///
49+
/// - Parameter stream: The name of the stream. By default, `discover`.
4950
/// - Parameter topics: an array of String representing the topics
5051
/// - Parameter page: a String that represents a page handle
5152
/// - Parameter sortingOption: a ReaderSortingOption that represents a sorting option
5253
/// - Parameter count: the number of cards to fetch. Warning: This also changes the number of objects returned for recommended sites/tags.
5354
/// - Parameter success: Called when the request succeeds and the data returned is valid
5455
/// - Parameter failure: Called if the request fails for any reason, or the response data is invalid
55-
public func fetchStreamCards(for topics: [String],
56+
public func fetchStreamCards(stream: String = "discover",
57+
for topics: [String],
5658
page: String? = nil,
5759
sortingOption: ReaderSortingOption = .noSorting,
5860
refreshCount: Int? = nil,
5961
count: Int? = nil,
6062
success: @escaping ([RemoteReaderCard], String?) -> Void,
6163
failure: @escaping (Error) -> Void) {
62-
let path = "read/streams/discover"
64+
let path = "read/streams/\(stream)"
6365
guard let requestUrl = cardsEndpoint(with: path,
6466
topics: topics,
6567
page: page,

0 commit comments

Comments
 (0)