feat(home): FIRST 오디오 전체보기 이동을 연결한다
This commit is contained in:
@@ -21,6 +21,8 @@ import kr.co.vividnext.sodalive.v2.live.onair.HomeOnAirLiveActivity
|
||||
import kr.co.vividnext.sodalive.v2.main.chat.dm.DmChatRoomActivity
|
||||
import kr.co.vividnext.sodalive.v2.main.chat.model.ChatRoomListUiItem
|
||||
import kr.co.vividnext.sodalive.v2.main.chat.model.ChatRoomType
|
||||
import kr.co.vividnext.sodalive.v2.main.content.overview.ContentOverviewActivity
|
||||
import kr.co.vividnext.sodalive.v2.main.content.overview.data.ContentOverviewType
|
||||
import kr.co.vividnext.sodalive.v2.main.ensureMainV2NavigationAllowed
|
||||
import kr.co.vividnext.sodalive.v2.main.home.model.HomeFollowingChatSection
|
||||
import kr.co.vividnext.sodalive.v2.main.home.model.HomeFollowingCreatorSection
|
||||
@@ -457,6 +459,9 @@ class HomeMainFragment : BaseFragment<FragmentV2MainHomeBinding>(
|
||||
R.string.home_recommendation_section_first_audio_contents,
|
||||
showMore = true
|
||||
)
|
||||
binding.viewHomeFirstAudioTitle.ivSectionTitleChevron.setOnClickListener {
|
||||
openFirstAudioOverview()
|
||||
}
|
||||
binding.viewHomeAiCharacterTitle.setTitle(
|
||||
R.string.home_recommendation_section_ai_characters,
|
||||
showMore = true
|
||||
@@ -509,6 +514,14 @@ class HomeMainFragment : BaseFragment<FragmentV2MainHomeBinding>(
|
||||
}
|
||||
}
|
||||
|
||||
private fun openFirstAudioOverview() {
|
||||
ensureMainV2NavigationAllowed {
|
||||
startActivity(
|
||||
ContentOverviewActivity.newIntent(requireContext(), ContentOverviewType.FIRST_AUDIO_CONTENT)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun onFollowingSectionMoreClick(section: HomeFollowingSection) = Unit
|
||||
|
||||
private fun onFollowingLiveClick(item: HomeFollowingLiveUiItem) = Unit
|
||||
|
||||
@@ -13,7 +13,7 @@ import java.io.File
|
||||
class HomeMainFragmentSourceTest {
|
||||
|
||||
@Test
|
||||
fun `홈 FIRST 오디오 섹션 타이틀은 chevron만 표시하고 전체보기 이동은 연결하지 않는다`() {
|
||||
fun `홈 FIRST 오디오 섹션 타이틀 chevron은 신규 전체보기로 이동한다`() {
|
||||
val source = projectFile(
|
||||
"app/src/main/java/kr/co/vividnext/sodalive/v2/main/home/HomeMainFragment.kt"
|
||||
).readText()
|
||||
@@ -27,12 +27,29 @@ class HomeMainFragmentSourceTest {
|
||||
" showMore = true"
|
||||
)
|
||||
)
|
||||
assertTrue(source.contains("import kr.co.vividnext.sodalive.v2.main.content.overview.ContentOverviewActivity"))
|
||||
assertTrue(source.contains("import kr.co.vividnext.sodalive.v2.main.content.overview.data.ContentOverviewType"))
|
||||
assertTrue(source.contains("binding.viewHomeFirstAudioTitle.ivSectionTitleChevron.setOnClickListener"))
|
||||
val functionSource = source.substringFrom("private fun openFirstAudioOverview()")
|
||||
assertTrue(functionSource.contains("ensureMainV2NavigationAllowed"))
|
||||
assertTrue(functionSource.contains("startActivity("))
|
||||
assertTrue(functionSource.contains("ContentOverviewActivity.newIntent(requireContext(),"))
|
||||
assertTrue(functionSource.contains("ContentOverviewType.FIRST_AUDIO_CONTENT"))
|
||||
assertTrue(
|
||||
"Phase 2 must not connect FIRST audio overview navigation yet.",
|
||||
!source.contains("binding.viewHomeFirstAudioTitle.ivSectionTitleChevron.setOnClickListener")
|
||||
functionSource.indexOf("ensureMainV2NavigationAllowed") <
|
||||
functionSource.indexOf("startActivity(")
|
||||
)
|
||||
}
|
||||
|
||||
private fun String.substringFrom(marker: String): String {
|
||||
val startIndex = indexOf(marker)
|
||||
assertTrue("Missing function: $marker", startIndex >= 0)
|
||||
val nextFunctionIndex = indexOf("\n private fun ", startIndex + marker.length)
|
||||
.takeIf { it >= 0 }
|
||||
?: length
|
||||
return substring(startIndex, nextFunctionIndex)
|
||||
}
|
||||
|
||||
private fun projectFile(relativePath: String): File {
|
||||
val candidates = listOf(File(relativePath), File("../$relativePath"))
|
||||
return candidates.firstOrNull { it.exists() }
|
||||
|
||||
Reference in New Issue
Block a user