feat(content): New&Hot 전체보기 이동을 연결한다
This commit is contained in:
@@ -48,6 +48,8 @@ import kr.co.vividnext.sodalive.v2.main.content.model.toContentBannerIntent
|
|||||||
import kr.co.vividnext.sodalive.v2.main.content.model.toContentBannerRoute
|
import kr.co.vividnext.sodalive.v2.main.content.model.toContentBannerRoute
|
||||||
import kr.co.vividnext.sodalive.v2.main.content.model.usesDayOfWeekQuery
|
import kr.co.vividnext.sodalive.v2.main.content.model.usesDayOfWeekQuery
|
||||||
import kr.co.vividnext.sodalive.v2.main.content.model.usesSeriesItems
|
import kr.co.vividnext.sodalive.v2.main.content.model.usesSeriesItems
|
||||||
|
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.content.ui.CONTENT_ALL_GRID_SPAN_COUNT
|
import kr.co.vividnext.sodalive.v2.main.content.ui.CONTENT_ALL_GRID_SPAN_COUNT
|
||||||
import kr.co.vividnext.sodalive.v2.main.content.ui.CONTENT_RECOMMENDED_GRID_SPAN_COUNT
|
import kr.co.vividnext.sodalive.v2.main.content.ui.CONTENT_RECOMMENDED_GRID_SPAN_COUNT
|
||||||
import kr.co.vividnext.sodalive.v2.main.content.ui.ContentAllAudioCardAdapter
|
import kr.co.vividnext.sodalive.v2.main.content.ui.ContentAllAudioCardAdapter
|
||||||
@@ -554,6 +556,9 @@ class ContentMainFragment : BaseFragment<FragmentV2MainContentBinding>(
|
|||||||
binding.viewContentLatestAudioTitle.ivSectionTitleChevron.setOnClickListener {
|
binding.viewContentLatestAudioTitle.ivSectionTitleChevron.setOnClickListener {
|
||||||
openContentAllTab(MainContentAllType.AUDIO, ContentSort.LATEST)
|
openContentAllTab(MainContentAllType.AUDIO, ContentSort.LATEST)
|
||||||
}
|
}
|
||||||
|
binding.viewContentNewAndHotTitle.ivSectionTitleChevron.setOnClickListener {
|
||||||
|
openContentOverview(ContentOverviewType.NEW_AND_HOT_AUDIO)
|
||||||
|
}
|
||||||
binding.viewContentFreeAudioTitle.ivSectionTitleChevron.setOnClickListener {
|
binding.viewContentFreeAudioTitle.ivSectionTitleChevron.setOnClickListener {
|
||||||
openContentAllTab(MainContentAllType.FREE, ContentSort.POPULAR)
|
openContentAllTab(MainContentAllType.FREE, ContentSort.POPULAR)
|
||||||
}
|
}
|
||||||
@@ -583,6 +588,12 @@ class ContentMainFragment : BaseFragment<FragmentV2MainContentBinding>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun openContentOverview(type: ContentOverviewType) {
|
||||||
|
ensureMainV2NavigationAllowed {
|
||||||
|
startActivity(ContentOverviewActivity.newIntent(requireContext(), type))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun openAudioContentDetail(item: ContentAudioCardUiModel) {
|
private fun openAudioContentDetail(item: ContentAudioCardUiModel) {
|
||||||
openAudioContentDetail(item.audioContentId, item.showAdultBadge)
|
openAudioContentDetail(item.audioContentId, item.showAdultBadge)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -332,7 +332,7 @@ class ContentMainFragmentSourceTest {
|
|||||||
"binding.viewContentRecommendedAudioTitle.setTitle(" +
|
"binding.viewContentRecommendedAudioTitle.setTitle(" +
|
||||||
"R.string.content_recommendation_section_recommended_audio)"
|
"R.string.content_recommendation_section_recommended_audio)"
|
||||||
)
|
)
|
||||||
assertFalse(source.contains("viewContentNewAndHotTitle.ivSectionTitleChevron.setOnClickListener"))
|
assertTrue(source.contains("viewContentNewAndHotTitle.ivSectionTitleChevron.setOnClickListener"))
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -376,7 +376,17 @@ class ContentMainFragmentSourceTest {
|
|||||||
assertSourceContains(source, "openContentAllTab(MainContentAllType.FREE, ContentSort.POPULAR)")
|
assertSourceContains(source, "openContentAllTab(MainContentAllType.FREE, ContentSort.POPULAR)")
|
||||||
assertSourceContains(source, "binding.viewContentPointAudioTitle.ivSectionTitleChevron.setOnClickListener")
|
assertSourceContains(source, "binding.viewContentPointAudioTitle.ivSectionTitleChevron.setOnClickListener")
|
||||||
assertSourceContains(source, "openContentAllTab(MainContentAllType.POINT, ContentSort.POPULAR)")
|
assertSourceContains(source, "openContentAllTab(MainContentAllType.POINT, ContentSort.POPULAR)")
|
||||||
assertFalse(source.contains("viewContentNewAndHotTitle.ivSectionTitleChevron.setOnClickListener"))
|
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("viewContentNewAndHotTitle.ivSectionTitleChevron.setOnClickListener"))
|
||||||
|
assertTrue(source.contains("openContentOverview(ContentOverviewType.NEW_AND_HOT_AUDIO)"))
|
||||||
|
val functionSource = source.substringFrom("private fun openContentOverview(type: ContentOverviewType)")
|
||||||
|
assertTrue(functionSource.contains("ensureMainV2NavigationAllowed"))
|
||||||
|
assertTrue(functionSource.contains("startActivity(ContentOverviewActivity.newIntent(requireContext(), type))"))
|
||||||
|
assertTrue(
|
||||||
|
functionSource.indexOf("ensureMainV2NavigationAllowed") <
|
||||||
|
functionSource.indexOf("startActivity(")
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -525,6 +535,15 @@ class ContentMainFragmentSourceTest {
|
|||||||
assertTrue(message ?: "Expected source to contain: $expected", source.contains(expected))
|
assertTrue(message ?: "Expected source to contain: $expected", source.contains(expected))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 {
|
private fun projectFile(relativePath: String): File {
|
||||||
val candidates = listOf(File(relativePath), File("../$relativePath"))
|
val candidates = listOf(File(relativePath), File("../$relativePath"))
|
||||||
return candidates.firstOrNull { it.exists() }
|
return candidates.firstOrNull { it.exists() }
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package kr.co.vividnext.sodalive.v2.main.content.overview
|
package kr.co.vividnext.sodalive.v2.main.content.overview
|
||||||
|
|
||||||
import android.app.Application
|
import android.app.Application
|
||||||
import org.junit.Assert.assertFalse
|
|
||||||
import org.junit.Assert.assertTrue
|
import org.junit.Assert.assertTrue
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
@@ -85,7 +84,7 @@ class ContentOverviewActivitySourceTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `manifest registers ContentOverviewActivity and Phase 7 routing is not added`() {
|
fun `manifest registers ContentOverviewActivity and Phase 7 routing is added`() {
|
||||||
val manifest = projectFile("app/src/main/AndroidManifest.xml").readText()
|
val manifest = projectFile("app/src/main/AndroidManifest.xml").readText()
|
||||||
val homeSource = projectFile(
|
val homeSource = projectFile(
|
||||||
"app/src/main/java/kr/co/vividnext/sodalive/v2/main/home/HomeMainFragment.kt"
|
"app/src/main/java/kr/co/vividnext/sodalive/v2/main/home/HomeMainFragment.kt"
|
||||||
@@ -95,8 +94,8 @@ class ContentOverviewActivitySourceTest {
|
|||||||
).readText()
|
).readText()
|
||||||
|
|
||||||
assertTrue(manifest.contains(".v2.main.content.overview.ContentOverviewActivity"))
|
assertTrue(manifest.contains(".v2.main.content.overview.ContentOverviewActivity"))
|
||||||
assertFalse(homeSource.contains("viewHomeFirstAudioTitle.ivSectionTitleChevron.setOnClickListener"))
|
assertTrue(homeSource.contains("viewHomeFirstAudioTitle.ivSectionTitleChevron.setOnClickListener"))
|
||||||
assertFalse(contentSource.contains("viewContentNewAndHotTitle.ivSectionTitleChevron.setOnClickListener"))
|
assertTrue(contentSource.contains("viewContentNewAndHotTitle.ivSectionTitleChevron.setOnClickListener"))
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun projectFile(relativePath: String): File {
|
private fun projectFile(relativePath: String): File {
|
||||||
|
|||||||
Reference in New Issue
Block a user