feat(content): 전체보기 UI 모델 매핑을 추가한다

This commit is contained in:
2026-06-27 08:29:19 +09:00
parent b772e5416e
commit 0a4b88fabe
5 changed files with 184 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
package kr.co.vividnext.sodalive.v2.main.content.overview.model
import kr.co.vividnext.sodalive.v2.main.content.overview.data.ContentOverviewItemResponse
import kr.co.vividnext.sodalive.v2.main.content.overview.data.ContentOverviewPageResponse
import kr.co.vividnext.sodalive.v2.widget.AudioContentTag
fun ContentOverviewPageResponse.toContent(): ContentOverviewUiState.Content {
return ContentOverviewUiState.Content(
type = type,
totalCount = items.size,
items = items.map { it.toUiModel() },
page = page,
size = size,
hasNext = hasNext
)
}
fun ContentOverviewItemResponse.toUiModel(): ContentOverviewUiModel = ContentOverviewUiModel(
contentId = contentId,
title = title,
coverImage = coverImage,
creatorNickname = creatorNickname,
tags = toAudioContentTags(),
showAdultBadge = isAdult
)
private fun ContentOverviewItemResponse.toAudioContentTags(): Set<AudioContentTag> = buildSet {
if (isOriginalSeries) add(AudioContentTag.Original)
if (isFirstContent) add(AudioContentTag.First)
if (isPointAvailable) add(AudioContentTag.Point)
if (price == 0) add(AudioContentTag.Free)
}

View File

@@ -0,0 +1,21 @@
package kr.co.vividnext.sodalive.v2.main.content.overview.model
import androidx.annotation.StringRes
import kr.co.vividnext.sodalive.R
import kr.co.vividnext.sodalive.v2.main.content.overview.data.ContentOverviewType
import kr.co.vividnext.sodalive.v2.widget.AudioContentTag
data class ContentOverviewUiModel(
val contentId: Long,
val title: String,
val coverImage: String?,
val creatorNickname: String,
val tags: Set<AudioContentTag>,
val showAdultBadge: Boolean
)
@StringRes
fun ContentOverviewType.toTitleResId(): Int = when (this) {
ContentOverviewType.NEW_AND_HOT_AUDIO -> R.string.content_recommendation_section_new_and_hot
ContentOverviewType.FIRST_AUDIO_CONTENT -> R.string.home_recommendation_section_first_audio_contents
}

View File

@@ -0,0 +1,19 @@
package kr.co.vividnext.sodalive.v2.main.content.overview.model
import kr.co.vividnext.sodalive.v2.main.content.overview.data.ContentOverviewType
sealed interface ContentOverviewUiState {
data class Loading(val type: ContentOverviewType) : ContentOverviewUiState
data class Empty(val type: ContentOverviewType, val totalCount: Int) : ContentOverviewUiState
data class Error(val type: ContentOverviewType, val message: String?) : ContentOverviewUiState
data class Content(
val type: ContentOverviewType,
val totalCount: Int,
val items: List<ContentOverviewUiModel>,
val page: Int,
val size: Int,
val hasNext: Boolean,
val isLoadingMore: Boolean = false,
val paginationErrorMessage: String? = null
) : ContentOverviewUiState
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 401 B