NTP-30296 | Sidharth Bamba | api call behind arc flag and analytics events added (#14911)
This commit is contained in:
@@ -333,6 +333,14 @@ class NaviBbpsAnalytics private constructor() {
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
fun onArcProtectNudgeClicked(sessionAttribute: Map<String, String>) {
|
||||
NaviTrackEvent.trackEventOnClickStream(
|
||||
eventName = "NaviBBPS_CategoryPage_Landed_v2_ProtectNudge_Clicked",
|
||||
eventValues =
|
||||
mapOf(NAVI_BBPS_SESSION_ID to sessionAttribute[NAVI_BBPS_SESSION_ID].orEmpty()),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
inner class BillerList {
|
||||
@@ -2507,6 +2515,14 @@ class NaviBbpsAnalytics private constructor() {
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
fun onArcProtectNudgeClicked(sessionAttribute: Map<String, String>) {
|
||||
NaviTrackEvent.trackEventOnClickStream(
|
||||
eventName = "NaviBBPS_PostPaymentV2_ArcProtectNudge_Clicked",
|
||||
eventValues =
|
||||
mapOf(NAVI_BBPS_SESSION_ID to sessionAttribute[NAVI_BBPS_SESSION_ID].orEmpty()),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
inner class TransactionDetailsScreenV2 {
|
||||
|
||||
@@ -557,6 +557,9 @@ fun BillCategoryScreenRenderer(
|
||||
refreshBillItemAndStatus = refreshBillItemAndStatus,
|
||||
isArcProtected = isArcProtected,
|
||||
onArcNudgeInfoClicked = {
|
||||
naviBbpsAnalytics.onArcProtectNudgeClicked(
|
||||
sessionAttribute = viewModel.getNaviBbpsSessionAttributes()
|
||||
)
|
||||
viewModel.onArcNudgeClicked()
|
||||
openSheet()
|
||||
},
|
||||
|
||||
@@ -397,6 +397,8 @@ fun BbpsPostPaymentScreenV2(
|
||||
formattedCoinsAmount =
|
||||
bbpsTransactionDetailsViewModel.rewardsNudgeDetailEntity.value?.formattedAmount
|
||||
?: NAVI_BBPS_MAX_COIN_EARN,
|
||||
naviBbpsAnalytics = naviBbpsAnalytics,
|
||||
sessionAttribute = bbpsTransactionDetailsViewModel.getNaviBbpsSessionAttributes(),
|
||||
)
|
||||
},
|
||||
) {
|
||||
@@ -510,6 +512,11 @@ fun BbpsPostPaymentScreenV2(
|
||||
showArcRewardFromNudgeResponse = showArcRewardFromNudgeResponse,
|
||||
isArcProtected = isArcProtected,
|
||||
onArcNudgeClicked = {
|
||||
naviBbpsAnalytics.onArcProtectNudgeClicked(
|
||||
sessionAttribute =
|
||||
bbpsTransactionDetailsViewModel
|
||||
.getNaviBbpsSessionAttributes()
|
||||
)
|
||||
bbpsTransactionDetailsViewModel.onArcNudgeClicked()
|
||||
openSheet()
|
||||
},
|
||||
@@ -1663,6 +1670,8 @@ private fun RenderPaymentSummaryBottomSheetUI(
|
||||
onBottomSheetDismissClicked: () -> Unit,
|
||||
scratchCardLoadingProgress: Float,
|
||||
formattedCoinsAmount: String,
|
||||
naviBbpsAnalytics: NaviBbpsAnalytics.PostPaymentScreen,
|
||||
sessionAttribute: Map<String, String>,
|
||||
) {
|
||||
when (bottomSheetUIState) {
|
||||
PaymentSummaryBottomSheetUIStateV2.None -> {
|
||||
|
||||
@@ -18,6 +18,7 @@ import com.navi.base.model.LineItem
|
||||
import com.navi.base.utils.DateUtils
|
||||
import com.navi.base.utils.ResourceProvider
|
||||
import com.navi.base.utils.ZERO_STRING
|
||||
import com.navi.base.utils.orFalse
|
||||
import com.navi.base.utils.orZero
|
||||
import com.navi.bbps.R
|
||||
import com.navi.bbps.common.CATEGORY_ID_MOBILE_POSTPAID
|
||||
@@ -132,7 +133,9 @@ constructor(
|
||||
|
||||
private val myBillEntity: MyBillEntity = savedStateHandle["myBillEntity"]!!
|
||||
|
||||
private val initialSource: String = savedStateHandle["initialSource"]!!
|
||||
private val initialSource: String = savedStateHandle.get<String>("initialSource").orEmpty()
|
||||
|
||||
private val isArcProtected: Boolean = savedStateHandle.get<Boolean>("isArcProtected").orFalse()
|
||||
|
||||
private val _naviBbpsPaymentSummaryConfig =
|
||||
MutableStateFlow<NaviBbpsPaymentSummaryConfig?>(null)
|
||||
@@ -282,9 +285,9 @@ constructor(
|
||||
init {
|
||||
init()
|
||||
updateRewardsNudgeEntity()
|
||||
// setArcRewardsData()
|
||||
// updateArcRewardCoins()
|
||||
// updateArcTransactionCounter()
|
||||
setArcRewardsData()
|
||||
updateArcRewardCoins()
|
||||
updateArcTransactionCounter()
|
||||
pollForRewardsGratification()
|
||||
updateCoinUtilisationData()
|
||||
changeScreenStateAfterAnimation()
|
||||
@@ -786,75 +789,79 @@ constructor(
|
||||
|
||||
private fun updateArcRewardCoins() {
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
val bbpsExactnessResponse =
|
||||
bbpsCommonRepository.getExactArcOffer(
|
||||
arcExactOfferRequest =
|
||||
ArcExactOfferRequest(
|
||||
transactionAmount =
|
||||
billTransactionItemEntity.value.formattedAmount
|
||||
.getNormalisedAmount()
|
||||
.toString(),
|
||||
product = ModuleNameV2.BBPS.name,
|
||||
),
|
||||
metricInfo =
|
||||
getBbpsMetricInfo(
|
||||
screenName = naviBbpsVmData.screen.screenName,
|
||||
isNae = { false },
|
||||
),
|
||||
)
|
||||
if (isArcProtected) {
|
||||
val bbpsExactnessResponse =
|
||||
bbpsCommonRepository.getExactArcOffer(
|
||||
arcExactOfferRequest =
|
||||
ArcExactOfferRequest(
|
||||
transactionAmount =
|
||||
billTransactionItemEntity.value.formattedAmount
|
||||
.getNormalisedAmount()
|
||||
.toString(),
|
||||
product = ModuleNameV2.BBPS.name,
|
||||
),
|
||||
metricInfo =
|
||||
getBbpsMetricInfo(
|
||||
screenName = naviBbpsVmData.screen.screenName,
|
||||
isNae = { false },
|
||||
),
|
||||
)
|
||||
|
||||
if (bbpsExactnessResponse.isSuccessWithData()) {
|
||||
_arcRewardCoins.update {
|
||||
bbpsExactnessResponse.data
|
||||
?.rewardOfferData
|
||||
?.rewardAmount
|
||||
.toString()
|
||||
.getDisplayableAmount()
|
||||
if (bbpsExactnessResponse.isSuccessWithData()) {
|
||||
_arcRewardCoins.update {
|
||||
bbpsExactnessResponse.data
|
||||
?.rewardOfferData
|
||||
?.rewardAmount
|
||||
.toString()
|
||||
.getDisplayableAmount()
|
||||
}
|
||||
_showArcRewardFromNudgeResponse.update { false }
|
||||
} else {
|
||||
val arcNudgeResponse = arcNudgeResponse()
|
||||
_arcRewardCoins.update {
|
||||
arcNudgeResponse
|
||||
.getCoinDaysPairForBBPS()
|
||||
?.first
|
||||
?.toString()
|
||||
?.getDisplayableAmount()
|
||||
.orEmpty()
|
||||
}
|
||||
_showArcRewardFromNudgeResponse.update { true }
|
||||
}
|
||||
_showArcRewardFromNudgeResponse.update { false }
|
||||
} else {
|
||||
val arcNudgeResponse = arcNudgeResponse()
|
||||
_arcRewardCoins.update {
|
||||
arcNudgeResponse
|
||||
.getCoinDaysPairForBBPS()
|
||||
?.first
|
||||
?.toString()
|
||||
?.getDisplayableAmount()
|
||||
.orEmpty()
|
||||
}
|
||||
_showArcRewardFromNudgeResponse.update { true }
|
||||
}
|
||||
} else return@launch
|
||||
}
|
||||
}
|
||||
|
||||
private fun setArcRewardsData() {
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
val arcNudgeResponse = arcNudgeResponse()
|
||||
_bbpsArcProperties.update {
|
||||
BbpsArcProperties(
|
||||
mainText =
|
||||
if (isRechargeCategory(myBillEntity.categoryId)) {
|
||||
naviBbpsDefaultConfig.value.arcConfig.mainTextRecharge
|
||||
} else {
|
||||
naviBbpsDefaultConfig.value.arcConfig.mainTextBill
|
||||
},
|
||||
thresholdDays =
|
||||
DateUtils.getFormattedDateTimeAsStringFromDateTimeObject(
|
||||
dateTime =
|
||||
DateTime.now()
|
||||
.plusDays(
|
||||
arcNudgeResponse
|
||||
.getCoinDaysPairForBBPS()
|
||||
?.second
|
||||
?.toInt()
|
||||
.orZero()
|
||||
),
|
||||
format = DATE_TIME_FORMAT_DATE_MONTH_NAME_AT_TIME,
|
||||
),
|
||||
subText = naviBbpsDefaultConfig.value.arcConfig.subText,
|
||||
icon = CommonR.drawable.arc_protect_icon,
|
||||
)
|
||||
}
|
||||
if (isArcProtected) {
|
||||
val arcNudgeResponse = arcNudgeResponse()
|
||||
_bbpsArcProperties.update {
|
||||
BbpsArcProperties(
|
||||
mainText =
|
||||
if (isRechargeCategory(myBillEntity.categoryId)) {
|
||||
naviBbpsDefaultConfig.value.arcConfig.mainTextRecharge
|
||||
} else {
|
||||
naviBbpsDefaultConfig.value.arcConfig.mainTextBill
|
||||
},
|
||||
thresholdDays =
|
||||
DateUtils.getFormattedDateTimeAsStringFromDateTimeObject(
|
||||
dateTime =
|
||||
DateTime.now()
|
||||
.plusDays(
|
||||
arcNudgeResponse
|
||||
.getCoinDaysPairForBBPS()
|
||||
?.second
|
||||
?.toInt()
|
||||
.orZero()
|
||||
),
|
||||
format = DATE_TIME_FORMAT_DATE_MONTH_NAME_AT_TIME,
|
||||
),
|
||||
subText = naviBbpsDefaultConfig.value.arcConfig.subText,
|
||||
icon = CommonR.drawable.arc_protect_icon,
|
||||
)
|
||||
}
|
||||
} else return@launch
|
||||
}
|
||||
}
|
||||
|
||||
@@ -902,11 +909,13 @@ constructor(
|
||||
|
||||
fun updateArcTransactionCounter() =
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
getLocalArcTransactionCounterFormatted()
|
||||
.takeIf { it != ZERO_STRING }
|
||||
?.let { count ->
|
||||
_isLocalArcTransactionCounterWidgetEnabled.update { true }
|
||||
_formattedCount.update { count }
|
||||
}
|
||||
if (isArcProtected) {
|
||||
getLocalArcTransactionCounterFormatted()
|
||||
.takeIf { it != ZERO_STRING }
|
||||
?.let { count ->
|
||||
_isLocalArcTransactionCounterWidgetEnabled.update { true }
|
||||
_formattedCount.update { count }
|
||||
}
|
||||
} else return@launch
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user