From 9c239c5c2c9172b8de0e93299df635b783517751 Mon Sep 17 00:00:00 2001 From: kean Date: Thu, 20 Feb 2025 10:47:49 -0500 Subject: [PATCH] Add RemoteComment as a reponse object in CommentServiceRemote --- Package.swift | 4 ++-- .../Services/CommentServiceRemoteREST.h | 2 +- .../Services/CommentServiceRemoteREST.m | 19 ++++++++++--------- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/Package.swift b/Package.swift index b7b5df79..909507a2 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/19034071/WordPressKit.zip", + checksum: "56b34223272bd84b4530591889b274f6fc4781b62abe9b0dc0e6ae2f3c364442" ), ] ) 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