Ntp-26378 | Shiv Natani | offer visibility fix when navi upi accounts not shown (#14495)

This commit is contained in:
Shiv Natani
2025-01-13 14:40:43 +05:30
committed by GitHub
parent 5e74937808
commit 9d92fde486
3 changed files with 56 additions and 40 deletions

View File

@@ -180,7 +180,9 @@ fun MPSScreen(
paymentAmount = paymentAmount,
redeemedCoinsValue =
if (isDiscountApplied)
coinBurnDetails?.redeemableCoinsValue?.value.orZero()
if (rewardsInfoV2.isNull())
coinBurnDetails?.redeemableCoinsValue?.value.orZero()
else rewardsInfoV2?.burnDetails?.coinsValue?.value.orZero()
else 0.0,
source = mpsViewModel.paymentSdkInitParams?.paymentSource.orEmpty(),
tstoreOrderReferenceId = payload?.tstoreOrderReferenceId.orEmpty(),

View File

@@ -214,6 +214,7 @@ fun NPSScreenRoot(
onEvent = npsViewModel::onEvent,
scrollState = scrollState,
isKeyboardVisible = isKeyboardVisible,
npsViewModel = npsViewModel,
)
}
@@ -224,6 +225,7 @@ fun NPSScreen(
screenState: NPSScreenContract.NPSScreenState,
scrollState: ScrollState,
isKeyboardVisible: Boolean,
npsViewModel: NPSViewModel,
) {
if (screenState.isLoading) {
NPSLoadingShimmer { onEvent(NPSBaseContract.Event.OnBackPress(false)) }
@@ -233,7 +235,8 @@ fun NPSScreen(
onEvent = onEvent,
screenState = screenState,
scrollState = scrollState,
isKeyboardVisible,
isKeyboardVisible = isKeyboardVisible,
npsViewModel = npsViewModel,
)
}
}
@@ -245,6 +248,7 @@ private fun NpsMainScreen(
screenState: NPSScreenContract.NPSScreenState,
scrollState: ScrollState,
isKeyboardVisible: Boolean,
npsViewModel: NPSViewModel,
) {
val bottomSheetState =
rememberModalBottomSheetState(
@@ -335,46 +339,50 @@ private fun NpsMainScreen(
) {
val screenWidth = LocalConfiguration.current.screenWidthDp.dp
Column(modifier = Modifier.fillMaxSize().verticalScroll(scrollState)) {
if (screenState.naviCoinState.rewardsInfoV2.isNotNull()) {
OfferExperienceBanner(
burnDetails = screenState.naviCoinState.rewardsInfoV2?.burnDetails,
isDiscountApplied = screenState.naviCoinState.isDiscountApplied,
onDiscountClick = { isDiscountApplied ->
onEvent(
NPSScreenContract.NPSScreenEvent.OnDiscountClicked(
isDiscountApplied
if (npsViewModel.isOfferApplicable()) {
if (screenState.naviCoinState.rewardsInfoV2.isNotNull()) {
OfferExperienceBanner(
burnDetails =
screenState.naviCoinState.rewardsInfoV2?.burnDetails,
isDiscountApplied = screenState.naviCoinState.isDiscountApplied,
onDiscountClick = { isDiscountApplied ->
onEvent(
NPSScreenContract.NPSScreenEvent.OnDiscountClicked(
isDiscountApplied
)
)
)
},
earnDetails = screenState.naviCoinState.rewardsInfoV2?.earnDetails,
offset =
(if (screenState.npsBaseState.paymentAmount < 100)
screenWidth - 70.dp
else screenWidth - 78.dp),
isDiscountPreApplied =
screenState.naviCoinState.isDiscountPreApplied,
)
} else if (
screenState.naviCoinState.coinBurnDetails.isNotNull() &&
screenState.naviCoinState.isDiscountPreApplied.not()
) {
CoinBurnBanner(
paymentAmount = screenState.npsBaseState.paymentAmount,
coinBurnDetails = screenState.naviCoinState.coinBurnDetails,
isDiscountApplied = screenState.naviCoinState.isDiscountApplied,
onDiscountClick = { isDiscountApplied ->
onEvent(
NPSScreenContract.NPSScreenEvent.OnDiscountClicked(
isDiscountApplied
},
earnDetails =
screenState.naviCoinState.rewardsInfoV2?.earnDetails,
offset =
(if (screenState.npsBaseState.paymentAmount < 100)
screenWidth - 70.dp
else screenWidth - 78.dp),
isDiscountPreApplied =
screenState.naviCoinState.isDiscountPreApplied,
)
} else if (
screenState.naviCoinState.coinBurnDetails.isNotNull() &&
screenState.naviCoinState.isDiscountPreApplied.not()
) {
CoinBurnBanner(
paymentAmount = screenState.npsBaseState.paymentAmount,
coinBurnDetails = screenState.naviCoinState.coinBurnDetails,
isDiscountApplied = screenState.naviCoinState.isDiscountApplied,
onDiscountClick = { isDiscountApplied ->
onEvent(
NPSScreenContract.NPSScreenEvent.OnDiscountClicked(
isDiscountApplied
)
)
)
},
offset =
(if (screenState.npsBaseState.paymentAmount < 100)
screenWidth - 70.dp
else screenWidth - 78.dp),
modifier = Modifier.padding(vertical = 4.dp),
)
},
offset =
(if (screenState.npsBaseState.paymentAmount < 100)
screenWidth - 70.dp
else screenWidth - 78.dp),
modifier = Modifier.padding(vertical = 4.dp),
)
}
}
Spacer(modifier = Modifier.height(24.dp))
screenState.paymentInstrumentsOrderList?.forEach {

View File

@@ -1530,4 +1530,10 @@ constructor(
else -> {}
}
}
fun isOfferApplicable(): Boolean {
return npsScreenState.paymentInstrumentsOrderList
?.contains(UpiLinkedAccountPaymentInstrument.PAYMENT_INSTRUMENT_TYPE)
.orFalse()
}
}