feat(following): 팔로우 해제 확인 dialog를 적용한다

This commit is contained in:
2026-08-18 11:57:21 +09:00
parent 16633b978e
commit 388304dbaa
13 changed files with 234 additions and 101 deletions
@@ -0,0 +1,50 @@
package kr.co.vividnext.sodalive.following
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Test
import java.io.File
class FollowingCreatorActivitySourceTest {
@Test
fun `팔로잉 리스트는 Bottom Sheet 대신 해제 확인 Dialog를 표시한다`() {
val source = projectFile(
"app/src/main/java/kr/co/vividnext/sodalive/following/FollowingCreatorActivity.kt"
).readText()
assertFalse(source.contains("CreatorFollowNotifyFragment"))
assertTrue(source.contains("onClickUnfollow = { creatorId, creatorName ->"))
assertTrue(source.contains("V2ModalDialog("))
assertTrue(source.contains("R.string.creator_unfollow_confirm_desc, creatorName"))
assertTrue(source.contains("confirmButtonClick = {"))
assertTrue(source.contains("viewModel.follow(creatorId, follow = false, notify = false)"))
}
@Test
fun `팔로우 해제 확인 문구는 세 locale에서 같은 placeholder 계약을 사용한다`() {
val korean = projectFile("app/src/main/res/values/strings.xml").readText()
val english = projectFile("app/src/main/res/values-en/strings.xml").readText()
val japanese = projectFile("app/src/main/res/values-ja/strings.xml").readText()
listOf(korean, english, japanese).forEach { strings ->
assertTrue(strings.contains("name=\"creator_unfollow_confirm_title\""))
assertTrue(strings.contains("name=\"creator_unfollow_confirm_desc\""))
assertTrue(strings.contains("name=\"creator_unfollow_confirm_cancel\""))
assertTrue(strings.contains("name=\"creator_unfollow_confirm_confirm\""))
assertTrue(strings.contains("%1\$s"))
}
assertTrue(
english.contains(
"You’ll no longer receive updates from %1\$s.\\nDo you want to unfollow?"
)
)
}
private fun projectFile(path: String): File = File(projectRoot(), path)
private fun projectRoot(): File {
return generateSequence(File(System.getProperty("user.dir") ?: ".").absoluteFile) { it.parentFile }
.first { File(it, "settings.gradle").exists() }
}
}
@@ -0,0 +1,32 @@
package kr.co.vividnext.sodalive.following
import org.junit.Assert.assertTrue
import org.junit.Test
import java.io.File
class FollowingCreatorAdapterSourceTest {
@Test
fun `팔로잉 중 버튼은 흰색 아이콘과 gray 800 원형 배경을 사용한다`() {
val source = projectFile(
"app/src/main/java/kr/co/vividnext/sodalive/following/FollowingCreatorAdapter.kt"
).readText()
val background = projectFile(
"app/src/main/res/drawable/bg_following_circle_gray_800.xml"
)
assertTrue(source.contains("R.drawable.ic_new_following_white"))
assertTrue(source.contains("R.drawable.bg_following_circle_gray_800"))
assertTrue(source.contains("8.dpToPx().toInt()"))
assertTrue(background.exists())
assertTrue(background.readText().contains("@color/gray_800"))
assertTrue(background.readText().contains("android:radius=\"100dp\""))
}
private fun projectFile(path: String): File = File(projectRoot(), path)
private fun projectRoot(): File {
return generateSequence(File(System.getProperty("user.dir") ?: ".").absoluteFile) { it.parentFile }
.first { File(it, "settings.gradle").exists() }
}
}
@@ -283,6 +283,11 @@ class CreatorChannelActivitySourceTest {
"app/src/main/java/kr/co/vividnext/sodalive/v2/creator/channel/CreatorChannelActivity.kt"
).readText()
val layout = projectFile("app/src/main/res/layout/activity_creator_channel.xml").readText()
val followClickSource = sourceSection(
source = source,
startMarker = "private fun onFollowCapsuleClicked()",
endMarker = "private fun onBellClicked()"
)
assertFalse(source.contains("CreatorFollowNotifyFragment"))
assertTrue(layout.contains("android:id=\"@+id/layout_follow_capsule\""))
@@ -294,7 +299,11 @@ class CreatorChannelActivitySourceTest {
assertTrue(source.contains("if (!header.isFollow)"))
assertTrue(source.contains("homeActionDelegate?.follow(follow = true, notify = true)"))
assertTrue(source.contains("homeActionDelegate?.follow(follow = true, notify = !header.isNotify)"))
assertTrue(source.contains("homeActionDelegate?.follow(follow = false, notify = false)"))
assertTrue(followClickSource.contains("V2ModalDialog("))
assertTrue(followClickSource.contains("R.string.creator_unfollow_confirm_title"))
assertTrue(followClickSource.contains("R.string.creator_unfollow_confirm_desc, header.nickname"))
assertTrue(followClickSource.contains("confirmButtonClick = {"))
assertTrue(followClickSource.contains("homeActionDelegate?.follow(follow = false, notify = false)"))
assertFalse(source.contains("showFollowNotifyFragment"))
assertTrue(source.contains("onCreatorChannelFollowProgressChanged"))
assertTrue(source.contains("binding.layoutFollowCapsule.isEnabled = titleBarState.isActionEnabled"))
@@ -1317,7 +1326,12 @@ class CreatorChannelActivitySourceTest {
assertTrue(en.contains("name=\"creator_channel_home_donation_empty_title\">Be the first to\\nsupport this creator!"))
assertTrue(ja.contains("name=\"creator_channel_home_donation_empty_title\">最初のサポートをしてみましょう!"))
assertTrue(ko.contains("name=\"creator_channel_donation_empty_title\">아직 후원이 없습니다.\\n처음으로 크리에이터를 후원해 보세요!"))
assertTrue(en.contains("name=\"creator_channel_donation_empty_title\">No support yet.\\nBe the first to support this creator!"))
assertTrue(
en.contains(
"name=\"creator_channel_donation_empty_title\">No support yet.\\n" +
"Be the first to support this creator!"
)
)
assertTrue(ja.contains("name=\"creator_channel_donation_empty_title\">まだサポートがありません。\\n最初のサポートをしてみましょう!"))
assertTrue(ko.contains("name=\"creator_channel_donation_action\">후원하기"))
assertTrue(en.contains("name=\"creator_channel_donation_action\">Support"))