From a01675b59260167d2bc8fd0431729410ec72b1ab Mon Sep 17 00:00:00 2001 From: klaus Date: Tue, 16 Jun 2026 19:21:54 +0900 Subject: [PATCH] =?UTF-8?q?feat(creator):=20=EC=B1=84=EB=84=90=20=ED=9B=84?= =?UTF-8?q?=EC=9B=90=20empty=20=EC=83=81=ED=83=9C=EB=A5=BC=20=EB=A7=A4?= =?UTF-8?q?=ED=95=91=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../channel/model/CreatorChannelHomeMappers.kt | 5 +++-- .../channel/model/CreatorChannelHomeUiModels.kt | 5 ++++- .../channel/CreatorChannelHomeMapperTest.kt | 14 ++++++++++++-- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/kr/co/vividnext/sodalive/v2/creator/channel/model/CreatorChannelHomeMappers.kt b/app/src/main/java/kr/co/vividnext/sodalive/v2/creator/channel/model/CreatorChannelHomeMappers.kt index 333130c7..1e3897db 100644 --- a/app/src/main/java/kr/co/vividnext/sodalive/v2/creator/channel/model/CreatorChannelHomeMappers.kt +++ b/app/src/main/java/kr/co/vividnext/sodalive/v2/creator/channel/model/CreatorChannelHomeMappers.kt @@ -7,10 +7,11 @@ import kr.co.vividnext.sodalive.v2.creator.channel.data.CreatorChannelSnsRespons import java.net.URI fun CreatorChannelHomeResponse.toUiContent(currentMemberId: Long): CreatorChannelHomeUiState.Content { + val isOwner = creator.creatorId == currentMemberId val sections = buildList { currentLive?.let { add(CreatorChannelHomeSection.CurrentLive(it)) } latestAudioContent?.let { add(CreatorChannelHomeSection.LatestAudioContent(it)) } - channelDonations.takeIf { it.isNotEmpty() }?.let { add(CreatorChannelHomeSection.Donations(it)) } + add(CreatorChannelHomeSection.Donations(donations = channelDonations, isOwner = isOwner)) notices.takeIf { it.isNotEmpty() }?.let { add(CreatorChannelHomeSection.Notices(it)) } schedules.sortedBy { it.scheduledAtUtc }.take(MAX_SCHEDULE_ITEM_COUNT) .takeIf { it.isNotEmpty() } @@ -35,7 +36,7 @@ fun CreatorChannelHomeResponse.toUiContent(currentMemberId: Long): CreatorChanne isNotify = creator.isNotify, isAiChatAvailable = creator.isAiChatAvailable, isDmAvailable = creator.isDmAvailable, - isOwner = creator.creatorId == currentMemberId + isOwner = isOwner ), tabs = CreatorChannelTab.entries, sections = sections diff --git a/app/src/main/java/kr/co/vividnext/sodalive/v2/creator/channel/model/CreatorChannelHomeUiModels.kt b/app/src/main/java/kr/co/vividnext/sodalive/v2/creator/channel/model/CreatorChannelHomeUiModels.kt index 59b1db77..87c4ddda 100644 --- a/app/src/main/java/kr/co/vividnext/sodalive/v2/creator/channel/model/CreatorChannelHomeUiModels.kt +++ b/app/src/main/java/kr/co/vividnext/sodalive/v2/creator/channel/model/CreatorChannelHomeUiModels.kt @@ -49,7 +49,10 @@ data class CreatorChannelHeaderUiModel( sealed interface CreatorChannelHomeSection { data class CurrentLive(val live: CreatorChannelLiveResponse) : CreatorChannelHomeSection data class LatestAudioContent(val audioContent: CreatorChannelAudioContentResponse) : CreatorChannelHomeSection - data class Donations(val donations: List) : CreatorChannelHomeSection + data class Donations( + val donations: List, + val isOwner: Boolean + ) : CreatorChannelHomeSection data class Notices(val notices: List) : CreatorChannelHomeSection data class Schedules(val schedules: List) : CreatorChannelHomeSection data class AudioContents(val audioContents: List) : CreatorChannelHomeSection diff --git a/app/src/test/java/kr/co/vividnext/sodalive/v2/creator/channel/CreatorChannelHomeMapperTest.kt b/app/src/test/java/kr/co/vividnext/sodalive/v2/creator/channel/CreatorChannelHomeMapperTest.kt index 64417036..4f6bda7a 100644 --- a/app/src/test/java/kr/co/vividnext/sodalive/v2/creator/channel/CreatorChannelHomeMapperTest.kt +++ b/app/src/test/java/kr/co/vividnext/sodalive/v2/creator/channel/CreatorChannelHomeMapperTest.kt @@ -53,7 +53,16 @@ class CreatorChannelHomeMapperTest { } @Test - fun `null 단건 콘텐츠와 빈 리스트와 blank SNS는 팬Talk empty section만 생성한다`() { + fun `본인 채널 여부를 후원 section에도 매핑한다`() { + val ownerContent = response().toUiContent(currentMemberId = 100L) + val visitorContent = response().toUiContent(currentMemberId = 1L) + + assertTrue(ownerContent.sections.filterIsInstance().single().isOwner) + assertFalse(visitorContent.sections.filterIsInstance().single().isOwner) + } + + @Test + fun `null 단건 콘텐츠와 빈 리스트와 blank SNS는 후원 empty와 팬Talk empty section을 생성한다`() { val content = response( currentLive = null, latestAudioContent = null, @@ -76,7 +85,8 @@ class CreatorChannelHomeMapperTest { assertFalse(content.sections.any { it is CreatorChannelHomeSection.CurrentLive }) assertFalse(content.sections.any { it is CreatorChannelHomeSection.LatestAudioContent }) - assertFalse(content.sections.any { it is CreatorChannelHomeSection.Donations }) + val donations = content.sections.filterIsInstance().single() + assertTrue(donations.donations.isEmpty()) assertFalse(content.sections.any { it is CreatorChannelHomeSection.Notices }) assertFalse(content.sections.any { it is CreatorChannelHomeSection.Schedules }) assertFalse(content.sections.any { it is CreatorChannelHomeSection.AudioContents })