feat(creator): 채널 sort 공통 모델을 추가한다
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package kr.co.vividnext.sodalive.v2.creator.channel.model
|
||||
|
||||
import androidx.annotation.StringRes
|
||||
import kr.co.vividnext.sodalive.R
|
||||
import kr.co.vividnext.sodalive.v2.common.data.ContentSort
|
||||
|
||||
data class CreatorChannelSortOptionUiModel(
|
||||
val sort: ContentSort,
|
||||
@param:StringRes val labelResId: Int,
|
||||
val isSelected: Boolean
|
||||
)
|
||||
|
||||
@StringRes
|
||||
fun ContentSort.toLabelResId(): Int = when (this) {
|
||||
ContentSort.LATEST -> R.string.screen_audio_content_sort_newest
|
||||
ContentSort.POPULAR -> R.string.screen_audio_content_sort_popularity
|
||||
ContentSort.OWNED -> R.string.creator_channel_live_sort_owned
|
||||
ContentSort.PRICE_HIGH -> R.string.screen_audio_content_sort_price_high
|
||||
ContentSort.PRICE_LOW -> R.string.screen_audio_content_sort_price_low
|
||||
}
|
||||
|
||||
fun ContentSort.toSortOptionUiModel(selectedSort: ContentSort): CreatorChannelSortOptionUiModel =
|
||||
CreatorChannelSortOptionUiModel(
|
||||
sort = this,
|
||||
labelResId = toLabelResId(),
|
||||
isSelected = this == selectedSort
|
||||
)
|
||||
Reference in New Issue
Block a user