feat(main): 라이브룸 딥링크 지연 처리를 추가한다
This commit is contained in:
@@ -87,6 +87,7 @@ class MainV2ActivitySourceTest {
|
||||
val observerSource = source.substringFrom("private fun setupLiveEntryObservers()")
|
||||
val updateSource = source.substringFrom("private fun updateRouteLoadingDialog()")
|
||||
val setupViewSource = source.substringFrom("override fun setupView()")
|
||||
val deferredRouteSource = source.substringFrom("private val deferredRouteRunnable = Runnable")
|
||||
|
||||
assertTrue(source.contains("import kr.co.vividnext.sodalive.common.LoadingDialog"))
|
||||
assertTrue(source.contains("private lateinit var routeLoadingDialog: LoadingDialog"))
|
||||
@@ -104,7 +105,7 @@ class MainV2ActivitySourceTest {
|
||||
)
|
||||
)
|
||||
assertBefore(onCreateSource, "isDeferredRouteLoading =", "handler.postDelayed")
|
||||
assertTrue(onCreateSource.contains("isDeferredRouteLoading = false"))
|
||||
assertTrue(deferredRouteSource.contains("isDeferredRouteLoading = false"))
|
||||
assertTrue(updateSource.contains("if (isDeferredRouteLoading || isLiveEntryLoading)"))
|
||||
assertTrue(updateSource.contains("routeLoadingDialog.show(screenWidth)"))
|
||||
assertFalse(updateSource.contains("R.string.screen_live_loading"))
|
||||
@@ -112,6 +113,61 @@ class MainV2ActivitySourceTest {
|
||||
assertTrue(setupViewSource.contains("setupLiveEntryObservers()"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `MainV2Activity는 foreground 라이브 딥링크만 로딩과 함께 지연한다`() {
|
||||
val source = projectFile("app/src/main/java/kr/co/vividnext/sodalive/v2/main/MainV2Activity.kt").readText()
|
||||
val onNewIntentSource = source.substringFrom("override fun onNewIntent(intent: Intent)")
|
||||
val liveRouteSource = source.substringFrom("private fun isLiveRoomDeepLink(intent: Intent): Boolean")
|
||||
|
||||
assertTrue(source.contains("import kr.co.vividnext.sodalive.live.room.LiveRoomActivity"))
|
||||
assertBefore(onNewIntentSource, "handleAudioNotificationRoute(intent)", "isLiveRoomDeepLink(intent)")
|
||||
assertTrue(
|
||||
onNewIntentSource.contains(
|
||||
"LiveRoomActivity.isForeground && isLiveRoomDeepLink(intent)"
|
||||
)
|
||||
)
|
||||
assertBefore(onNewIntentSource, "isDeferredRouteLoading = true", "updateRouteLoadingDialog()")
|
||||
assertBefore(onNewIntentSource, "updateRouteLoadingDialog()", "handler.postDelayed(deferredRouteRunnable, 1000)")
|
||||
assertBefore(onNewIntentSource, "handler.postDelayed(deferredRouteRunnable, 1000)", "return")
|
||||
assertBefore(onNewIntentSource, "return", "executeDeeplink(intent)")
|
||||
|
||||
assertTrue(liveRouteSource.contains("val bundle = resolveDeepLinkBundle(intent) ?: return false"))
|
||||
assertTrue(liveRouteSource.contains("if (isDmChatDeepLink(bundle)) return false"))
|
||||
assertTrue(liveRouteSource.contains("if (roomId != null && roomId > 0) return true"))
|
||||
assertTrue(liveRouteSource.contains("if (hasDirectNonLiveRoute(bundle)) return false"))
|
||||
assertTrue(liveRouteSource.contains("bundle.getString(\"deep_link_value\")?.lowercase(Locale.ROOT) == \"live\""))
|
||||
assertTrue(liveRouteSource.contains("deepLinkValueId != null && deepLinkValueId > 0"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `MainV2Activity는 종료할 때 지연 딥링크와 로딩을 정리한다`() {
|
||||
val source = projectFile("app/src/main/java/kr/co/vividnext/sodalive/v2/main/MainV2Activity.kt").readText()
|
||||
val onCreateSource = source.substringFrom("override fun onCreate(savedInstanceState: Bundle?)")
|
||||
val onDestroySource = source.substringFrom("override fun onDestroy()")
|
||||
val runnableSource = source.substringFrom("private val deferredRouteRunnable = Runnable")
|
||||
|
||||
assertTrue(onCreateSource.contains("handler.postDelayed(deferredRouteRunnable, 1000)"))
|
||||
assertTrue(runnableSource.contains("if (isFinishing || isDestroyed) return@Runnable"))
|
||||
assertBefore(runnableSource, "executeDeeplink(intent)", "isDeferredRouteLoading = false")
|
||||
assertBefore(runnableSource, "isDeferredRouteLoading = false", "updateRouteLoadingDialog()")
|
||||
assertTrue(onDestroySource.contains("handler.removeCallbacks(deferredRouteRunnable)"))
|
||||
assertTrue(onDestroySource.contains("isDeferredRouteLoading = false"))
|
||||
assertTrue(onDestroySource.contains("routeLoadingDialog.dismiss()"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `MainV2Activity의 비라이브 ID 판별은 실제 route와 같은 fallback 순서를 사용한다`() {
|
||||
val source = projectFile("app/src/main/java/kr/co/vividnext/sodalive/v2/main/MainV2Activity.kt").readText()
|
||||
val routeSource = source.substringFrom("private fun hasDirectNonLiveRoute(bundle: Bundle): Boolean")
|
||||
|
||||
assertBefore(
|
||||
routeSource,
|
||||
"bundle.getString(stringKey)?.toLongOrNull()",
|
||||
"?: bundle.getLong(longKey).takeIf { it > 0 }"
|
||||
)
|
||||
assertFalse(routeSource.contains("== true ||"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `MainV2Activity는 Community post를 creator fallback보다 먼저 Action으로 라우팅한다`() {
|
||||
val source = projectFile("app/src/main/java/kr/co/vividnext/sodalive/v2/main/MainV2Activity.kt").readText()
|
||||
|
||||
+4
-2
@@ -30,8 +30,10 @@ class MainV2AudioNotificationRouteSourceTest {
|
||||
assertBefore(onNewIntentSource, "handleAudioNotificationRoute(intent)", "executeDeeplink(intent)")
|
||||
|
||||
val onCreateSource = source.substringFrom("override fun onCreate(savedInstanceState: Bundle?)")
|
||||
assertBefore(onCreateSource, "handleAudioNotificationRoute(intent)", "isV2AccessAllowed(AccessRequirement.Login)")
|
||||
assertBefore(onCreateSource, "handleAudioNotificationRoute(intent)", "executeDeeplink(intent)")
|
||||
val deferredRouteSource = source.substringFrom("private val deferredRouteRunnable = Runnable")
|
||||
assertTrue(onCreateSource.contains("handler.postDelayed(deferredRouteRunnable, 1000)"))
|
||||
assertBefore(deferredRouteSource, "handleAudioNotificationRoute(intent)", "isV2AccessAllowed(AccessRequirement.Login)")
|
||||
assertBefore(deferredRouteSource, "handleAudioNotificationRoute(intent)", "executeDeeplink(intent)")
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user