This commit is contained in:
juntao
2021-07-28 15:28:25 +08:00
parent 2a57994c7f
commit 369fdd24ef
2 changed files with 77 additions and 35 deletions

View File

@ -21,7 +21,6 @@ import com.lightgame.utils.Utils
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
import okhttp3.ResponseBody
import org.json.JSONException
import org.json.JSONObject
import retrofit2.HttpException
@ -160,8 +159,7 @@ object CommentHelper {
"投诉" -> {
context.ifLogin("回答详情-评论-投诉") {
showReportTypeDialog(context, !videoId.isNullOrEmpty()) { reportType ->
showReportTypeDialog(context) { reportType ->
val commentListener = object : PostCommentUtils.PostCommentListener {
override fun postSuccess(response: JSONObject?) {
Utils.toast(context, "感谢您的投诉")
@ -385,23 +383,10 @@ object CommentHelper {
}
}
private fun showReportTypeDialog(context: Context, isVideoComment: Boolean, reportCallback: (reportType: String) -> Unit) {
private fun showReportTypeDialog(context: Context, reportCallback: (reportType: String) -> Unit) {
val reportTypes = arrayListOf("垃圾广告营销", "恶意攻击谩骂", "淫秽色情信息", "违法有害信息", "其它")
if (!isVideoComment) {
DialogUtils.showListDialog(context, reportTypes, null) { text ->
val jsonObject = JSONObject()
try {
jsonObject.put("reason", text)
reportCallback.invoke(jsonObject.toString())
} catch (e: JSONException) {
e.printStackTrace()
}
}
} else {
DialogUtils.showVideoComplaintDialog(context, reportTypes, null) { text ->
reportCallback.invoke(text)
}
DialogUtils.showVideoComplaintDialog(context, reportTypes, null) { text ->
reportCallback.invoke(text)
}
}