fix: 处理部分 SonarQube 问题
This commit is contained in:
@ -73,47 +73,8 @@ public class PostCommentUtils {
|
||||
});
|
||||
}
|
||||
|
||||
public static void addAnswerComment(final String answerId, final String articleId,
|
||||
final String articleCommunityId, final String content,
|
||||
final CommentEntity commentEntity,
|
||||
final PostCommentListener listener) {
|
||||
RequestBody body = RequestBody.create(MediaType.parse("application/json"), content);
|
||||
Observable<ResponseBody> observable;
|
||||
if (!TextUtils.isEmpty(articleId)) {
|
||||
if (commentEntity != null) {
|
||||
observable = RetrofitManager.getInstance().getApi().postReplyToCommunityArticleComment(commentEntity.getId(), body);
|
||||
} else {
|
||||
observable = RetrofitManager.getInstance().getApi().postCommentToCommunityArticle(articleId, body);
|
||||
}
|
||||
} else {
|
||||
if (commentEntity != null) {
|
||||
observable = RetrofitManager.getInstance().getApi().postReplyToAnswerComment(answerId, commentEntity.getId(), body);
|
||||
} else {
|
||||
observable = RetrofitManager.getInstance().getApi().postNewCommentToAnswer(answerId, body);
|
||||
}
|
||||
}
|
||||
observable.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Response<ResponseBody>() {
|
||||
@Override
|
||||
public void onResponse(ResponseBody response) {
|
||||
if (listener != null) {
|
||||
listener.postSuccess(new JSONObject());// 不需要返回
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(HttpException e) {
|
||||
if (listener != null) {
|
||||
listener.postFailed(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void likeComment(final String answerId,
|
||||
String articleId,
|
||||
String articleCommunityId,
|
||||
String videoId,
|
||||
String questionId,
|
||||
final String commentId,
|
||||
@ -252,9 +213,7 @@ public class PostCommentUtils {
|
||||
});
|
||||
}
|
||||
|
||||
public static void reportCommunityArticleComment(final String communityId,
|
||||
final String articleId,
|
||||
final String commentId,
|
||||
public static void reportCommunityArticleComment(final String commentId,
|
||||
final String reportData,
|
||||
final PostCommentListener listener) {
|
||||
RequestBody body = RequestBody.create(MediaType.parse("application/json"), reportData);
|
||||
|
||||
Reference in New Issue
Block a user