콘텐츠 상세

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

View File

@ -113,6 +113,17 @@
<option name="screenX" value="1440" /> <option name="screenX" value="1440" />
<option name="screenY" value="3088" /> <option name="screenY" value="3088" />
</PersistentDeviceSelectionData> </PersistentDeviceSelectionData>
<PersistentDeviceSelectionData>
<option name="api" value="34" />
<option name="brand" value="samsung" />
<option name="codename" value="e1q" />
<option name="id" value="e1q" />
<option name="manufacturer" value="Samsung" />
<option name="name" value="Galaxy S24" />
<option name="screenDensity" value="480" />
<option name="screenX" value="1080" />
<option name="screenY" value="2340" />
</PersistentDeviceSelectionData>
<PersistentDeviceSelectionData> <PersistentDeviceSelectionData>
<option name="api" value="33" /> <option name="api" value="33" />
<option name="brand" value="google" /> <option name="brand" value="google" />
@ -124,6 +135,17 @@
<option name="screenX" value="2208" /> <option name="screenX" value="2208" />
<option name="screenY" value="1840" /> <option name="screenY" value="1840" />
</PersistentDeviceSelectionData> </PersistentDeviceSelectionData>
<PersistentDeviceSelectionData>
<option name="api" value="34" />
<option name="brand" value="google" />
<option name="codename" value="felix" />
<option name="id" value="felix" />
<option name="manufacturer" value="Google" />
<option name="name" value="Pixel Fold" />
<option name="screenDensity" value="420" />
<option name="screenX" value="2208" />
<option name="screenY" value="1840" />
</PersistentDeviceSelectionData>
<PersistentDeviceSelectionData> <PersistentDeviceSelectionData>
<option name="api" value="33" /> <option name="api" value="33" />
<option name="brand" value="google" /> <option name="brand" value="google" />

View File

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

View File

@ -1,12 +1,12 @@
package kr.co.vividnext.sodalive.audio_content.comment package kr.co.vividnext.sodalive.audio_content.comment
import com.google.gson.annotations.SerializedName
import androidx.annotation.Keep import androidx.annotation.Keep
import com.google.gson.annotations.SerializedName
@Keep @Keep
data class RegisterAudioContentCommentRequest( data class RegisterAudioContentCommentRequest(
@SerializedName("comment") val comment: String, @SerializedName("comment") val comment: String,
@SerializedName("contentId") val contentId: Long, @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.text = response.commentList[0].comment
binding.tvCommentText.visibility = View.VISIBLE binding.tvCommentText.visibility = View.VISIBLE
binding.rlInputComment.visibility = View.GONE binding.rlInputComment.visibility = View.GONE
binding.tvSecret.visibility = View.GONE
binding.llComment.setOnClickListener { showCommentBottomSheetDialog() } binding.llComment.setOnClickListener { showCommentBottomSheetDialog() }
} else { } else {
@ -482,8 +483,20 @@ class AudioContentDetailActivity : BaseActivity<ActivityAudioContentDetailBindin
binding.ivCommentSend.setOnClickListener { binding.ivCommentSend.setOnClickListener {
val comment = binding.etComment.text.toString() val comment = binding.etComment.text.toString()
val isSecret = binding.tvSecret.isSelected
viewModel.registerComment(audioContentId, comment, isSecret)
binding.etComment.setText("") 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 {} 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!!) { if (!isLoading.value!!) {
isLoading.value = true isLoading.value = true
} }
@ -263,6 +263,7 @@ class AudioContentDetailViewModel(
commentRepository.registerComment( commentRepository.registerComment(
contentId = audioContentId, contentId = audioContentId,
comment = comment, comment = comment,
isSecret = isSecret,
token = "Bearer ${SharedPreferenceManager.token}" token = "Bearer ${SharedPreferenceManager.token}"
) )
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())

View File

@ -604,6 +604,10 @@
android:orientation="vertical" android:orientation="vertical"
android:padding="10.3dp"> android:padding="10.3dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -628,6 +632,23 @@
tools:text="1,204" /> tools:text="1,204" />
</LinearLayout> </LinearLayout>
<TextView
android:id="@+id/tv_secret"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:button="@null"
android:drawablePadding="8dp"
android:fontFamily="@font/gmarket_sans_medium"
android:gravity="center"
android:text="비밀댓글"
android:textColor="@color/color_eeeeee"
android:textSize="12.5sp"
android:visibility="gone"
app:drawableStartCompat="@drawable/ic_select" />
</RelativeLayout>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"