fix: 处理部分 SonarQube 问题

This commit is contained in:
chenjuntao
2022-08-02 16:22:45 +08:00
parent c8cd753022
commit 9c11f7f70e
13 changed files with 75 additions and 132 deletions

View File

@ -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);