This commit is contained in:
chenjuntao
2019-09-11 17:22:57 +08:00
parent 8bd30d1a0f
commit 34ac30cdfe
17 changed files with 1008 additions and 33 deletions

View File

@ -97,16 +97,23 @@ public class PostCommentUtils {
});
}
public static void voteAnswerComment(final Context context, final String answerId, String articleId, String articleCommunityId,
final String commentId, final PostCommentListener listener) {
public static void likeComment(final Context context,
final String answerId,
String articleId,
String articleCommunityId,
String videoId,
final String commentId,
final PostCommentListener listener) {
Observable<ResponseBody> observable;
if (!TextUtils.isEmpty(answerId)) {
observable = RetrofitManager.getInstance(context).getApi().postVoteAnswerComment(answerId, commentId);
} else {
} else if (!TextUtils.isEmpty(articleId)) {
observable = RetrofitManager.getInstance(context).getApi().postVoteCommunityArticleComment(articleCommunityId, articleId, commentId);
} else {
observable = RetrofitManager.getInstance(context).getApi().postVoteToVideo(videoId, commentId);
}
observable
.subscribeOn(Schedulers.io())
@ -215,6 +222,30 @@ public class PostCommentUtils {
});
}
public static void reportVideoComment(final Context context,
final String videoId,
final String commentId,
final String reportData,
final PostCommentListener listener) {
RequestBody body = RequestBody.create(MediaType.parse("application/json"), reportData);
RetrofitManager.getInstance(context).getApi()
.postVideoCommentReport(videoId, commentId, body)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Response<ResponseBody>() {
@Override
public void onResponse(ResponseBody response) {
listener.postSuccess(null);
}
@Override
public void onFailure(HttpException e) {
listener.postFailed(e);
}
});
}
public interface PostCommentListener {
void postSuccess(JSONObject response);