Updated on 2026-08-14
This commit is contained in:
parent
1d5dcc0577
commit
37f3d52362
3 changed files with 12 additions and 15 deletions
|
|
@ -95,6 +95,7 @@ fun ProgressButton(
|
|||
Button(
|
||||
modifier = modifier,
|
||||
onClick = onClick,
|
||||
enabled = !inProgress,
|
||||
colors = ButtonDefaults.textButtonColors(
|
||||
backgroundColor = backgroundColor,
|
||||
contentColor = contentColor,
|
||||
|
|
|
|||
|
|
@ -79,10 +79,9 @@ private fun readCard(analyticsEvent: AnalyticsEvent?) = scope.launch {
|
|||
onProgressStateChange = { showProgress ->
|
||||
if (showProgress) {
|
||||
changeButtonState(ButtonState.PROGRESS)
|
||||
} else {
|
||||
changeButtonState(ButtonState.ENABLED)
|
||||
}
|
||||
// else { //todo hide this because
|
||||
// changeButtonState(ButtonState.ENABLED)
|
||||
// }
|
||||
},
|
||||
onScanStateChange = { scanInProgress ->
|
||||
store.dispatch(HomeAction.ScanInProgress(scanInProgress))
|
||||
|
|
@ -103,19 +102,23 @@ private fun readCard(analyticsEvent: AnalyticsEvent?) = scope.launch {
|
|||
scope.launch { store.onUserWalletSelected(userWallet) }
|
||||
}
|
||||
.doOnResult {
|
||||
changeButtonState(ButtonState.ENABLED)
|
||||
store.dispatchOnMain(NavigationAction.NavigateTo(AppScreen.Wallet))
|
||||
navigateTo(AppScreen.Wallet)
|
||||
}
|
||||
} else {
|
||||
store.onCardScanned(scanResponse)
|
||||
changeButtonState(ButtonState.ENABLED)
|
||||
store.dispatchOnMain(NavigationAction.NavigateTo(AppScreen.Wallet))
|
||||
navigateTo(AppScreen.Wallet)
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
private suspend fun navigateTo(appScreen: AppScreen) {
|
||||
store.dispatchOnMain(NavigationAction.NavigateTo(appScreen))
|
||||
delay(200)
|
||||
changeButtonState(ButtonState.ENABLED)
|
||||
}
|
||||
|
||||
private fun changeButtonState(state: ButtonState) {
|
||||
store.dispatchOnMain(HomeAction.ChangeScanCardButtonState(IndeterminateProgressButton(state)))
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue