feat(creator-channel): FanTalk 상세 모델을 추가한다

This commit is contained in:
2026-07-09 07:43:53 +09:00
parent 643fb9fa8e
commit 6916459c9e
4 changed files with 104 additions and 0 deletions
@@ -0,0 +1,101 @@
package kr.co.vividnext.sodalive.v2.creator.channel.fantalk.detail
import android.os.Parcelable
import androidx.annotation.StringRes
import kotlinx.parcelize.Parcelize
import kr.co.vividnext.sodalive.R
import kr.co.vividnext.sodalive.v2.creator.channel.fantalk.model.CreatorChannelFanTalkReplyUiModel
import kr.co.vividnext.sodalive.v2.creator.channel.fantalk.model.CreatorChannelFanTalkRightAction
import kr.co.vividnext.sodalive.v2.creator.channel.fantalk.model.CreatorChannelFanTalkUiModel
@Parcelize
data class CreatorChannelFanTalkDetailPayload(
val fanTalkId: Long,
val writerId: Long,
val writerNickname: String,
val writerProfileImageUrl: String,
val content: String,
val createdAtText: String,
val reply: CreatorChannelFanTalkDetailReplyPayload?,
val showEdit: Boolean,
val showDelete: Boolean
) : Parcelable {
fun toUiModel(): CreatorChannelFanTalkUiModel = CreatorChannelFanTalkUiModel(
fanTalkId = fanTalkId,
writerId = writerId,
writerNickname = writerNickname,
writerProfileImageUrl = writerProfileImageUrl,
content = content,
createdAtText = createdAtText,
reply = reply?.toUiModel(),
rightAction = CreatorChannelFanTalkRightAction.OwnerMore(showEdit = showEdit, showDelete = showDelete)
)
}
@Parcelize
data class CreatorChannelFanTalkDetailReplyPayload(
val fanTalkId: Long,
val writerId: Long,
val writerNickname: String,
val writerProfileImageUrl: String,
val content: String,
val createdAtText: String
) : Parcelable {
fun toUiModel(): CreatorChannelFanTalkReplyUiModel = CreatorChannelFanTalkReplyUiModel(
fanTalkId = fanTalkId,
writerId = writerId,
writerNickname = writerNickname,
writerProfileImageUrl = writerProfileImageUrl,
content = content,
createdAtText = createdAtText
)
}
fun CreatorChannelFanTalkUiModel.toFanTalkDetailPayload(): CreatorChannelFanTalkDetailPayload {
val ownerMore = rightAction as? CreatorChannelFanTalkRightAction.OwnerMore
return CreatorChannelFanTalkDetailPayload(
fanTalkId = fanTalkId,
writerId = writerId,
writerNickname = writerNickname,
writerProfileImageUrl = writerProfileImageUrl,
content = content,
createdAtText = createdAtText,
reply = reply?.toFanTalkDetailReplyPayload(),
showEdit = ownerMore?.showEdit == true,
showDelete = ownerMore?.showDelete == true
)
}
fun CreatorChannelFanTalkReplyUiModel.toFanTalkDetailReplyPayload(): CreatorChannelFanTalkDetailReplyPayload {
return CreatorChannelFanTalkDetailReplyPayload(
fanTalkId = fanTalkId,
writerId = writerId,
writerNickname = writerNickname,
writerProfileImageUrl = writerProfileImageUrl,
content = content,
createdAtText = createdAtText
)
}
data class CreatorChannelFanTalkReplacementModalUiModel(
@StringRes val titleResId: Int = R.string.screen_user_profile_reply_edit,
@StringRes val descriptionResId: Int = R.string.creator_channel_fantalk_reply_replace_description,
@StringRes val cancelResId: Int = R.string.cancel,
@StringRes val confirmResId: Int = R.string.confirm
)
sealed interface CreatorChannelFanTalkDetailEditTarget {
data class Reply(val replyFanTalkId: Long) : CreatorChannelFanTalkDetailEditTarget
}
sealed interface CreatorChannelFanTalkDetailUiState {
data class Content(
val parentFanTalk: CreatorChannelFanTalkUiModel,
val reply: CreatorChannelFanTalkReplyUiModel?,
val replyInput: String = "",
val isSubmitting: Boolean = false,
val editingTarget: CreatorChannelFanTalkDetailEditTarget? = null
) : CreatorChannelFanTalkDetailUiState {
val isSendEnabled: Boolean = replyInput.trim().isNotEmpty() && !isSubmitting
}
}