Like Comment
The LikeMinds Android Feed SDK, users can express their appreciation for a comment by "liking" it. This feature allows members to indicate their support or agreement with a particular comment in a simple and intuitive manner.
Steps to like a comment
- Create a LikeCommentRequest object using
LikeCommentRequest.Builder
class by passing all the required parameters. - Call
likeComment()
function using the instance ofLMFeedClient
. - Process the response (
LMResponse<Nothing>
) as per your requirement.
CoroutineScope(Dispatchers.IO).launch {
// object of LikeCommentRequest
val likeCommentRequest = LikeCommentRequest.Builder()
.postId("ENTER POST ID") // post id of the liked comment
.commentId("ENTER COMMENT ID") // id of the comment liked
.build()
// get response (LMResponse<Nothing>)
val response = LMFeedClient.getInstance().likeComment(likeCommentRequest)
if (response.success) {
// your function to process comment liked action
processCommentLiked()
} else {
// your function to process error message
processError(response.errorMessage)
}
}
note
Same function can be used to like a reply as well. Just pass the id of the reply as comment id.
Models
LikeCommentRequest
VARIABLE | TYPE | DESCRIPTION | OPTIONAL |
---|---|---|---|
postId | String | Post ID of the liked comment. | |
commentId | String | Unique ID of the comment liked. |