feat(mypage): 선물함 진입점을 추가한다
This commit is contained in:
@@ -45,11 +45,14 @@ import kr.co.vividnext.sodalive.mypage.recent.RecentContentViewModel
|
|||||||
import kr.co.vividnext.sodalive.mypage.service_center.ServiceCenterActivity
|
import kr.co.vividnext.sodalive.mypage.service_center.ServiceCenterActivity
|
||||||
import kr.co.vividnext.sodalive.settings.SettingsActivity
|
import kr.co.vividnext.sodalive.settings.SettingsActivity
|
||||||
import kr.co.vividnext.sodalive.settings.event.EventActivity
|
import kr.co.vividnext.sodalive.settings.event.EventActivity
|
||||||
|
import kr.co.vividnext.sodalive.settings.language.LanguageManager
|
||||||
import kr.co.vividnext.sodalive.settings.notice.NoticeActivity
|
import kr.co.vividnext.sodalive.settings.notice.NoticeActivity
|
||||||
import kr.co.vividnext.sodalive.settings.notice.NoticeDetailActivity
|
import kr.co.vividnext.sodalive.settings.notice.NoticeDetailActivity
|
||||||
import kr.co.vividnext.sodalive.settings.notification.MemberRole
|
import kr.co.vividnext.sodalive.settings.notification.MemberRole
|
||||||
import kr.co.vividnext.sodalive.splash.SplashActivity
|
import kr.co.vividnext.sodalive.splash.SplashActivity
|
||||||
import kr.co.vividnext.sodalive.v2.creator.channel.CreatorChannelActivity
|
import kr.co.vividnext.sodalive.v2.creator.channel.CreatorChannelActivity
|
||||||
|
import kr.co.vividnext.sodalive.v2.gift.GiftInboxActivity
|
||||||
|
import kr.co.vividnext.sodalive.v2.gift.GiftInboxEntryPolicy
|
||||||
import kr.co.vividnext.sodalive.v2.main.MainV2Activity
|
import kr.co.vividnext.sodalive.v2.main.MainV2Activity
|
||||||
import org.koin.android.ext.android.inject
|
import org.koin.android.ext.android.inject
|
||||||
|
|
||||||
@@ -348,8 +351,23 @@ class MyPageFragment : BaseFragment<FragmentMyBinding>(FragmentMyBinding::inflat
|
|||||||
|
|
||||||
private fun buildFunctionButtonItems(isAuth: Boolean?): List<FunctionButtonItem> {
|
private fun buildFunctionButtonItems(isAuth: Boolean?): List<FunctionButtonItem> {
|
||||||
val isKoreanUser = SharedPreferenceManager.countryCode.ifBlank { "KR" } == "KR"
|
val isKoreanUser = SharedPreferenceManager.countryCode.ifBlank { "KR" } == "KR"
|
||||||
|
val items = mutableListOf<FunctionButtonItem>()
|
||||||
|
|
||||||
val items = mutableListOf(
|
if (
|
||||||
|
GiftInboxEntryPolicy.shouldShow(
|
||||||
|
countryCode = SharedPreferenceManager.countryCode,
|
||||||
|
languageCode = LanguageManager.getEffectiveLanguage(requireContext())
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
items += FunctionButtonItem(
|
||||||
|
iconRes = R.drawable.ic_my_present,
|
||||||
|
title = getString(R.string.gift_inbox_title)
|
||||||
|
) {
|
||||||
|
startActivity(GiftInboxActivity.newIntent(requireContext()))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
items += listOf(
|
||||||
FunctionButtonItem(
|
FunctionButtonItem(
|
||||||
iconRes = R.drawable.ic_my_storage,
|
iconRes = R.drawable.ic_my_storage,
|
||||||
title = getString(R.string.screen_my_storage)
|
title = getString(R.string.screen_my_storage)
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package kr.co.vividnext.sodalive.v2.gift
|
||||||
|
|
||||||
|
import kr.co.vividnext.sodalive.settings.language.LanguageManager
|
||||||
|
|
||||||
|
object GiftInboxEntryPolicy {
|
||||||
|
fun shouldShow(countryCode: String, languageCode: String): Boolean =
|
||||||
|
countryCode.ifBlank { "KR" } == "KR" && languageCode == LanguageManager.LANG_KO
|
||||||
|
}
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 9.2 KiB |
@@ -0,0 +1,47 @@
|
|||||||
|
package kr.co.vividnext.sodalive.v2.gift
|
||||||
|
|
||||||
|
import org.junit.Assert.assertFalse
|
||||||
|
import org.junit.Assert.assertTrue
|
||||||
|
import org.junit.Test
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
|
class GiftInboxEntryPolicyTest {
|
||||||
|
@Test
|
||||||
|
fun `한국 접속이고 유효 언어가 한국어일 때만 표시한다`() {
|
||||||
|
assertTrue(GiftInboxEntryPolicy.shouldShow("KR", "ko"))
|
||||||
|
assertFalse(GiftInboxEntryPolicy.shouldShow("KR", "en"))
|
||||||
|
assertFalse(GiftInboxEntryPolicy.shouldShow("JP", "ko"))
|
||||||
|
assertFalse(GiftInboxEntryPolicy.shouldShow("JP", "ja"))
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `빈 국가 코드는 기존 정책대로 한국으로 처리한다`() {
|
||||||
|
assertTrue(GiftInboxEntryPolicy.shouldShow("", "ko"))
|
||||||
|
assertFalse(GiftInboxEntryPolicy.shouldShow("", "en"))
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `마이 탭은 조건부 선물함을 첫 번째 아이콘으로 연결한다`() {
|
||||||
|
val source = projectFile(
|
||||||
|
"app/src/main/java/kr/co/vividnext/sodalive/mypage/MyPageFragment.kt"
|
||||||
|
).readText()
|
||||||
|
val function = source
|
||||||
|
.substringAfter("private fun buildFunctionButtonItems")
|
||||||
|
.substringBefore("private fun showAuthDialog")
|
||||||
|
|
||||||
|
val presentIndex = function.indexOf("R.drawable.ic_my_present")
|
||||||
|
val storageIndex = function.indexOf("R.drawable.ic_my_storage")
|
||||||
|
assertTrue(presentIndex >= 0)
|
||||||
|
assertTrue(storageIndex >= 0)
|
||||||
|
assertTrue(presentIndex < storageIndex)
|
||||||
|
val giftBlock = function.substringBefore("R.drawable.ic_my_storage")
|
||||||
|
assertTrue(giftBlock.contains("GiftInboxEntryPolicy.shouldShow("))
|
||||||
|
assertTrue(giftBlock.contains("SharedPreferenceManager.countryCode"))
|
||||||
|
assertTrue(giftBlock.contains("LanguageManager.getEffectiveLanguage(requireContext())"))
|
||||||
|
assertTrue(giftBlock.contains("R.string.gift_inbox_title"))
|
||||||
|
assertTrue(giftBlock.contains("GiftInboxActivity.newIntent(requireContext())"))
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun projectFile(path: String): File =
|
||||||
|
if (File("app").isDirectory) File(path) else File("../$path")
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user