Add Comment
The LikeMinds Android Feed SDK, users can engage in interactive discussions by adding comments to posts. This enables users to express their thoughts, ask questions, and engage with other members in a dynamic and collaborative manner.
Steps to add a comment on post
- Create a AddCommentRequest object using
AddCommentRequest.Builder
class by passing all the required parameters. - Call
addComment()
function using the instance ofLMFeedClient
. - Process the response (LMResponse<AddCommentResponse>) as per your requirement.
CoroutineScope(Dispatchers.IO).launch {
// object of AddCommentRequest
val addCommentRequest = AddCommentRequest.Builder()
.postId("ENTER COMMENT ID") // id of the post on which member has commented
.text("ENTER REPLY TEXT") // comment text
.tempId("ENTER COMMENT TEMPORARY ID") // temporary id of the comment
.build()
// get response (LMResponse<AddCommentResponse>)
val response = LMFeedClient.getInstance().addComment(addCommentRequest)
if (response.success) {
// your function to process the response dataa
processAddCommentResponse(response.data)
} else {
// your function to process error message
processError(response.errorMessage)
}
}
Additional Features
Tag a User
To tag a user, use the getTaggingList() function to fetch the list of users that can be tagged, and use the format <<[user.name]|route://user_profile/[user.sdkClientInfo.uuid]>>
to embed it inside the text of the comment.
Models
AddCommentRequest
VARIABLE | TYPE | DESCRIPTION | OPTIONAL |
---|---|---|---|
postId | String | ID of the post on which member has commented. | |
text | String | Text content of the comment. |
AddCommentResponse
VARIABLE | TYPE | DESCRIPTION | OPTIONAL |
---|---|---|---|
comment | Comment | Object of the added comment. | |
users | Map<String, User> | Map of user unique id to user object. |