fix(gift): 크리에이터 채널 선물 진입을 제한한다
This commit is contained in:
+24
-3
@@ -47,6 +47,7 @@ import kr.co.vividnext.sodalive.live.LiveViewModel
|
|||||||
import kr.co.vividnext.sodalive.live.room.create.LiveRoomCreateActivity
|
import kr.co.vividnext.sodalive.live.room.create.LiveRoomCreateActivity
|
||||||
import kr.co.vividnext.sodalive.live.room.donation.LiveRoomDonationDialog
|
import kr.co.vividnext.sodalive.live.room.donation.LiveRoomDonationDialog
|
||||||
import kr.co.vividnext.sodalive.report.UserReportDialog
|
import kr.co.vividnext.sodalive.report.UserReportDialog
|
||||||
|
import kr.co.vividnext.sodalive.settings.language.LanguageManager
|
||||||
import kr.co.vividnext.sodalive.v2.access.AccessRequirement
|
import kr.co.vividnext.sodalive.v2.access.AccessRequirement
|
||||||
import kr.co.vividnext.sodalive.v2.access.ensureV2Access
|
import kr.co.vividnext.sodalive.v2.access.ensureV2Access
|
||||||
import kr.co.vividnext.sodalive.v2.chat.action.ChatActionCommand
|
import kr.co.vividnext.sodalive.v2.chat.action.ChatActionCommand
|
||||||
@@ -80,6 +81,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.GiftInboxEntryPolicy
|
||||||
import kr.co.vividnext.sodalive.v2.gift.GiftSendRequestActivity
|
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
|
||||||
@@ -261,7 +263,16 @@ class CreatorChannelActivity :
|
|||||||
}
|
}
|
||||||
binding.tvGiftSendButton.setOnClickListener {
|
binding.tvGiftSendButton.setOnClickListener {
|
||||||
val header = currentHeader ?: return@setOnClickListener
|
val header = currentHeader ?: return@setOnClickListener
|
||||||
if (!canSendCreatorGift(header.isOwner, header.isDmAvailable)) return@setOnClickListener
|
if (
|
||||||
|
!canSendCreatorGift(
|
||||||
|
isOwner = header.isOwner,
|
||||||
|
isDmAvailable = header.isDmAvailable,
|
||||||
|
countryCode = SharedPreferenceManager.countryCode,
|
||||||
|
languageCode = LanguageManager.getEffectiveLanguage(this)
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
return@setOnClickListener
|
||||||
|
}
|
||||||
startActivity(
|
startActivity(
|
||||||
GiftSendRequestActivity.newIntent(
|
GiftSendRequestActivity.newIntent(
|
||||||
context = this,
|
context = this,
|
||||||
@@ -295,7 +306,12 @@ 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)
|
isGiftVisible = canSendCreatorGift(
|
||||||
|
isOwner = header.isOwner,
|
||||||
|
isDmAvailable = header.isDmAvailable,
|
||||||
|
countryCode = SharedPreferenceManager.countryCode,
|
||||||
|
languageCode = LanguageManager.getEffectiveLanguage(this)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
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
|
||||||
@@ -1352,4 +1368,9 @@ internal fun calculateCreatorChannelRemainingScroll(
|
|||||||
scrollY: Int
|
scrollY: Int
|
||||||
): Int = contentHeight - viewportHeight - scrollY
|
): Int = contentHeight - viewportHeight - scrollY
|
||||||
|
|
||||||
internal fun canSendCreatorGift(isOwner: Boolean, isDmAvailable: Boolean): Boolean = !isOwner && isDmAvailable
|
internal fun canSendCreatorGift(
|
||||||
|
isOwner: Boolean,
|
||||||
|
isDmAvailable: Boolean,
|
||||||
|
countryCode: String,
|
||||||
|
languageCode: String
|
||||||
|
): Boolean = !isOwner && isDmAvailable && GiftInboxEntryPolicy.shouldShow(countryCode, languageCode)
|
||||||
|
|||||||
+57
-5
@@ -7,22 +7,74 @@ import org.junit.Test
|
|||||||
class CreatorChannelGiftEligibilityTest {
|
class CreatorChannelGiftEligibilityTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `비소유자이고 DM 가능이면 선물 보내기 버튼을 표시한다`() {
|
fun `비소유자이고 DM 가능이며 한국 접속과 한국어이면 선물 보내기 버튼을 표시한다`() {
|
||||||
assertTrue(canSendCreatorGift(isOwner = false, isDmAvailable = true))
|
assertTrue(
|
||||||
|
canSendCreatorGift(
|
||||||
|
isOwner = false,
|
||||||
|
isDmAvailable = true,
|
||||||
|
countryCode = "KR",
|
||||||
|
languageCode = "ko"
|
||||||
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `비소유자라도 DM 불가이면 선물 보내기 버튼을 숨긴다`() {
|
fun `비소유자라도 DM 불가이면 선물 보내기 버튼을 숨긴다`() {
|
||||||
assertFalse(canSendCreatorGift(isOwner = false, isDmAvailable = false))
|
assertFalse(
|
||||||
|
canSendCreatorGift(
|
||||||
|
isOwner = false,
|
||||||
|
isDmAvailable = false,
|
||||||
|
countryCode = "KR",
|
||||||
|
languageCode = "ko"
|
||||||
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `소유자는 DM 가능 상태여도 선물 보내기 버튼을 숨긴다`() {
|
fun `소유자는 DM 가능 상태여도 선물 보내기 버튼을 숨긴다`() {
|
||||||
assertFalse(canSendCreatorGift(isOwner = true, isDmAvailable = true))
|
assertFalse(
|
||||||
|
canSendCreatorGift(
|
||||||
|
isOwner = true,
|
||||||
|
isDmAvailable = true,
|
||||||
|
countryCode = "KR",
|
||||||
|
languageCode = "ko"
|
||||||
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `소유자이고 DM 불가이면 선물 보내기 버튼을 숨긴다`() {
|
fun `소유자이고 DM 불가이면 선물 보내기 버튼을 숨긴다`() {
|
||||||
assertFalse(canSendCreatorGift(isOwner = true, isDmAvailable = false))
|
assertFalse(
|
||||||
|
canSendCreatorGift(
|
||||||
|
isOwner = true,
|
||||||
|
isDmAvailable = false,
|
||||||
|
countryCode = "KR",
|
||||||
|
languageCode = "ko"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `한국 접속이라도 유효 언어가 한국어가 아니면 선물 보내기 버튼을 숨긴다`() {
|
||||||
|
assertFalse(
|
||||||
|
canSendCreatorGift(
|
||||||
|
isOwner = false,
|
||||||
|
isDmAvailable = true,
|
||||||
|
countryCode = "KR",
|
||||||
|
languageCode = "en"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `유효 언어가 한국어라도 한국 접속이 아니면 선물 보내기 버튼을 숨긴다`() {
|
||||||
|
assertFalse(
|
||||||
|
canSendCreatorGift(
|
||||||
|
isOwner = false,
|
||||||
|
isDmAvailable = true,
|
||||||
|
countryCode = "JP",
|
||||||
|
languageCode = "ko"
|
||||||
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user