refactor(creator): 라이브 replay adapter를 공통화한다

This commit is contained in:
2026-06-19 21:03:47 +09:00
parent 9d7bc6969b
commit 3a421d2a60
6 changed files with 44 additions and 62 deletions

View File

@@ -119,7 +119,7 @@ class CreatorChannelLiveFragmentLayoutTest {
val item = inflateView(R.layout.item_creator_channel_audio_content)
val itemLayout = projectFile("app/src/main/res/layout/item_creator_channel_audio_content.xml").readText()
val adapter = projectFile(
"app/src/main/java/kr/co/vividnext/sodalive/v2/creator/channel/live/ui/CreatorChannelLiveReplayAdapter.kt"
"app/src/main/java/kr/co/vividnext/sodalive/v2/creator/channel/ui/CreatorChannelAudioContentAdapter.kt"
).readText()
val thumbnail = requireNotNull(item.findViewById<View>(R.id.layout_creator_channel_audio_content_thumbnail))
@@ -195,7 +195,7 @@ class CreatorChannelLiveFragmentLayoutTest {
"app/src/main/java/kr/co/vividnext/sodalive/v2/creator/channel/live/CreatorChannelLiveFragment.kt"
).readText()
val adapter = projectFile(
"app/src/main/java/kr/co/vividnext/sodalive/v2/creator/channel/live/ui/CreatorChannelLiveReplayAdapter.kt"
"app/src/main/java/kr/co/vividnext/sodalive/v2/creator/channel/ui/CreatorChannelAudioContentAdapter.kt"
).readText()
val layout = projectFile("app/src/main/res/layout/fragment_creator_channel_live.xml").readText()
val eagerLoadOnViewCreated = """
@@ -250,22 +250,23 @@ class CreatorChannelLiveFragmentLayoutTest {
).readText()
val fragmentLayout = projectFile("app/src/main/res/layout/fragment_creator_channel_live.xml").readText()
assertTrue(activityLayout.contains("android:id=\"@+id/layout_creator_channel_live_owner_cta\""))
assertTrue(activityLayout.contains("android:id=\"@+id/layout_creator_channel_owner_cta\""))
assertTrue(activityLayout.contains("android:layout_height=\"100dp\""))
assertTrue(activityLayout.contains("android:background=\"@color/black\""))
assertTrue(activityLayout.contains("android:id=\"@+id/btn_creator_channel_live_owner_cta\""))
assertTrue(activityLayout.contains("android:id=\"@+id/btn_creator_channel_owner_cta\""))
assertTrue(activityLayout.contains("android:layout_marginHorizontal=\"@dimen/spacing_14\""))
assertTrue(activityLayout.contains("android:layout_marginTop=\"@dimen/spacing_14\""))
assertTrue(activityLayout.contains("@drawable/bg_creator_channel_owner_fab"))
assertTrue(activityLayout.contains("@drawable/ic_new_create_live"))
assertTrue(activityLayout.contains("@string/creator_channel_live_start_button"))
assertTrue(activity.contains("setupLiveOwnerCtaInsets()"))
assertTrue(activity.contains("updateLiveOwnerCtaVisibility()"))
assertTrue(activity.contains("binding.viewPager.currentItem == CreatorChannelTab.Live.ordinal"))
assertTrue(activity.contains("binding.layoutCreatorChannelLiveOwnerCta.isVisible = shouldShowLiveOwnerCta"))
assertTrue(activity.contains("setupOwnerCtaInsets()"))
assertTrue(activity.contains("updateOwnerCtaVisibility()"))
assertTrue(activity.contains("CreatorChannelTab.Live.ordinal -> CreatorChannelTab.Live"))
assertTrue(activity.contains("CreatorChannelTab.Audio.ordinal -> CreatorChannelTab.Audio"))
assertTrue(activity.contains("binding.layoutCreatorChannelOwnerCta.isVisible = shouldShowOwnerCta"))
assertTrue(
activity.contains(
"findLiveFragment()?.onCreatorChannelLiveOwnerCtaVisibilityChanged(shouldShowLiveOwnerCta)"
"findLiveFragment()?.onCreatorChannelLiveOwnerCtaVisibilityChanged(ownerCtaTab == CreatorChannelTab.Live)"
)
)
assertTrue(fragment.contains("fun onCreatorChannelLiveOwnerCtaVisibilityChanged(isVisible: Boolean)"))
@@ -273,10 +274,10 @@ class CreatorChannelLiveFragmentLayoutTest {
assertTrue(fragment.contains("LIVE_OWNER_CTA_LIST_BOTTOM_PADDING_DP.dpToPx().toInt()"))
assertTrue(fragment.contains("DEFAULT_LIST_BOTTOM_PADDING_DP.dpToPx().toInt()"))
assertTrue(fragment.contains("rvCreatorChannelLiveReplays.updatePadding(bottom = bottomPadding)"))
assertTrue(activity.contains("binding.btnCreatorChannelLiveOwnerCta.setOnClickListener"))
assertTrue(activity.contains("binding.btnCreatorChannelOwnerCta.setOnClickListener"))
assertTrue(activity.contains("onOwnerFabLiveClicked()"))
assertFalse(fragmentLayout.contains("android:id=\"@+id/layout_creator_channel_live_owner_cta\""))
assertFalse(fragment.contains("layoutCreatorChannelLiveOwnerCta"))
assertFalse(fragmentLayout.contains("android:id=\"@+id/layout_creator_channel_owner_cta\""))
assertFalse(fragment.contains("layoutCreatorChannelOwnerCta"))
}
@Test

View File

@@ -3,7 +3,7 @@ package kr.co.vividnext.sodalive.v2.creator.channel.live
import kr.co.vividnext.sodalive.R
import kr.co.vividnext.sodalive.v2.common.data.ContentSort
import kr.co.vividnext.sodalive.v2.creator.channel.data.CreatorChannelAudioContentResponse
import kr.co.vividnext.sodalive.v2.creator.channel.live.model.CreatorChannelLiveReplayStatus
import kr.co.vividnext.sodalive.v2.creator.channel.model.CreatorChannelAudioContentStatus
import kr.co.vividnext.sodalive.v2.creator.channel.live.model.toReplayUiModel
import kr.co.vividnext.sodalive.v2.creator.channel.model.toLabelResId
import kr.co.vividnext.sodalive.v2.widget.AudioContentTag
@@ -18,14 +18,14 @@ class CreatorChannelLiveMapperTest {
fun `소장과 대여가 동시에 true이면 소장중 상태를 우선 매핑한다`() {
val item = audioContent(isOwned = true, isRented = true).toReplayUiModel()
assertEquals(CreatorChannelLiveReplayStatus.Owned, item.status)
assertEquals(CreatorChannelAudioContentStatus.Owned, item.status)
}
@Test
fun `무료 콘텐츠는 무료 tag와 play CTA 상태로 매핑한다`() {
val item = audioContent(price = 0).toReplayUiModel()
assertEquals(CreatorChannelLiveReplayStatus.Play, item.status)
assertEquals(CreatorChannelAudioContentStatus.Play, item.status)
assertTrue(AudioContentTag.Free in item.tags)
}