From 4ebccd0f70dd24c7ad0fb649e7642d597ee56a81 Mon Sep 17 00:00:00 2001 From: Mehul Garg Date: Fri, 12 Apr 2024 10:31:50 +0530 Subject: [PATCH] TP-62592 | Caching cmts resolved (#10407) --- .../common/ui/NaviBbpsCommonComposable.kt | 14 +++--- .../PrepaidRechargeViewModel.kt | 46 ++++++++++--------- ...PrepaidRechargeScreenBottomSheetContent.kt | 5 +- 3 files changed, 33 insertions(+), 32 deletions(-) diff --git a/android/navi-bbps/src/main/kotlin/com/navi/bbps/common/ui/NaviBbpsCommonComposable.kt b/android/navi-bbps/src/main/kotlin/com/navi/bbps/common/ui/NaviBbpsCommonComposable.kt index 9dd746deb5..6fd70460a2 100644 --- a/android/navi-bbps/src/main/kotlin/com/navi/bbps/common/ui/NaviBbpsCommonComposable.kt +++ b/android/navi-bbps/src/main/kotlin/com/navi/bbps/common/ui/NaviBbpsCommonComposable.kt @@ -204,7 +204,7 @@ fun BottomSheetContentWithIconHeaderPrimarySecondaryButton( if (!primaryButton.isNullOrBlank() && !secondaryButton.isNullOrBlank()) { SecondaryRoundedButton( text = secondaryButton, - onClick = { onSecondaryButtonClicked.invoke() }, + onClick = onSecondaryButtonClicked, modifier = Modifier.weight(1f) ) @@ -212,7 +212,7 @@ fun BottomSheetContentWithIconHeaderPrimarySecondaryButton( ThemeRoundedButton( text = primaryButton, - onClick = { onPrimaryButtonClicked }, + onClick = onPrimaryButtonClicked, modifier = Modifier.weight(1f) ) } else { // one one button will be present @@ -220,7 +220,7 @@ fun BottomSheetContentWithIconHeaderPrimarySecondaryButton( if (!primaryButton.isNullOrBlank()) { ThemeRoundedButton( text = primaryButton, - onClick = { onPrimaryButtonClicked }, + onClick = onPrimaryButtonClicked, modifier = Modifier.fillMaxWidth() ) } @@ -228,7 +228,7 @@ fun BottomSheetContentWithIconHeaderPrimarySecondaryButton( if (!secondaryButton.isNullOrBlank()) { SecondaryRoundedButton( text = secondaryButton, - onClick = { onSecondaryButtonClicked }, + onClick = onSecondaryButtonClicked, modifier = Modifier.fillMaxWidth() ) } @@ -296,7 +296,7 @@ fun BottomSheetContentWithVerticalPrimarySecondaryButton( if (!primaryButtonText.isNullOrBlank()) { ThemeRoundedButton( text = primaryButtonText, - onClick = { onPrimaryButtonClicked.invoke() }, + onClick = onPrimaryButtonClicked, modifier = Modifier.fillMaxWidth() ) Spacer(modifier = Modifier.height(16.dp)) @@ -305,7 +305,7 @@ fun BottomSheetContentWithVerticalPrimarySecondaryButton( if (!secondaryButtonText.isNullOrBlank()) { SecondaryRoundedButton( text = secondaryButtonText, - onClick = { onSecondaryButtonClicked.invoke() }, + onClick = onSecondaryButtonClicked, modifier = Modifier.fillMaxWidth() ) } @@ -581,7 +581,7 @@ fun DropdownFieldWithDescriptionHeader( enabled = false, shape = RoundedCornerShape(4.dp), placeholder = { placeHolderComposable() }, - modifier = Modifier.fillMaxWidth().clickable(onClick = { onClick() }), + modifier = Modifier.fillMaxWidth().clickable(onClick = onClick), singleLine = true, colors = TextFieldDefaults.outlinedTextFieldColors( diff --git a/android/navi-bbps/src/main/kotlin/com/navi/bbps/feature/prepaidrecharge/PrepaidRechargeViewModel.kt b/android/navi-bbps/src/main/kotlin/com/navi/bbps/feature/prepaidrecharge/PrepaidRechargeViewModel.kt index b0846c7bca..42f404b837 100644 --- a/android/navi-bbps/src/main/kotlin/com/navi/bbps/feature/prepaidrecharge/PrepaidRechargeViewModel.kt +++ b/android/navi-bbps/src/main/kotlin/com/navi/bbps/feature/prepaidrecharge/PrepaidRechargeViewModel.kt @@ -256,11 +256,13 @@ constructor( circleName = allCircleList .find { it.circleId == circleIdFromMapping } - ?.circleName ?: "", + ?.circleName + .orEmpty(), operatorName = allOperatorList .find { it.operatorCode == operatorCodeFromMapping } - ?.operatorName ?: "" + ?.operatorName + .orEmpty() ) ) } @@ -367,7 +369,7 @@ constructor( private fun OperatorItemResponse.toOperatorEntity(): OperatorItemEntity { return OperatorItemEntity( - operatorLogoUrl = this.operatorLogoUrl ?: "", + operatorLogoUrl = this.operatorLogoUrl.orEmpty(), operatorCode = this.operatorCode, operatorName = this.operatorName, billerId = this.billerId @@ -495,8 +497,8 @@ constructor( ) naviBbpsAnalytics.onPlansLoaded( - operatorCode = selectedOperatorEntity.value?.operatorCode ?: "", - circleId = selectedCircleEntity.value?.circleId ?: "", + operatorCode = selectedOperatorEntity.value?.operatorCode.orEmpty(), + circleId = selectedCircleEntity.value?.circleId.orEmpty(), totalPlanGroups = prepaidRechargeEntity.planGroups.size, isRefreshPlan = false, source = LOAD_TYPE_INITIAL, @@ -556,15 +558,15 @@ constructor( isLoadFromMappingEnabled = loadFromSeriesMappingExperiment?.isEnabled ?: false ) - val operatorCode = selectedOperatorEntity.value?.operatorCode ?: "" - val circleId = selectedCircleEntity.value?.circleId ?: "" + val operatorCode = selectedOperatorEntity.value?.operatorCode.orEmpty() + val circleId = selectedCircleEntity.value?.circleId.orEmpty() val prepaidRechargeEntity = getPrepaidRechargePlans(operatorCode = operatorCode, circleId = circleId) naviBbpsAnalytics.onPlansLoaded( - operatorCode = selectedOperatorEntity.value?.operatorCode ?: "", - circleId = selectedCircleEntity.value?.circleId ?: "", + operatorCode = selectedOperatorEntity.value?.operatorCode.orEmpty(), + circleId = selectedCircleEntity.value?.circleId.orEmpty(), totalPlanGroups = prepaidRechargeEntity?.planGroups?.size ?: 0, isRefreshPlan = true, source = source, @@ -676,14 +678,14 @@ constructor( val customerParams = mapOf( - "OperatorCode" to (selectedOperatorEntity.value?.operatorCode ?: ""), - "CircleRefID" to (selectedCircleEntity.value?.circleId ?: ""), + "OperatorCode" to (selectedOperatorEntity.value?.operatorCode.orEmpty()), + "CircleRefID" to (selectedCircleEntity.value?.circleId.orEmpty()), "MobileNumber" to phoneNumberDetail.normalisedPhoneNumber ) val billDetailsRequest = BillDetailsRequest( - billerId = selectedOperatorEntity.value?.billerId ?: "", + billerId = selectedOperatorEntity.value?.billerId.orEmpty(), customerParams = customerParams, deviceDetails = DeviceDetails(ip = naviNetworkConnectivity.getIpAddress()), amount = plan.price @@ -697,8 +699,8 @@ constructor( insertPhoneNumberToOperatorCircleMapping( PhoneNumberToOperatorCircleMappingEntity( phoneNumber = phoneNumberDetail.normalisedPhoneNumber, - operatorCode = selectedOperatorEntity.value?.operatorCode ?: "", - circleId = selectedCircleEntity.value?.circleId ?: "" + operatorCode = selectedOperatorEntity.value?.operatorCode.orEmpty(), + circleId = selectedCircleEntity.value?.circleId.orEmpty() ) ) val billDetails = billDetailsResponse.data!! @@ -710,9 +712,9 @@ constructor( operatorItemEntity = selectedOperatorEntity.value!!, billDetailsEntity = BillDetailsEntity( - billerId = selectedOperatorEntity.value?.billerId ?: "", + billerId = selectedOperatorEntity.value?.billerId.orEmpty(), referenceId = billDetails.referenceId, - amount = billDetails.amount ?: "", + amount = billDetails.amount.orEmpty(), billDate = naviBbpsDateUtils.getFormattedDate( dateTime = billDetails.billDate, @@ -729,8 +731,8 @@ constructor( inputDateFormat = DATE_TIME_FORMAT_DATE_MONTH_NAME_YEAR_INPUT ) ?: "", - billNumber = billDetails.billNumber ?: "", - accountHolderName = billDetails.accountHolderName ?: "", + billNumber = billDetails.billNumber.orEmpty(), + accountHolderName = billDetails.accountHolderName.orEmpty(), additionalParams = null ) ), @@ -752,8 +754,8 @@ constructor( } else { val error = getError(billDetailsResponse) naviBbpsAnalytics.errorOnBillDetailsFetch( - operatorCode = selectedOperatorEntity.value?.operatorCode ?: "", - circleId = selectedCircleEntity.value?.circleId ?: "", + operatorCode = selectedOperatorEntity.value?.operatorCode.orEmpty(), + circleId = selectedCircleEntity.value?.circleId.orEmpty(), error = error.code ) if (error.code == ERR_CODE_INVALID_NETWORK_CIRCLE) { @@ -780,8 +782,8 @@ constructor( updatePrepaidRechargeState( state = PrepaidRechargeState.Loaded( - operatorCode = selectedOperatorEntity.value?.operatorCode ?: "", - circleId = selectedCircleEntity.value?.circleId ?: "", + operatorCode = selectedOperatorEntity.value?.operatorCode.orEmpty(), + circleId = selectedCircleEntity.value?.circleId.orEmpty(), planGroups = allPlanGroups, operators = allOperatorList, circles = allCircleList diff --git a/android/navi-bbps/src/main/kotlin/com/navi/bbps/feature/prepaidrecharge/ui/PrepaidRechargeScreenBottomSheetContent.kt b/android/navi-bbps/src/main/kotlin/com/navi/bbps/feature/prepaidrecharge/ui/PrepaidRechargeScreenBottomSheetContent.kt index 3a05ddcccd..b886d1de43 100644 --- a/android/navi-bbps/src/main/kotlin/com/navi/bbps/feature/prepaidrecharge/ui/PrepaidRechargeScreenBottomSheetContent.kt +++ b/android/navi-bbps/src/main/kotlin/com/navi/bbps/feature/prepaidrecharge/ui/PrepaidRechargeScreenBottomSheetContent.kt @@ -120,9 +120,8 @@ fun PrepaidRechargeScreenBottomSheetContent( headerText = headerText, descriptionText = descriptionText, primaryButtonText = stringResource(id = R.string.bbps_find_my_network_and_state), - onPrimaryButtonClicked = { - onFindMyOperatorAndCircleClicked() - }, // call CO api and update the screen state + onPrimaryButtonClicked = + onFindMyOperatorAndCircleClicked, // call CO api and update the screen state secondaryButtonText = stringResource(id = R.string.bbps_select_manually), onSecondaryButtonClicked = { onManuallySelectOperatorCircleClicked("InvalidOperatorCircleSelected")