NTP-13155| Sidharth Bamba | animation fix and removal of discount (#14384)

This commit is contained in:
Sidharth Bamba
2024-12-30 18:28:34 +05:30
committed by GitHub
parent 3850519ac2
commit 4e58aebdb4
4 changed files with 34 additions and 24 deletions

View File

@@ -20,6 +20,7 @@ import com.navi.base.utils.orZero
import com.navi.bbps.R
import com.navi.bbps.common.AMOUNT_MAX_LENGTH_AFTER_DECIMAL
import com.navi.bbps.common.AMOUNT_MAX_LENGTH_BEFORE_DECIMAL
import com.navi.bbps.common.CATEGORY_ID_MOBILE_PREPAID
import com.navi.bbps.common.CoinsSyncManager
import com.navi.bbps.common.NaviBbpsScreen
import com.navi.bbps.common.model.view.NaviBbpsSessionHelper
@@ -336,11 +337,8 @@ constructor(
}
}
fun onRemoveDiscountClicked(shouldShowKeyboard: Boolean = false) {
fun onRemoveDiscountClicked() {
_isCoinDiscountApplied.update { false }
if (shouldShowKeyboard) {
updateKeyboardAfterDiscountRemoval()
}
}
fun onOfferRolodexClicked(transactionAmount: Double?) {
@@ -381,13 +379,6 @@ constructor(
_navigateToNextScreenFromHelpCta.emit(ctaData)
}
private fun updateKeyboardAfterDiscountRemoval() {
coroutineScope.launch(dispatcherProvider.io) {
delay(1000)
_shouldAutoFocusOnAmount.update { true }
}
}
suspend fun pmsDiscountListener() {
naviPaymentRewardEventBus.events.collectLatest { event ->
if (event.showDiscountedAmount) {
@@ -400,4 +391,10 @@ constructor(
}
}
}
fun handleDiscountRemovalOnAmountFieldClick() {
if (billCategoryEntity?.categoryId != CATEGORY_ID_MOBILE_PREPAID) {
onRemoveDiscountClicked()
}
}
}

View File

@@ -97,7 +97,7 @@ fun AmountTextFieldV2(
showErrorText: Boolean = false,
isAppliedClicked: Boolean = false,
discountedAmount: String,
onRemoveDiscountClicked: () -> Unit
removeDiscountOnAmountFieldClick: () -> Unit,
) {
val focusRequester = remember { FocusRequester() }
val keyboardController = LocalSoftwareKeyboardController.current
@@ -190,7 +190,7 @@ fun AmountTextFieldV2(
Box(
modifier =
Modifier.padding(top = 32.dp).noRippleClickableWithDebounce {
onRemoveDiscountClicked.invoke()
removeDiscountOnAmountFieldClick.invoke()
},
contentAlignment = Alignment.TopCenter
) {

View File

@@ -76,6 +76,7 @@ import com.navi.bbps.clickableDebounce
import com.navi.bbps.common.BILLER_UNIQUE_ID
import com.navi.bbps.common.BULLET
import com.navi.bbps.common.CATEGORY_ID_CREDIT_CARD
import com.navi.bbps.common.CATEGORY_ID_MOBILE_PREPAID
import com.navi.bbps.common.DASH
import com.navi.bbps.common.MAX_AMOUNT_LENGTH
import com.navi.bbps.common.NAVI_HOME
@@ -84,7 +85,6 @@ import com.navi.bbps.common.NaviBbpsScreen
import com.navi.bbps.common.RCBP_CATEGORY
import com.navi.bbps.common.SCROLL_OFFSET_FOR_TITLE_IN_HEADER
import com.navi.bbps.common.SYMBOL_RUPEE
import com.navi.bbps.common.TXN_AMOUNT
import com.navi.bbps.common.model.config.NaviBbpsDefaultConfig
import com.navi.bbps.common.model.view.LoadingState
import com.navi.bbps.common.theme.NaviBbpsColor
@@ -618,7 +618,9 @@ fun PayBillScreenV2(
navigator = navigator,
initialSource = initialSource,
formattedLastPaidDate = formattedLastPaidDate,
billCategoryEntity = billCategoryEntity
billCategoryEntity = billCategoryEntity,
removeDiscountOnViewHistoryClicked =
payBillViewModelV2::onRemoveDiscountClicked
)
AmountTextFieldV2(
modifier = Modifier.fillMaxWidth().padding(top = 32.dp),
@@ -639,9 +641,10 @@ fun PayBillScreenV2(
showErrorText = showErrorText,
isAppliedClicked = isCoinDiscountApplied,
discountedAmount = amountAfterCoinDiscount,
onRemoveDiscountClicked =
payBillViewModelV2::onRemoveDiscountClicked,
shouldAutoFocus = shouldAutoFocusOnAmount
shouldAutoFocus = shouldAutoFocusOnAmount,
removeDiscountOnAmountFieldClick =
payBillViewModelV2::
handleDiscountRemovalOnAmountFieldClick
)
if (
isCategoryOfTypeAmountChipsRequired(
@@ -955,6 +958,10 @@ private fun isCreditCardV2Enabled(
isCreditCardV2ExperimentEnabled
}
private fun isMobilePrepaidCategory(billCategoryEntity: BillCategoryEntity): Boolean {
return billCategoryEntity.categoryId == CATEGORY_ID_MOBILE_PREPAID
}
@Composable
fun RenderPayBillPrepaidBox(
payBillScreenState: PayBillScreenState.PrepaidBillDetails,
@@ -1155,9 +1162,11 @@ fun onBillHistoryClicked(
initialSource: String,
payBillScreenSource: PayBillSource?,
billCategoryEntity: BillCategoryEntity,
billDetailsEntity: BillDetailsEntity?
billDetailsEntity: BillDetailsEntity?,
removeDiscountAnimationPostNavigation: () -> Unit
) {
if (myBillEntity != null) {
removeDiscountAnimationPostNavigation.invoke()
navigator.navigate(
MyBillHistoryDetailsScreenDestination(
myBillEntity = myBillEntity,
@@ -1239,6 +1248,7 @@ fun onBillHistoryClicked(
)
else -> defaultMyBillEntity
}
removeDiscountAnimationPostNavigation.invoke()
navigator.navigate(
MyBillHistoryDetailsScreenDestination(
myBillEntity = myBillEntity,
@@ -1617,7 +1627,8 @@ private fun RenderPayBillDetailSection(
navigator: DestinationsNavigator,
initialSource: String,
formattedLastPaidDate: String,
billCategoryEntity: BillCategoryEntity
billCategoryEntity: BillCategoryEntity,
removeDiscountOnViewHistoryClicked: () -> Unit
) {
Column(
verticalArrangement = Arrangement.Center,
@@ -1652,7 +1663,8 @@ private fun RenderPayBillDetailSection(
payBillScreenSource = payBillScreenSource,
payBillHeaderState = payBillHeaderState,
billCategoryEntity = billCategoryEntity,
billDetailsEntity = billDetailsEntity
billDetailsEntity = billDetailsEntity,
removeDiscountAnimationPostNavigation = removeDiscountOnViewHistoryClicked
)
},
horizontalArrangement = Arrangement.Center
@@ -1829,7 +1841,8 @@ fun ViewHistory(
payBillScreenSource = payBillScreenSource,
payBillHeaderState = payBillHeaderState,
billCategoryEntity = billCategoryEntity,
billDetailsEntity = billDetailsEntity
billDetailsEntity = billDetailsEntity,
removeDiscountAnimationPostNavigation = {}
)
},
horizontalArrangement = Arrangement.Center

View File

@@ -86,7 +86,6 @@ import com.navi.bbps.getBillTitleFromAccountHolderNameOrPrimaryCustomerParams
import com.navi.bbps.getSimpleDateFormat
import com.navi.bbps.noRippleClickableWithDebounce
import com.navi.common.R as CommonR
import com.navi.common.extensions.or
import com.navi.design.font.FontWeightEnum
import com.navi.design.font.getFontWeight
import com.navi.design.font.naviFontFamily
@@ -665,7 +664,8 @@ fun CreditCardBillHistorySection(
payBillHeaderState = null,
payBillScreenSource = null,
billCategoryEntity = billCategoryEntity,
billDetailsEntity = null
billDetailsEntity = null,
removeDiscountAnimationPostNavigation = {}
)
},
verticalAlignment = Alignment.CenterVertically,