NTP-15803 | Vedant Aggarwal | Increasing debounce time on Pay button click to avoid multiple payments (#13821)

This commit is contained in:
vedant aggarwal
2024-11-26 19:46:00 +05:30
committed by GitHub
parent 548cfdea06
commit 4408f016bf
6 changed files with 9 additions and 4 deletions

View File

@@ -69,6 +69,7 @@ fun ThemeRoundedButton(
disabledBackgroundColor: Color = NaviPayColor.ctaDisabled,
overflow: TextOverflow = TextOverflow.Clip,
maxLines: Int = Int.MAX_VALUE,
debounceTime: Long? = 300L,
onClick: () -> Unit,
) {
@@ -76,7 +77,7 @@ fun ThemeRoundedButton(
Button(
elevation = ButtonDefaults.elevation(defaultElevation = 0.dp),
onClick = { clickDebounce.processClick { onClick() } },
onClick = { clickDebounce.processClick(debounceTime = debounceTime) { onClick() } },
modifier = modifier,
shape = RoundedCornerShape(cornerRadius),
contentPadding = paddingValues,

View File

@@ -51,6 +51,7 @@ fun RequestApprovalSection(
enabled =
(bankAccountsState is BankAccountsState.AccountList) &&
mainCtaState !is SendMoneyMainCtaState.Disabled,
debounceTime = 800L
) {
when (mainCtaState) {
is SendMoneyMainCtaState.Pay -> onApproveClicked()

View File

@@ -124,7 +124,8 @@ fun SendMoneyAccountSelectionView(
paddingValues = PaddingValues(16.dp),
enabled = mainCtaState !is SendMoneyMainCtaState.Disabled,
lottieFileName = NAVI_PAY_PRIMARY_CTA_LOADER_LOTTIE,
showLoader = showPayButtonLoader
showLoader = showPayButtonLoader,
debounceTime = 800L
) {
when (mainCtaState) {
is SendMoneyMainCtaState.Pay -> onPayButtonClick("BottomSheetPayButton")

View File

@@ -98,6 +98,7 @@ private fun PayButton(
enabled = mainCtaState !is SendMoneyMainCtaState.Disabled,
lottieFileName = NAVI_PAY_PRIMARY_CTA_LOADER_LOTTIE,
showLoader = showPayButtonLoader,
debounceTime = 800L,
loaderStatePaddingValues = PaddingValues(10.dp)
) {
when (mainCtaState) {

View File

@@ -133,7 +133,8 @@ fun AddBalanceModalContent(
enabled =
(mainCtaState is UpiLiteMainCtaState.SetPin) || isCtaBottomSheetButtonActive,
showLoader = enableButtonLottie,
modifier = Modifier.fillMaxWidth().padding(bottom = 16.dp)
modifier = Modifier.fillMaxWidth().padding(bottom = 16.dp),
debounceTime = 800L
) {
when (mainCtaState) {
is UpiLiteMainCtaState.AddBalance ->

View File

@@ -570,7 +570,7 @@ fun UpiLiteSection(
enabled = isMainCtaEnabled,
showLoader = enableButtonLottie,
modifier = Modifier.weight(1f).height(48.dp),
debounceTime = 300L,
debounceTime = 800L,
) {
when (mainCtaState) {
is UpiLiteMainCtaState.AddBalance,