콘텐츠 상세

- 댓글이 없을 때 유료 콘텐츠를 구매한 사람이 비밀댓글을 등록할 수 있는 기능 추가
This commit is contained in:
2024-08-30 13:11:56 +09:00
parent e38778d9e7
commit 6640130ef9
6 changed files with 81 additions and 22 deletions

View File

@@ -8,12 +8,14 @@ class AudioContentCommentRepository(private val api: AudioContentApi) {
contentId: Long,
comment: String,
parentId: Long? = null,
isSecret: Boolean = false,
token: String
) = api.registerComment(
request = RegisterAudioContentCommentRequest(
comment = comment,
contentId = contentId,
parentId = parentId
parentId = parentId,
isSecret = isSecret
),
authHeader = token
)

View File

@@ -1,12 +1,12 @@
package kr.co.vividnext.sodalive.audio_content.comment
import com.google.gson.annotations.SerializedName
import androidx.annotation.Keep
import com.google.gson.annotations.SerializedName
@Keep
data class RegisterAudioContentCommentRequest(
@SerializedName("comment") val comment: String,
@SerializedName("contentId") val contentId: Long,
@SerializedName("parentId") val parentId: Long?
@SerializedName("parentId") val parentId: Long?,
@SerializedName("isSecret") val isSecret: Boolean
)

View File

@@ -469,6 +469,7 @@ class AudioContentDetailActivity : BaseActivity<ActivityAudioContentDetailBindin
binding.tvCommentText.text = response.commentList[0].comment
binding.tvCommentText.visibility = View.VISIBLE
binding.rlInputComment.visibility = View.GONE
binding.tvSecret.visibility = View.GONE
binding.llComment.setOnClickListener { showCommentBottomSheetDialog() }
} else {
@@ -482,8 +483,20 @@ class AudioContentDetailActivity : BaseActivity<ActivityAudioContentDetailBindin
binding.ivCommentSend.setOnClickListener {
val comment = binding.etComment.text.toString()
val isSecret = binding.tvSecret.isSelected
viewModel.registerComment(audioContentId, comment, isSecret)
binding.etComment.setText("")
viewModel.registerComment(audioContentId, comment)
binding.tvSecret.isSelected = false
}
if (response.existOrdered) {
binding.tvSecret.visibility = View.VISIBLE
binding.tvSecret.setOnClickListener {
binding.tvSecret.isSelected = !binding.tvSecret.isSelected
}
} else {
binding.tvSecret.visibility = View.GONE
}
binding.llComment.setOnClickListener {}

View File

@@ -254,7 +254,7 @@ class AudioContentDetailViewModel(
)
}
fun registerComment(audioContentId: Long, comment: String) {
fun registerComment(audioContentId: Long, comment: String, isSecret: Boolean) {
if (!isLoading.value!!) {
isLoading.value = true
}
@@ -263,6 +263,7 @@ class AudioContentDetailViewModel(
commentRepository.registerComment(
contentId = audioContentId,
comment = comment,
isSecret = isSecret,
token = "Bearer ${SharedPreferenceManager.token}"
)
.subscribeOn(Schedulers.io())