From 318944fbfe8bb93ecb2edc068d24e1e822fddb67 Mon Sep 17 00:00:00 2001 From: klaus Date: Mon, 22 Jun 2026 00:36:42 +0900 Subject: [PATCH] =?UTF-8?q?fix(creator):=20=EC=BB=A4=EB=AE=A4=EB=8B=88?= =?UTF-8?q?=ED=8B=B0=20=EA=B2=8C=EC=8B=9C=EA=B8=80=20=ED=91=9C=EC=8B=9C=20?= =?UTF-8?q?=EC=A0=95=EC=B1=85=EC=9D=84=20=EB=B3=B4=EC=A0=95=ED=95=9C?= =?UTF-8?q?=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CreatorChannelCommunityViewModel.kt | 2 -- .../model/CreatorChannelCommunityMappers.kt | 15 ++++++++++----- .../model/CreatorChannelCommunityUiModels.kt | 1 + .../CreatorChannelCommunityMapperTest.kt | 17 +++++++++++++++++ 4 files changed, 28 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/kr/co/vividnext/sodalive/v2/creator/channel/community/CreatorChannelCommunityViewModel.kt b/app/src/main/java/kr/co/vividnext/sodalive/v2/creator/channel/community/CreatorChannelCommunityViewModel.kt index 7a0d6cb4..a11e48ff 100644 --- a/app/src/main/java/kr/co/vividnext/sodalive/v2/creator/channel/community/CreatorChannelCommunityViewModel.kt +++ b/app/src/main/java/kr/co/vividnext/sodalive/v2/creator/channel/community/CreatorChannelCommunityViewModel.kt @@ -2,7 +2,6 @@ package kr.co.vividnext.sodalive.v2.creator.channel.community import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData -import com.orhanobut.logger.Logger import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers import io.reactivex.rxjava3.schedulers.Schedulers import kr.co.vividnext.sodalive.base.BaseViewModel @@ -127,7 +126,6 @@ class CreatorChannelCommunityViewModel( { if (generation != requestGeneration) return@subscribe - it.message?.let { message -> Logger.e(message) } val current = _communityStateLiveData.value as? CreatorChannelCommunityUiState.Content _communityStateLiveData.value = if (current != null && page > FIRST_PAGE) { current.copy(isLoadingMore = false, paginationErrorMessage = it.message) diff --git a/app/src/main/java/kr/co/vividnext/sodalive/v2/creator/channel/community/model/CreatorChannelCommunityMappers.kt b/app/src/main/java/kr/co/vividnext/sodalive/v2/creator/channel/community/model/CreatorChannelCommunityMappers.kt index 2761ce05..d553736d 100644 --- a/app/src/main/java/kr/co/vividnext/sodalive/v2/creator/channel/community/model/CreatorChannelCommunityMappers.kt +++ b/app/src/main/java/kr/co/vividnext/sodalive/v2/creator/channel/community/model/CreatorChannelCommunityMappers.kt @@ -20,7 +20,8 @@ private fun CreatorChannelCommunityPostResponse.toCommunityPostUiModel( ): CreatorChannelCommunityPostUiModel { val isLocked = price > 0 && !existOrdered && !isOwner val showOwnerActions = isOwner && creatorId == currentUserId - val showPlayButton = !isLocked && !audioUrl.isNullOrBlank() && !imageUrl.isNullOrBlank() + val visibleImageUrl = imageUrl.takeUnless { isLocked } + val showPlayButton = !isLocked && !audioUrl.isNullOrBlank() && !visibleImageUrl.isNullOrBlank() return CreatorChannelCommunityPostUiModel( postId = postId, creatorId = creatorId, @@ -28,7 +29,7 @@ private fun CreatorChannelCommunityPostResponse.toCommunityPostUiModel( creatorProfileUrl = creatorProfileUrl, createdAtText = relativeTimeTextFormatter.format(createdAtUtc), content = content, - imageUrl = imageUrl, + imageUrl = visibleImageUrl, audioUrl = audioUrl, price = price, existOrdered = existOrdered, @@ -36,18 +37,22 @@ private fun CreatorChannelCommunityPostResponse.toCommunityPostUiModel( commentCount = commentCount, showComment = isCommentAvailable, showNotice = isPinned, + isPinned = isPinned, isLocked = isLocked, showOwnerMore = showOwnerActions, showOwnerTopPrice = showOwnerActions && price > 0, showPlayButton = showPlayButton, gridPreviewText = content.toGridPreviewText(), - imageMode = toImageMode(isLocked) + imageMode = toImageMode(isLocked, visibleImageUrl) ) } -private fun CreatorChannelCommunityPostResponse.toImageMode(isLocked: Boolean): CreatorChannelCommunityImageMode = when { +private fun CreatorChannelCommunityPostResponse.toImageMode( + isLocked: Boolean, + visibleImageUrl: String? +): CreatorChannelCommunityImageMode = when { isLocked -> CreatorChannelCommunityImageMode.LockedGray - imageUrl.isNullOrBlank() -> CreatorChannelCommunityImageMode.TextPreview + visibleImageUrl.isNullOrBlank() -> CreatorChannelCommunityImageMode.TextPreview else -> CreatorChannelCommunityImageMode.Image } diff --git a/app/src/main/java/kr/co/vividnext/sodalive/v2/creator/channel/community/model/CreatorChannelCommunityUiModels.kt b/app/src/main/java/kr/co/vividnext/sodalive/v2/creator/channel/community/model/CreatorChannelCommunityUiModels.kt index 709dc188..e458a92c 100644 --- a/app/src/main/java/kr/co/vividnext/sodalive/v2/creator/channel/community/model/CreatorChannelCommunityUiModels.kt +++ b/app/src/main/java/kr/co/vividnext/sodalive/v2/creator/channel/community/model/CreatorChannelCommunityUiModels.kt @@ -39,6 +39,7 @@ data class CreatorChannelCommunityPostUiModel( val commentCount: Int, val showComment: Boolean, val showNotice: Boolean, + val isPinned: Boolean, val isLocked: Boolean, val showOwnerMore: Boolean, val showOwnerTopPrice: Boolean, diff --git a/app/src/test/java/kr/co/vividnext/sodalive/v2/creator/channel/community/CreatorChannelCommunityMapperTest.kt b/app/src/test/java/kr/co/vividnext/sodalive/v2/creator/channel/community/CreatorChannelCommunityMapperTest.kt index e40beaac..a3ce5f64 100644 --- a/app/src/test/java/kr/co/vividnext/sodalive/v2/creator/channel/community/CreatorChannelCommunityMapperTest.kt +++ b/app/src/test/java/kr/co/vividnext/sodalive/v2/creator/channel/community/CreatorChannelCommunityMapperTest.kt @@ -11,6 +11,7 @@ import kr.co.vividnext.sodalive.v2.creator.channel.community.model.CreatorChanne import kr.co.vividnext.sodalive.v2.creator.channel.community.model.toCommunityPostUiModels import org.junit.Assert.assertEquals import org.junit.Assert.assertFalse +import org.junit.Assert.assertNull import org.junit.Assert.assertTrue import org.junit.Test import org.junit.runner.RunWith @@ -71,10 +72,26 @@ class CreatorChannelCommunityMapperTest { ).toCommunityPostUiModels(relativeTimeTextFormatter, isOwner = false, currentUserId = 99L).single() assertTrue(item.isLocked) + assertNull(item.imageUrl) assertEquals(CreatorChannelCommunityImageMode.LockedGray, item.imageMode) assertFalse(item.showPlayButton) } + @Test + fun `고정 게시글 여부는 owner more 정책에서 사용할 수 있도록 UI 모델에 보존한다`() { + val pinnedItem = listOf(communityPost(isPinned = true)) + .toCommunityPostUiModels(relativeTimeTextFormatter, isOwner = true, currentUserId = 10L) + .single() + val normalItem = listOf(communityPost(isPinned = false)) + .toCommunityPostUiModels(relativeTimeTextFormatter, isOwner = true, currentUserId = 10L) + .single() + + assertTrue(pinnedItem.isPinned) + assertTrue(pinnedItem.showNotice) + assertFalse(normalItem.isPinned) + assertFalse(normalItem.showNotice) + } + @Test fun `본인 또는 구매한 사용자는 이미지와 오디오가 있으면 play button을 표시한다`() { val ownerItem = listOf(