diff --git a/app/src/main/java/com/kickstarter/viewmodels/projectpage/CheckoutFlowViewModel.kt b/app/src/main/java/com/kickstarter/viewmodels/projectpage/CheckoutFlowViewModel.kt index 4fdaa4f5de..176a725cf1 100644 --- a/app/src/main/java/com/kickstarter/viewmodels/projectpage/CheckoutFlowViewModel.kt +++ b/app/src/main/java/com/kickstarter/viewmodels/projectpage/CheckoutFlowViewModel.kt @@ -10,7 +10,6 @@ import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.flow.stateIn -import kotlinx.coroutines.flow.take import kotlinx.coroutines.launch import kotlinx.coroutines.rx2.asFlow @@ -90,10 +89,9 @@ class CheckoutFlowViewModel(val environment: Environment) : ViewModel() { viewModelScope.launch { currentUser.isLoggedIn .asFlow() - .take(1) .collect { userLoggedIn -> - // - Show pledge page - if (userLoggedIn) mutableFlowUIState.emit(FlowUIState(currentPage = 3, expanded = true)) + // - Show checkout page + if (userLoggedIn) mutableFlowUIState.emit(FlowUIState(currentPage = 4, expanded = true)) // - Trigger LoginFlow callback else logInCallback() } diff --git a/app/src/test/java/com/kickstarter/viewmodels/usecases/CheckoutFlowViewModelTest.kt b/app/src/test/java/com/kickstarter/viewmodels/usecases/CheckoutFlowViewModelTest.kt index c411cf4fd9..ed65ab57ef 100644 --- a/app/src/test/java/com/kickstarter/viewmodels/usecases/CheckoutFlowViewModelTest.kt +++ b/app/src/test/java/com/kickstarter/viewmodels/usecases/CheckoutFlowViewModelTest.kt @@ -41,6 +41,7 @@ class CheckoutFlowViewModelTest : KSRobolectricTestCase() { // - make sure empty FlowUISate has been produced, `onConfirmDetailsContinueClicked` will produce states ONLY if user present assertEquals(state, listOf(FlowUIState())) + assertNotSame(state, listOf(FlowUIState(currentPage = 4, expanded = true))) assertNotSame(state, listOf(FlowUIState(currentPage = 3, expanded = true))) assert(state.size == 1) } @@ -70,7 +71,7 @@ class CheckoutFlowViewModelTest : KSRobolectricTestCase() { } // - make sure next page FlowUIState has been generated, not just the initial empty state - assertEquals(state, listOf(FlowUIState(), FlowUIState(currentPage = 3, expanded = true))) + assertEquals(state, listOf(FlowUIState(), FlowUIState(currentPage = 4, expanded = true))) assert(state.size == 2) } }