flow fix
This commit is contained in:
parent
79ab7c0bae
commit
9d9ef95140
@ -51,6 +51,7 @@ fun CardWaitingScreen(
|
||||
viewModel: CardWaitingViewModel,
|
||||
amount: String,
|
||||
onManualEntry: () -> Unit,
|
||||
onProcessingCard: () -> Unit,
|
||||
onBack: () -> Unit,
|
||||
onMain: () -> Unit
|
||||
) {
|
||||
@ -60,9 +61,9 @@ fun CardWaitingScreen(
|
||||
viewModel.events.collect { event ->
|
||||
when (event) {
|
||||
CardWaitingEvent.GoManualEntry -> onManualEntry()
|
||||
CardWaitingEvent.GoProcessingCard -> onProcessingCard()
|
||||
CardWaitingEvent.GoMain -> onMain()
|
||||
CardWaitingEvent.GoBack -> onBack()
|
||||
CardWaitingEvent.GoProcessingCard,
|
||||
CardWaitingEvent.GoTimeout -> Unit
|
||||
}
|
||||
}
|
||||
|
||||
@ -221,15 +221,16 @@ class CardWaitingViewModel(
|
||||
}
|
||||
}
|
||||
|
||||
stopCardReading()
|
||||
|
||||
viewModelScope.launch {
|
||||
_uiState.update {
|
||||
it.copy(
|
||||
alertMessage = "Card detected.\nOnline process disabled.",
|
||||
alertMessage = "Card detected.",
|
||||
isLoading = false,
|
||||
isCardCaptured = true
|
||||
)
|
||||
}
|
||||
_events.send(CardWaitingEvent.GoProcessingCard)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onError(code: Int, message: String) {
|
||||
|
||||
@ -89,6 +89,14 @@ fun AppNavGraph(
|
||||
viewModel = cardWaitingViewModel,
|
||||
amount = formatAmountForDisplay(sharedViewModel.amount.value),
|
||||
onManualEntry = {},
|
||||
onProcessingCard = {
|
||||
navController.navigate(Routes.ProcessingCard.route) {
|
||||
popUpTo(Routes.CardWaiting.route) {
|
||||
inclusive = true
|
||||
}
|
||||
launchSingleTop = true
|
||||
}
|
||||
},
|
||||
onBack = { navController.popBackStack() },
|
||||
onMain = {
|
||||
navController.navigate(Routes.Dashboard.route) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user