diff --git a/Package.swift b/Package.swift index b7b5df79..965f2427 100644 --- a/Package.swift +++ b/Package.swift @@ -11,8 +11,8 @@ let package = Package( targets: [ .binaryTarget( name: "WordPressKit", - url: "https://github.com/user-attachments/files/18570063/WordPressKit.zip", - checksum: "fc25d3065e80af713dac970db7ed89ff37e4cc98afc98b6a2ecf7b47b2ddd0c1" + url: "https://github.com/user-attachments/files/19034191/WordPressKit.zip", + checksum: "34f108cba86b5e4334d1c9af79946dbb8b665e270bdd14bc8f7bc0ba7a898583" ), ] ) diff --git a/Sources/WordPressKit/Models/RemoteReaderPost.h b/Sources/WordPressKit/Models/RemoteReaderPost.h index f25b51a7..fa623cdc 100644 --- a/Sources/WordPressKit/Models/RemoteReaderPost.h +++ b/Sources/WordPressKit/Models/RemoteReaderPost.h @@ -17,6 +17,8 @@ @property (nonatomic, strong) NSNumber *commentCount; @property (nonatomic) BOOL commentsOpen; @property (nonatomic, strong) NSString *featuredImage; +@property (nonatomic, strong) NSString *autoSuggestedFeaturedImage; +@property (nonatomic, strong) NSString *suitableImageFromPostContent; @property (nonatomic, strong) NSNumber *feedID; @property (nonatomic, strong) NSNumber *feedItemID; @property (nonatomic, strong) NSString *globalID; diff --git a/Sources/WordPressKit/Models/RemoteReaderPost.m b/Sources/WordPressKit/Models/RemoteReaderPost.m index 061c73b5..ebefeb08 100644 --- a/Sources/WordPressKit/Models/RemoteReaderPost.m +++ b/Sources/WordPressKit/Models/RemoteReaderPost.m @@ -109,6 +109,8 @@ - (instancetype)initWithDictionary:(NSDictionary *)dict; self.content = [self postContentFromPostDictionary:dict]; self.date_created_gmt = [self stringOrEmptyString:[dict stringForKey:PostRESTKeyDate]]; self.featuredImage = [self featuredImageFromPostDictionary:dict]; + self.autoSuggestedFeaturedImage = [self sanitizeFeaturedImageString:[self featuredMediaImageFromPostDictionary:dict]]; + self.suitableImageFromPostContent = [self sanitizeFeaturedImageString:[self suitableImageFromPostContent:dict]]; self.feedID = [dict numberForKey:PostRESTKeyFeedID]; self.feedItemID = [dict numberForKey:PostRESTKeyFeedItemID]; self.globalID = [self stringOrEmptyString:[dict stringForKey:PostRESTKeyGlobalID]]; diff --git a/Sources/WordPressKit/Services/CommentServiceRemoteREST.h b/Sources/WordPressKit/Services/CommentServiceRemoteREST.h index e4323aad..4089461a 100644 --- a/Sources/WordPressKit/Services/CommentServiceRemoteREST.h +++ b/Sources/WordPressKit/Services/CommentServiceRemoteREST.h @@ -30,7 +30,7 @@ */ - (void)updateCommentWithID:(NSNumber * _Nonnull)commentID content:(NSString * _Nonnull)content - success:(void (^ _Nullable)(void))success + success:(void (^ _Nullable)(RemoteComment * _Nullable comment))success failure:(void (^ _Nullable)(NSError * _Nullable error))failure; /** diff --git a/Sources/WordPressKit/Services/CommentServiceRemoteREST.m b/Sources/WordPressKit/Services/CommentServiceRemoteREST.m index 4b0f3761..3a610c20 100644 --- a/Sources/WordPressKit/Services/CommentServiceRemoteREST.m +++ b/Sources/WordPressKit/Services/CommentServiceRemoteREST.m @@ -246,7 +246,7 @@ - (void)syncHierarchicalCommentsForPost:(NSNumber *)postID - (void)updateCommentWithID:(NSNumber *)commentID content:(NSString *)content - success:(void (^)(void))success + success:(void (^)(RemoteComment *comment))success failure:(void (^)(NSError *error))failure { NSString *path = [NSString stringWithFormat:@"sites/%@/comments/%@", self.siteID, commentID]; @@ -260,14 +260,15 @@ - (void)updateCommentWithID:(NSNumber *)commentID [self.wordPressComRESTAPI post:requestUrl parameters:parameters success:^(id responseObject, NSHTTPURLResponse *httpResponse) { - if (success) { - success(); - } - } failure:^(NSError *error, NSHTTPURLResponse *httpResponse) { - if (failure) { - failure(error); - } - }]; + RemoteComment *comment = [self remoteCommentFromJSONDictionary:responseObject]; + if (success) { + success(comment); + } + } failure:^(NSError *error, NSHTTPURLResponse *httpResponse) { + if (failure) { + failure(error); + } + }]; } - (void)replyToPostWithID:(NSNumber *)postID diff --git a/Tests/WordPressKitTests/Tests/RemoteReaderPostTests.m b/Tests/WordPressKitTests/Tests/RemoteReaderPostTests.m index c5aedf61..565020a1 100644 --- a/Tests/WordPressKitTests/Tests/RemoteReaderPostTests.m +++ b/Tests/WordPressKitTests/Tests/RemoteReaderPostTests.m @@ -209,7 +209,7 @@ - (void)testFeaturedImageFromDictionary { uri, uri, uri] }; imagePath = [remoteReaderPost featuredImageFromPostDictionary:dict]; - XCTAssertTrue([uri isEqualToString:imagePath], @"Failed to retrieve the image uri from the post content."); + XCTAssertTrue(imagePath.length == 0, @"No image should be retrieved from the content"); dict = [self editorialDictionaryWithKey:@"image" value:uri]; imagePath = [remoteReaderPost featuredImageFromPostDictionary:dict];