feat(creator-channel): FanTalk 상세 모델을 추가한다
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -1018,6 +1018,7 @@
|
||||
<string name="screen_user_profile_reply_edit">Edit reply</string>
|
||||
<string name="screen_user_profile_reply_submit">Submit</string>
|
||||
<string name="screen_user_profile_reply_write">Write a reply</string>
|
||||
<string name="creator_channel_fantalk_reply_replace_description">The existing reply will be replaced with the new reply.\nDo you want to edit it?</string>
|
||||
<string name="screen_user_follower_list_title">Follower list</string>
|
||||
<string name="screen_user_follower_list_total_label">All</string>
|
||||
<string name="screen_user_follower_list_error_invalid_request">Invalid request.\ntry again.</string>
|
||||
|
||||
@@ -1018,6 +1018,7 @@
|
||||
<string name="screen_user_profile_reply_edit">返信修正</string>
|
||||
<string name="screen_user_profile_reply_submit">投稿</string>
|
||||
<string name="screen_user_profile_reply_write">返信を書く</string>
|
||||
<string name="creator_channel_fantalk_reply_replace_description">既存の返信が新しい返信に置き換えられます。\n修正しますか?</string>
|
||||
<string name="screen_user_follower_list_title">フォロワーリスト</string>
|
||||
<string name="screen_user_follower_list_total_label">全</string>
|
||||
<string name="screen_user_follower_list_error_invalid_request">無効なリクエストです。\n恐れ入りますが、もう一度お試しください。</string>
|
||||
|
||||
@@ -1017,6 +1017,7 @@
|
||||
<string name="screen_user_profile_reply_edit">답글 수정</string>
|
||||
<string name="screen_user_profile_reply_submit">등록</string>
|
||||
<string name="screen_user_profile_reply_write">답글 쓰기</string>
|
||||
<string name="creator_channel_fantalk_reply_replace_description">기존 답글이 신규 답글로 대체됩니다.\n수정하시겠어요?</string>
|
||||
<string name="screen_user_follower_list_title">팔로워 리스트</string>
|
||||
<string name="screen_user_follower_list_total_label">전체</string>
|
||||
<string name="screen_user_follower_list_error_invalid_request">잘못된 요청입니다.\n다시 시도해 주세요.</string>
|
||||
|
||||
Reference in New Issue
Block a user