feat(auth): 본인인증 종료 흐름과 전환 보정을 추가한다
This commit is contained in:
@@ -17,7 +17,8 @@ class ContentPreferenceBottomSheet(
|
|||||||
activity: Activity,
|
activity: Activity,
|
||||||
onToggle: () -> Unit,
|
onToggle: () -> Unit,
|
||||||
onSelect: (ContentType) -> Unit,
|
onSelect: (ContentType) -> Unit,
|
||||||
onConfirm: () -> Unit
|
onConfirm: () -> Unit,
|
||||||
|
onClose: () -> Unit
|
||||||
) : BottomSheetDialog(activity, R.style.V2ContentPreferenceBottomSheetTheme) {
|
) : BottomSheetDialog(activity, R.style.V2ContentPreferenceBottomSheetTheme) {
|
||||||
|
|
||||||
private val binding = V2BottomSheetContentPreferenceBinding.inflate(LayoutInflater.from(context))
|
private val binding = V2BottomSheetContentPreferenceBinding.inflate(LayoutInflater.from(context))
|
||||||
@@ -51,6 +52,7 @@ class ContentPreferenceBottomSheet(
|
|||||||
binding.radioAll.setOnClickListener { onSelect(ContentType.ALL) }
|
binding.radioAll.setOnClickListener { onSelect(ContentType.ALL) }
|
||||||
binding.radioMale.setOnClickListener { onSelect(ContentType.MALE) }
|
binding.radioMale.setOnClickListener { onSelect(ContentType.MALE) }
|
||||||
binding.radioFemale.setOnClickListener { onSelect(ContentType.FEMALE) }
|
binding.radioFemale.setOnClickListener { onSelect(ContentType.FEMALE) }
|
||||||
|
binding.btnClose.setOnClickListener { onClose() }
|
||||||
binding.btnConfirm.setOnClickListener {
|
binding.btnConfirm.setOnClickListener {
|
||||||
if (isConfirmClicked) return@setOnClickListener
|
if (isConfirmClicked) return@setOnClickListener
|
||||||
isConfirmClicked = true
|
isConfirmClicked = true
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import kr.co.vividnext.sodalive.mypage.auth.Auth
|
|||||||
import kr.co.vividnext.sodalive.mypage.auth.AuthResponse
|
import kr.co.vividnext.sodalive.mypage.auth.AuthResponse
|
||||||
import kr.co.vividnext.sodalive.splash.SplashActivity
|
import kr.co.vividnext.sodalive.splash.SplashActivity
|
||||||
import kr.co.vividnext.sodalive.user.UserRepository
|
import kr.co.vividnext.sodalive.user.UserRepository
|
||||||
|
import kr.co.vividnext.sodalive.v2.components.modal.V2ModalDialog
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
import okhttp3.logging.HttpLoggingInterceptor
|
import okhttp3.logging.HttpLoggingInterceptor
|
||||||
import org.koin.android.ext.android.get
|
import org.koin.android.ext.android.get
|
||||||
@@ -31,6 +32,7 @@ import java.lang.ref.WeakReference
|
|||||||
class V2AuthFlow : Fragment() {
|
class V2AuthFlow : Fragment() {
|
||||||
private lateinit var viewModel: V2AuthViewModel
|
private lateinit var viewModel: V2AuthViewModel
|
||||||
private var sheet: ContentPreferenceBottomSheet? = null
|
private var sheet: ContentPreferenceBottomSheet? = null
|
||||||
|
private var closeDialog: V2ModalDialog? = null
|
||||||
private var loadingDialog: LoadingDialog? = null
|
private var loadingDialog: LoadingDialog? = null
|
||||||
private var initializing = false
|
private var initializing = false
|
||||||
private var removing = false
|
private var removing = false
|
||||||
@@ -121,7 +123,8 @@ class V2AuthFlow : Fragment() {
|
|||||||
onConfirm = {
|
onConfirm = {
|
||||||
sheet = null
|
sheet = null
|
||||||
viewModel.confirm()
|
viewModel.confirm()
|
||||||
}
|
},
|
||||||
|
onClose = ::showCloseConfirmation
|
||||||
).also { sheet = it }
|
).also { sheet = it }
|
||||||
currentSheet.render(state.isAdultContentVisible, state.contentType, !state.selectionLocked)
|
currentSheet.render(state.isAdultContentVisible, state.contentType, !state.selectionLocked)
|
||||||
if (!currentSheet.isShowing) currentSheet.show()
|
if (!currentSheet.isShowing) currentSheet.show()
|
||||||
@@ -142,10 +145,38 @@ class V2AuthFlow : Fragment() {
|
|||||||
private fun dismissUi() {
|
private fun dismissUi() {
|
||||||
sheet?.dismiss()
|
sheet?.dismiss()
|
||||||
sheet = null
|
sheet = null
|
||||||
|
closeDialog?.dismiss()
|
||||||
|
closeDialog = null
|
||||||
loadingDialog?.dismiss()
|
loadingDialog?.dismiss()
|
||||||
loadingDialog = null
|
loadingDialog = null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun showCloseConfirmation() {
|
||||||
|
val phase = viewModel.stateLiveData.value?.phase
|
||||||
|
if ((phase != V2AuthPhase.Choosing && phase != V2AuthPhase.Failed) || closeDialog != null) return
|
||||||
|
val sheetWindow = sheet?.window ?: return
|
||||||
|
val originalWindowAnimations = sheetWindow.attributes.windowAnimations
|
||||||
|
sheetWindow.setWindowAnimations(0)
|
||||||
|
lateinit var dialog: V2ModalDialog
|
||||||
|
dialog = V2ModalDialog(
|
||||||
|
requireActivity(),
|
||||||
|
layoutInflater,
|
||||||
|
getString(R.string.v2_auth_close_title),
|
||||||
|
getString(R.string.v2_auth_close_description),
|
||||||
|
getString(R.string.v2_auth_close_confirm),
|
||||||
|
::removeFlow,
|
||||||
|
getString(R.string.v2_auth_close_cancel),
|
||||||
|
{
|
||||||
|
if (closeDialog === dialog) {
|
||||||
|
sheetWindow.setWindowAnimations(originalWindowAnimations)
|
||||||
|
closeDialog = null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
closeDialog = dialog
|
||||||
|
dialog.show(resources.displayMetrics.widthPixels)
|
||||||
|
}
|
||||||
|
|
||||||
private fun showLoading() {
|
private fun showLoading() {
|
||||||
if (loadingDialog == null) {
|
if (loadingDialog == null) {
|
||||||
val host = requireActivity()
|
val host = requireActivity()
|
||||||
|
|||||||
@@ -14,14 +14,34 @@
|
|||||||
android:paddingTop="@dimen/v2_content_preference_top_space"
|
android:paddingTop="@dimen/v2_content_preference_top_space"
|
||||||
android:paddingBottom="@dimen/spacing_8">
|
android:paddingBottom="@dimen/spacing_8">
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<FrameLayout
|
||||||
android:id="@+id/tv_title"
|
|
||||||
style="@style/V2ContentPreferenceTitle"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center"
|
android:minHeight="@dimen/v2_content_preference_title_height">
|
||||||
android:minHeight="@dimen/v2_content_preference_title_height"
|
|
||||||
android:text="@string/screen_content_settings_title" />
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
android:id="@+id/tv_title"
|
||||||
|
style="@style/V2ContentPreferenceTitle"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:gravity="center"
|
||||||
|
android:paddingHorizontal="@dimen/spacing_48"
|
||||||
|
android:text="@string/screen_content_settings_title" />
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/btn_close"
|
||||||
|
android:layout_width="@dimen/spacing_48"
|
||||||
|
android:layout_height="@dimen/spacing_48"
|
||||||
|
android:layout_gravity="end|center_vertical"
|
||||||
|
android:background="?attr/selectableItemBackgroundBorderless"
|
||||||
|
android:contentDescription="@string/a11y_close"
|
||||||
|
android:focusable="true"
|
||||||
|
android:padding="@dimen/spacing_14"
|
||||||
|
android:scaleType="fitCenter"
|
||||||
|
android:tint="@color/gray_400"
|
||||||
|
android:src="@drawable/ic_close_white" />
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|||||||
+22
-1
@@ -9,6 +9,7 @@ import kr.co.vividnext.sodalive.R
|
|||||||
import kr.co.vividnext.sodalive.settings.ContentType
|
import kr.co.vividnext.sodalive.settings.ContentType
|
||||||
import org.junit.Assert.assertEquals
|
import org.junit.Assert.assertEquals
|
||||||
import org.junit.Assert.assertFalse
|
import org.junit.Assert.assertFalse
|
||||||
|
import org.junit.Assert.assertTrue
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
import org.robolectric.Robolectric
|
import org.robolectric.Robolectric
|
||||||
@@ -29,7 +30,7 @@ class ContentPreferenceBottomSheetTest {
|
|||||||
sheet = ContentPreferenceBottomSheet(controller.get(), {}, {}, {
|
sheet = ContentPreferenceBottomSheet(controller.get(), {}, {}, {
|
||||||
assertFalse(sheet.isShowing)
|
assertFalse(sheet.isShowing)
|
||||||
confirmations += 1
|
confirmations += 1
|
||||||
})
|
}, {})
|
||||||
sheet.render(true, ContentType.FEMALE, selectionEnabled = false)
|
sheet.render(true, ContentType.FEMALE, selectionEnabled = false)
|
||||||
sheet.show()
|
sheet.show()
|
||||||
val confirm = sheet.findViewById<View>(R.id.btn_confirm)!!
|
val confirm = sheet.findViewById<View>(R.id.btn_confirm)!!
|
||||||
@@ -45,4 +46,24 @@ class ContentPreferenceBottomSheetTest {
|
|||||||
sheet.dismiss()
|
sheet.dismiss()
|
||||||
controller.pause().stop().destroy()
|
controller.pause().stop().destroy()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `닫기 터치는 제출 없이 종료 콜백만 전달한다`() {
|
||||||
|
val controller = Robolectric.buildActivity(AppCompatActivity::class.java)
|
||||||
|
controller.get().setTheme(R.style.Theme_SodaLive)
|
||||||
|
controller.setup()
|
||||||
|
var closes = 0
|
||||||
|
var confirmations = 0
|
||||||
|
val sheet = ContentPreferenceBottomSheet(controller.get(), {}, {}, { confirmations++ }, { closes++ })
|
||||||
|
sheet.render(true, ContentType.ALL, selectionEnabled = true)
|
||||||
|
sheet.show()
|
||||||
|
|
||||||
|
sheet.findViewById<View>(R.id.btn_close)!!.performClick()
|
||||||
|
|
||||||
|
assertEquals(1, closes)
|
||||||
|
assertEquals(0, confirmations)
|
||||||
|
assertTrue(sheet.isShowing)
|
||||||
|
sheet.dismiss()
|
||||||
|
controller.pause().stop().destroy()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import android.os.Bundle
|
|||||||
import android.os.Looper
|
import android.os.Looper
|
||||||
import android.os.Parcel
|
import android.os.Parcel
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
import android.widget.TextView
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.lifecycle.ViewModelProvider
|
import androidx.lifecycle.ViewModelProvider
|
||||||
import androidx.test.core.app.ApplicationProvider
|
import androidx.test.core.app.ApplicationProvider
|
||||||
@@ -172,6 +173,225 @@ class V2AuthFlowTest {
|
|||||||
controller.pause().stop().destroy()
|
controller.pause().stop().destroy()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `인증 종료 모달 취소는 선택을 보존하고 확인은 POST 없이 흐름을 종료한다`() {
|
||||||
|
listOf(false, true).forEach { syncMemberInfo ->
|
||||||
|
val controller = Robolectric.buildActivity(AuthFlowHost::class.java).setup()
|
||||||
|
val host = controller.get()
|
||||||
|
SharedPreferenceManager.isAdultContentVisible = true
|
||||||
|
SharedPreferenceManager.contentPreference = ContentType.MALE.ordinal
|
||||||
|
SharedPreferenceManager.isAuth = false
|
||||||
|
V2AuthFlow.start(host, syncMemberInfo)
|
||||||
|
receiveReceipt()
|
||||||
|
val original = flow(host)
|
||||||
|
val originalModel = model(original)
|
||||||
|
originalModel.selectContentType(ContentType.FEMALE)
|
||||||
|
val sheet = ShadowDialog.getLatestDialog()
|
||||||
|
sheet.findViewById<View>(R.id.btn_close).performClick()
|
||||||
|
val cancelDialog = ShadowDialog.getLatestDialog()
|
||||||
|
sheet.findViewById<View>(R.id.btn_close).performClick()
|
||||||
|
assertSame(cancelDialog, ShadowDialog.getLatestDialog())
|
||||||
|
val title = (cancelDialog.findViewById<View>(R.id.tv_title) as TextView).text.toString()
|
||||||
|
val description = (cancelDialog.findViewById<View>(R.id.tv_desc) as TextView).text.toString()
|
||||||
|
assertEquals(host.getString(R.string.v2_auth_close_title), title)
|
||||||
|
assertEquals(host.getString(R.string.v2_auth_close_description), description)
|
||||||
|
cancelDialog.findViewById<View>(R.id.tv_cancel).performClick()
|
||||||
|
assertFalse(cancelDialog.isShowing)
|
||||||
|
assertSame(original, flow(host))
|
||||||
|
assertEquals(ContentType.FEMALE, originalModel.stateLiveData.value!!.contentType)
|
||||||
|
assertTrue(requests.isEmpty())
|
||||||
|
assertTrue(sheet.isShowing)
|
||||||
|
|
||||||
|
sheet.findViewById<View>(R.id.btn_close).performClick()
|
||||||
|
val confirmDialog = ShadowDialog.getLatestDialog()
|
||||||
|
assertNotSame(cancelDialog, confirmDialog)
|
||||||
|
val confirm = confirmDialog.findViewById<View>(R.id.tv_confirm)
|
||||||
|
confirm.performClick()
|
||||||
|
confirm.performClick()
|
||||||
|
ioScheduler.triggerActions()
|
||||||
|
idle()
|
||||||
|
assertTrue(host.supportFragmentManager.fragments.none { it is V2AuthFlow })
|
||||||
|
assertTrue(requests.isEmpty())
|
||||||
|
assertEquals(0, host.audioResults)
|
||||||
|
assertFalse(host.isFinishing)
|
||||||
|
assertFalse(confirmDialog.isShowing)
|
||||||
|
assertFalse(sheet.isShowing)
|
||||||
|
assertTrue(originalModel.compositeDisposable.isDisposed)
|
||||||
|
assertTrue(SharedPreferenceManager.isAdultContentVisible)
|
||||||
|
assertEquals(ContentType.MALE.ordinal, SharedPreferenceManager.contentPreference)
|
||||||
|
assertFalse(SharedPreferenceManager.isAuth)
|
||||||
|
assertNull(shadowOf(host).nextStartedActivity)
|
||||||
|
|
||||||
|
val oldCallback = callbacks.last()
|
||||||
|
V2AuthFlow.start(host, syncMemberInfo)
|
||||||
|
receiveReceipt()
|
||||||
|
val freshFlow = flow(host)
|
||||||
|
assertTrue(model(freshFlow).stateLiveData.value!!.isAdultContentVisible)
|
||||||
|
assertEquals(ContentType.ALL, model(freshFlow).stateLiveData.value!!.contentType)
|
||||||
|
oldCallback("{\"data\":{\"receipt_id\":\"late-receipt\"}}")
|
||||||
|
idle()
|
||||||
|
assertSame(freshFlow, flow(host))
|
||||||
|
assertEquals(0, host.audioResults)
|
||||||
|
assertEquals(0, memberCalls)
|
||||||
|
assertTrue(requests.isEmpty())
|
||||||
|
controller.pause().stop().destroy()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `종료 모달은 정지와 재생성에서 닫히고 선택 흐름을 유지한다`() {
|
||||||
|
val controller = Robolectric.buildActivity(AuthFlowHost::class.java).setup()
|
||||||
|
val host = controller.get()
|
||||||
|
V2AuthFlow.start(host)
|
||||||
|
receiveReceipt()
|
||||||
|
val originalModel = model(flow(host))
|
||||||
|
originalModel.selectContentType(ContentType.FEMALE)
|
||||||
|
val oldSheet = ShadowDialog.getLatestDialog()
|
||||||
|
oldSheet.findViewById<View>(R.id.btn_close).performClick()
|
||||||
|
val oldPopup = ShadowDialog.getLatestDialog()
|
||||||
|
|
||||||
|
controller.pause().stop()
|
||||||
|
assertFalse(oldSheet.isShowing)
|
||||||
|
assertFalse(oldPopup.isShowing)
|
||||||
|
controller.start().resume()
|
||||||
|
idle()
|
||||||
|
val resumedSheet = ShadowDialog.getLatestDialog()
|
||||||
|
assertTrue(resumedSheet is ContentPreferenceBottomSheet)
|
||||||
|
assertTrue(resumedSheet.isShowing)
|
||||||
|
assertNotSame(oldSheet, resumedSheet)
|
||||||
|
assertSame(originalModel, model(flow(host)))
|
||||||
|
assertEquals(ContentType.FEMALE, originalModel.stateLiveData.value!!.contentType)
|
||||||
|
resumedSheet.findViewById<View>(R.id.btn_close).performClick()
|
||||||
|
val recreationPopup = ShadowDialog.getLatestDialog()
|
||||||
|
|
||||||
|
val recreatedHost = controller.recreate().get()
|
||||||
|
idle()
|
||||||
|
assertFalse(recreationPopup.isShowing)
|
||||||
|
assertFalse(resumedSheet.isShowing)
|
||||||
|
assertSame(originalModel, model(flow(recreatedHost)))
|
||||||
|
assertEquals(ContentType.FEMALE, originalModel.stateLiveData.value!!.contentType)
|
||||||
|
val recreatedSheet = ShadowDialog.getLatestDialog()
|
||||||
|
assertTrue(recreatedSheet is ContentPreferenceBottomSheet)
|
||||||
|
recreatedSheet.findViewById<View>(R.id.btn_close).performClick()
|
||||||
|
assertTrue(ShadowDialog.getLatestDialog().isShowing)
|
||||||
|
assertTrue(requests.isEmpty())
|
||||||
|
controller.pause().stop().destroy()
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `POST 실패 상태에서도 인증 종료는 추가 요청이나 설정 저장 없이 흐름을 종료한다`() {
|
||||||
|
listOf(false, true).forEach { syncMemberInfo ->
|
||||||
|
val controller = Robolectric.buildActivity(AuthFlowHost::class.java).setup()
|
||||||
|
val host = controller.get()
|
||||||
|
SharedPreferenceManager.isAdultContentVisible = true
|
||||||
|
SharedPreferenceManager.contentPreference = ContentType.ALL.ordinal
|
||||||
|
SharedPreferenceManager.isAuth = true
|
||||||
|
V2AuthFlow.start(host, syncMemberInfo)
|
||||||
|
receiveReceipt()
|
||||||
|
val model = model(flow(host))
|
||||||
|
model.selectContentType(ContentType.MALE)
|
||||||
|
postSuccess = false
|
||||||
|
ShadowDialog.getLatestDialog().findViewById<View>(R.id.btn_confirm).performClick()
|
||||||
|
ioScheduler.triggerActions()
|
||||||
|
assertEquals(V2AuthPhase.Failed, model.stateLiveData.value!!.phase)
|
||||||
|
val callsBeforeClose = requests.size
|
||||||
|
val savedPreference = SharedPreferenceManager.contentPreference
|
||||||
|
val savedVisibility = SharedPreferenceManager.isAdultContentVisible
|
||||||
|
val savedAuth = SharedPreferenceManager.isAuth
|
||||||
|
|
||||||
|
val failedSheet = ShadowDialog.getLatestDialog()
|
||||||
|
failedSheet.findViewById<View>(R.id.btn_close).performClick()
|
||||||
|
val cancelPopup = ShadowDialog.getLatestDialog()
|
||||||
|
cancelPopup.findViewById<View>(R.id.tv_cancel).performClick()
|
||||||
|
assertFalse(cancelPopup.isShowing)
|
||||||
|
assertTrue(failedSheet is ContentPreferenceBottomSheet)
|
||||||
|
assertTrue(failedSheet.isShowing)
|
||||||
|
assertEquals(ContentType.MALE, model.stateLiveData.value!!.contentType)
|
||||||
|
failedSheet.findViewById<View>(R.id.btn_close).performClick()
|
||||||
|
ShadowDialog.getLatestDialog().findViewById<View>(R.id.tv_confirm).performClick()
|
||||||
|
ioScheduler.triggerActions()
|
||||||
|
idle()
|
||||||
|
|
||||||
|
assertTrue(host.supportFragmentManager.fragments.none { it is V2AuthFlow })
|
||||||
|
assertEquals(callsBeforeClose, requests.size)
|
||||||
|
assertEquals(savedPreference, SharedPreferenceManager.contentPreference)
|
||||||
|
assertEquals(savedVisibility, SharedPreferenceManager.isAdultContentVisible)
|
||||||
|
assertEquals(savedAuth, SharedPreferenceManager.isAuth)
|
||||||
|
assertEquals(0, host.audioResults)
|
||||||
|
assertEquals(0, memberCalls)
|
||||||
|
assertFalse(host.isFinishing)
|
||||||
|
assertNull(shadowOf(host).nextStartedActivity)
|
||||||
|
controller.pause().stop().destroy()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `회원 GET 실패로 잠긴 오디오 선택도 종료하면 추가 요청이나 저장 없이 닫힌다`() {
|
||||||
|
val controller = Robolectric.buildActivity(AuthFlowHost::class.java).setup()
|
||||||
|
val host = controller.get()
|
||||||
|
SharedPreferenceManager.isAdultContentVisible = true
|
||||||
|
SharedPreferenceManager.contentPreference = ContentType.MALE.ordinal
|
||||||
|
SharedPreferenceManager.isAuth = true
|
||||||
|
V2AuthFlow.start(host, true)
|
||||||
|
receiveReceipt()
|
||||||
|
val model = model(flow(host))
|
||||||
|
model.selectContentType(ContentType.FEMALE)
|
||||||
|
ShadowDialog.getLatestDialog().findViewById<View>(R.id.btn_confirm).performClick()
|
||||||
|
ioScheduler.triggerActions()
|
||||||
|
assertEquals(1, requests.size)
|
||||||
|
assertEquals(1, memberCalls)
|
||||||
|
member.onError(IllegalStateException("member fetch failed"))
|
||||||
|
assertEquals(V2AuthPhase.Failed, model.stateLiveData.value!!.phase)
|
||||||
|
assertTrue(model.stateLiveData.value!!.selectionLocked)
|
||||||
|
val sheet = ShadowDialog.getLatestDialog()
|
||||||
|
sheet.findViewById<View>(R.id.btn_close).performClick()
|
||||||
|
ShadowDialog.getLatestDialog().findViewById<View>(R.id.tv_confirm).performClick()
|
||||||
|
ioScheduler.triggerActions()
|
||||||
|
idle()
|
||||||
|
assertTrue(host.supportFragmentManager.fragments.none { it is V2AuthFlow })
|
||||||
|
assertTrue(model.compositeDisposable.isDisposed)
|
||||||
|
assertEquals(1, requests.size)
|
||||||
|
assertEquals(1, memberCalls)
|
||||||
|
assertTrue(SharedPreferenceManager.isAdultContentVisible)
|
||||||
|
assertEquals(ContentType.MALE.ordinal, SharedPreferenceManager.contentPreference)
|
||||||
|
assertTrue(SharedPreferenceManager.isAuth)
|
||||||
|
assertEquals(0, host.audioResults)
|
||||||
|
assertNull(shadowOf(host).nextStartedActivity)
|
||||||
|
assertFalse(host.isFinishing)
|
||||||
|
controller.pause().stop().destroy()
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `디버그 인증 종료 후 재진입은 서버 요청 없이 기본 선택을 다시 시작한다`() {
|
||||||
|
val controller = Robolectric.buildActivity(AuthFlowHost::class.java).setup()
|
||||||
|
val host = controller.get()
|
||||||
|
SharedPreferenceManager.contentPreference = ContentType.MALE.ordinal
|
||||||
|
SharedPreferenceManager.isAdultContentVisible = false
|
||||||
|
startDebug(host)
|
||||||
|
advance(500)
|
||||||
|
val oldFlow = flow(host)
|
||||||
|
val oldModel = model(oldFlow)
|
||||||
|
ShadowDialog.getLatestDialog().findViewById<View>(R.id.btn_close).performClick()
|
||||||
|
val popup = ShadowDialog.getLatestDialog()
|
||||||
|
popup.findViewById<View>(R.id.tv_confirm).performClick()
|
||||||
|
idle()
|
||||||
|
assertFalse(popup.isShowing)
|
||||||
|
assertTrue(oldModel.compositeDisposable.isDisposed)
|
||||||
|
assertTrue(host.supportFragmentManager.fragments.none { it is V2AuthFlow })
|
||||||
|
assertTrue(requests.isEmpty())
|
||||||
|
assertTrue(callbacks.isEmpty())
|
||||||
|
assertEquals(ContentType.MALE.ordinal, SharedPreferenceManager.contentPreference)
|
||||||
|
assertFalse(SharedPreferenceManager.isAdultContentVisible)
|
||||||
|
assertEquals(0, host.audioResults)
|
||||||
|
assertNull(shadowOf(host).nextStartedActivity)
|
||||||
|
startDebug(host)
|
||||||
|
advance(500)
|
||||||
|
val freshState = model(flow(host)).stateLiveData.value!!
|
||||||
|
assertTrue(freshState.isAdultContentVisible)
|
||||||
|
assertEquals(ContentType.ALL, freshState.contentType)
|
||||||
|
controller.pause().stop().destroy()
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `중복 SDK 성공은 완료 전후에도 세션과 요청을 한 번만 만들고 새 인증은 별도 세션이다`() {
|
fun `중복 SDK 성공은 완료 전후에도 세션과 요청을 한 번만 만들고 새 인증은 별도 세션이다`() {
|
||||||
val controller = Robolectric.buildActivity(AuthFlowHost::class.java).setup()
|
val controller = Robolectric.buildActivity(AuthFlowHost::class.java).setup()
|
||||||
|
|||||||
Reference in New Issue
Block a user