feat(creator): 선물 신청 진입점을 추가한다
This commit is contained in:
+25
-2
@@ -80,6 +80,7 @@ import kr.co.vividnext.sodalive.v2.creator.channel.model.CreatorChannelScrollSta
|
|||||||
import kr.co.vividnext.sodalive.v2.creator.channel.model.CreatorChannelTab
|
import kr.co.vividnext.sodalive.v2.creator.channel.model.CreatorChannelTab
|
||||||
import kr.co.vividnext.sodalive.v2.creator.channel.model.CreatorChannelTitleBarState
|
import kr.co.vividnext.sodalive.v2.creator.channel.model.CreatorChannelTitleBarState
|
||||||
import kr.co.vividnext.sodalive.v2.creator.channel.series.CreatorChannelSeriesFragment
|
import kr.co.vividnext.sodalive.v2.creator.channel.series.CreatorChannelSeriesFragment
|
||||||
|
import kr.co.vividnext.sodalive.v2.gift.GiftSendRequestActivity
|
||||||
import kr.co.vividnext.sodalive.v2.live.action.LiveActionCoordinator
|
import kr.co.vividnext.sodalive.v2.live.action.LiveActionCoordinator
|
||||||
import kr.co.vividnext.sodalive.v2.live.action.LiveCreationResult
|
import kr.co.vividnext.sodalive.v2.live.action.LiveCreationResult
|
||||||
import kr.co.vividnext.sodalive.v2.live.action.resolveLiveCreationResult
|
import kr.co.vividnext.sodalive.v2.live.action.resolveLiveCreationResult
|
||||||
@@ -258,6 +259,17 @@ class CreatorChannelActivity :
|
|||||||
handleChatAction(ChatActionCommand.DmCreator(creatorId))
|
handleChatAction(ChatActionCommand.DmCreator(creatorId))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
binding.tvGiftSendButton.setOnClickListener {
|
||||||
|
val header = currentHeader ?: return@setOnClickListener
|
||||||
|
if (!canSendCreatorGift(header.isOwner, header.isDmAvailable)) return@setOnClickListener
|
||||||
|
startActivity(
|
||||||
|
GiftSendRequestActivity.newIntent(
|
||||||
|
context = this,
|
||||||
|
creatorMemberId = creatorId,
|
||||||
|
creatorNickname = header.nickname
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onFollowerCountClicked() {
|
private fun onFollowerCountClicked() {
|
||||||
@@ -281,7 +293,8 @@ class CreatorChannelActivity :
|
|||||||
}
|
}
|
||||||
updateActionButtonLayout(
|
updateActionButtonLayout(
|
||||||
isChatVisible = !header.isOwner && header.isAiChatAvailable && header.characterId != null,
|
isChatVisible = !header.isOwner && header.isAiChatAvailable && header.characterId != null,
|
||||||
isDmVisible = header.isOwner || header.isDmAvailable
|
isDmVisible = header.isOwner || header.isDmAvailable,
|
||||||
|
isGiftVisible = canSendCreatorGift(header.isOwner, header.isDmAvailable)
|
||||||
)
|
)
|
||||||
binding.tvDmButton.setText(
|
binding.tvDmButton.setText(
|
||||||
if (header.isOwner) R.string.creator_channel_dm_check_button else R.string.creator_channel_dm_button
|
if (header.isOwner) R.string.creator_channel_dm_check_button else R.string.creator_channel_dm_button
|
||||||
@@ -426,12 +439,20 @@ class CreatorChannelActivity :
|
|||||||
WindowCompat.getInsetsController(window, binding.root).isAppearanceLightStatusBars = false
|
WindowCompat.getInsetsController(window, binding.root).isAppearanceLightStatusBars = false
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateActionButtonLayout(isChatVisible: Boolean, isDmVisible: Boolean) {
|
private fun updateActionButtonLayout(
|
||||||
|
isChatVisible: Boolean,
|
||||||
|
isDmVisible: Boolean,
|
||||||
|
isGiftVisible: Boolean
|
||||||
|
) {
|
||||||
binding.tvChatButton.isVisible = isChatVisible
|
binding.tvChatButton.isVisible = isChatVisible
|
||||||
binding.tvDmButton.isVisible = isDmVisible
|
binding.tvDmButton.isVisible = isDmVisible
|
||||||
|
binding.tvGiftSendButton.isVisible = isGiftVisible
|
||||||
(binding.tvDmButton.layoutParams as LinearLayout.LayoutParams).apply {
|
(binding.tvDmButton.layoutParams as LinearLayout.LayoutParams).apply {
|
||||||
marginStart = if (isChatVisible && isDmVisible) 6.dpToPx().toInt() else 0
|
marginStart = if (isChatVisible && isDmVisible) 6.dpToPx().toInt() else 0
|
||||||
}.also(binding.tvDmButton::setLayoutParams)
|
}.also(binding.tvDmButton::setLayoutParams)
|
||||||
|
(binding.tvGiftSendButton.layoutParams as LinearLayout.LayoutParams).apply {
|
||||||
|
marginStart = if ((isChatVisible || isDmVisible) && isGiftVisible) 6.dpToPx().toInt() else 0
|
||||||
|
}.also(binding.tvGiftSendButton::setLayoutParams)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onMoreClicked() {
|
private fun onMoreClicked() {
|
||||||
@@ -1329,3 +1350,5 @@ internal fun calculateCreatorChannelRemainingScroll(
|
|||||||
viewportHeight: Int,
|
viewportHeight: Int,
|
||||||
scrollY: Int
|
scrollY: Int
|
||||||
): Int = contentHeight - viewportHeight - scrollY
|
): Int = contentHeight - viewportHeight - scrollY
|
||||||
|
|
||||||
|
internal fun canSendCreatorGift(isOwner: Boolean, isDmAvailable: Boolean): Boolean = !isOwner && isDmAvailable
|
||||||
|
|||||||
@@ -114,6 +114,21 @@
|
|||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
app:drawableStartCompat="@drawable/ic_new_dm"
|
app:drawableStartCompat="@drawable/ic_new_dm"
|
||||||
tools:visibility="visible" />
|
tools:visibility="visible" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_gift_send_button"
|
||||||
|
style="@style/Typography.Body2"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="44dp"
|
||||||
|
android:layout_marginStart="@dimen/spacing_6"
|
||||||
|
android:background="@drawable/bg_creator_channel_outline_button"
|
||||||
|
android:gravity="center"
|
||||||
|
android:minWidth="108dp"
|
||||||
|
android:paddingHorizontal="@dimen/spacing_12"
|
||||||
|
android:text="@string/gift_send_title"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:visibility="gone"
|
||||||
|
tools:visibility="visible" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|||||||
+28
@@ -0,0 +1,28 @@
|
|||||||
|
package kr.co.vividnext.sodalive.v2.creator.channel
|
||||||
|
|
||||||
|
import org.junit.Assert.assertFalse
|
||||||
|
import org.junit.Assert.assertTrue
|
||||||
|
import org.junit.Test
|
||||||
|
|
||||||
|
class CreatorChannelGiftEligibilityTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `비소유자이고 DM 가능이면 선물 보내기 버튼을 표시한다`() {
|
||||||
|
assertTrue(canSendCreatorGift(isOwner = false, isDmAvailable = true))
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `비소유자라도 DM 불가이면 선물 보내기 버튼을 숨긴다`() {
|
||||||
|
assertFalse(canSendCreatorGift(isOwner = false, isDmAvailable = false))
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `소유자는 DM 가능 상태여도 선물 보내기 버튼을 숨긴다`() {
|
||||||
|
assertFalse(canSendCreatorGift(isOwner = true, isDmAvailable = true))
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `소유자이고 DM 불가이면 선물 보내기 버튼을 숨긴다`() {
|
||||||
|
assertFalse(canSendCreatorGift(isOwner = true, isDmAvailable = false))
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package kr.co.vividnext.sodalive.v2.gift
|
||||||
|
|
||||||
|
import org.junit.Assert.assertEquals
|
||||||
|
import org.junit.Assert.assertNull
|
||||||
|
import org.junit.Assert.assertNotNull
|
||||||
|
import org.junit.Test
|
||||||
|
|
||||||
|
class GiftSendEntryPolicyTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `회원번호가 0 이하이면 진입 정보가 거부된다`() {
|
||||||
|
assertNull(GiftSendRequestPresenter.toValidEntry(0L, "크리에이터"))
|
||||||
|
assertNull(GiftSendRequestPresenter.toValidEntry(-1L, "크리에이터"))
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `닉네임이 비어 있거나 공백이면 진입 정보가 거부된다`() {
|
||||||
|
assertNull(GiftSendRequestPresenter.toValidEntry(1L, ""))
|
||||||
|
assertNull(GiftSendRequestPresenter.toValidEntry(1L, " "))
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `유효한 회원번호와 닉네임이면 진입 정보를 반환한다`() {
|
||||||
|
val entry = GiftSendRequestPresenter.toValidEntry(1L, "크리에이터")
|
||||||
|
|
||||||
|
assertNotNull(entry)
|
||||||
|
assertEquals(GiftSendEntry(1L, "크리에이터"), entry)
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user