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