TP-60133 | Sidharth Bamba | release fixes for bbps (#11143)

Co-authored-by: mohit-rajput <mohit.rajput@navi.com>
Co-authored-by: Mehul Garg <mehul.garg@navi.com>
This commit is contained in:
Sidharth Bamba
2024-06-04 15:12:07 +05:30
committed by GitHub
parent c0904dfac8
commit ce772ae8e2
18 changed files with 136 additions and 55 deletions

View File

@@ -116,7 +116,7 @@ fun ThemeRoundedButtonWithImage(
@DrawableRes imageResId: Int,
imageSize: Dp,
text: String,
fontSize: TextUnit = 14.sp,
fontSize: TextUnit = 12.sp,
backgroundColor: Color = NaviBbpsColor.ctaPrimary,
onClick: () -> Unit,
textColor: Color = NaviBbpsColor.textWhite,
@@ -184,7 +184,7 @@ fun ThemeRoundedButtonV2(
text: String,
shape: Shape = RoundedCornerShape(4.dp),
paddingValues: PaddingValues = PaddingValues(vertical = 14.dp, horizontal = 10.dp),
fontSize: TextUnit = 14.sp,
fontSize: TextUnit = 12.sp,
backgroundColor: Color = NaviBbpsColor.ctaPrimary,
onClick: () -> Unit,
rippleColor: Color = NaviBbpsColor.ctaPrimary

View File

@@ -7,6 +7,8 @@
package com.navi.bbps.common.ui
import android.app.Activity
import androidx.annotation.ColorRes
import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.Image
@@ -43,6 +45,7 @@ import androidx.compose.material3.CenterAlignedTopAppBar
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue
@@ -59,6 +62,7 @@ import androidx.compose.ui.graphics.Shape
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.platform.LocalFocusManager
import androidx.compose.ui.platform.LocalLifecycleOwner
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.TextStyle
@@ -72,6 +76,9 @@ import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.TextUnit
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.core.content.ContextCompat
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleEventObserver
import coil.compose.AsyncImage
import com.airbnb.lottie.compose.LottieAnimation
import com.airbnb.lottie.compose.LottieCompositionSpec
@@ -892,3 +899,26 @@ fun KeyValueTextSection(
)
}
}
@Composable
fun SetStatusBarColor(
activity: Activity,
@ColorRes colorResId: Int = R.color.bbps_status_bar_default_color
) {
val lifecycleOwner = LocalLifecycleOwner.current
DisposableEffect(key1 = lifecycleOwner) {
val observer = LifecycleEventObserver { _, event ->
when (event) {
Lifecycle.Event.ON_RESUME,
Lifecycle.Event.ON_CREATE -> {
activity.window.statusBarColor = ContextCompat.getColor(activity, colorResId)
}
else -> Unit
}
}
lifecycleOwner.lifecycle.addObserver(observer)
onDispose { lifecycleOwner.lifecycle.removeObserver(observer) }
}
}

View File

@@ -96,6 +96,8 @@ constructor(
private val phoneNumberDetail = savedStateHandle.get<PhoneContactEntity>("phoneNumberDetail")
private val isRootScreen = savedStateHandle.get<Boolean>("isRootScreen") ?: false
private val _isScreenFastagRecharge =
MutableStateFlow(billCategoryEntity.categoryId == CATEGORY_ID_FASTAG)
val isScreenFastagRecharge = _isScreenFastagRecharge.asStateFlow()
@@ -369,7 +371,8 @@ constructor(
name = phoneNumberDetail?.name ?: "",
phoneNumber = phoneNumberDetail?.phoneNumber ?: "",
normalisedPhoneNumber = phoneNumberDetail?.normalisedPhoneNumber ?: ""
)
),
isRootScreen = isRootScreen
)
}
@@ -487,7 +490,8 @@ constructor(
name = phoneNumberDetail?.name ?: "",
phoneNumber = phoneNumberDetail?.phoneNumber ?: "",
normalisedPhoneNumber = phoneNumberDetail?.normalisedPhoneNumber ?: ""
)
),
isRootScreen = isRootScreen
)
}

View File

@@ -48,6 +48,7 @@ import com.navi.bbps.common.theme.NaviBbpsColor
import com.navi.bbps.common.ui.InputTextFieldWithDescriptionHeader
import com.navi.bbps.common.ui.NaviBbpsHeader
import com.navi.bbps.common.ui.NaviBbpsModalBottomSheetLayout
import com.navi.bbps.common.ui.SetStatusBarColor
import com.navi.bbps.common.ui.TextImage
import com.navi.bbps.common.utils.BbpsSnackBarPredefinedConfig
import com.navi.bbps.customHide
@@ -91,6 +92,8 @@ fun BillerListScreen(
resultRecipient: ResultRecipient<NaviBbpsPermissionScreenDestination, PermissionResult>,
naviBbpsAnalytics: NaviBbpsAnalytics.BillerList = NaviBbpsAnalytics.INSTANCE.BillerList()
) {
SetStatusBarColor(activity = naviBbpsActivity)
LaunchedEffect(Unit) { naviBbpsAnalytics.onLanded(billCategoryEntity = billCategoryEntity) }
val billerListState by billerListViewModel.billerListState.collectAsStateWithLifecycle()
@@ -163,7 +166,8 @@ fun BillerListScreen(
navigator.navigate(
CustomerDataInputScreenDestination(
billerItemEntity = billerEntity,
billCategoryEntity = billCategoryEntity
billCategoryEntity = billCategoryEntity,
isRootScreen = isRootScreen
)
)
}

View File

@@ -86,6 +86,8 @@ constructor(
private val myBillEntity = savedStateHandle.get<MyBillEntity>("myBillEntity")!!
private val isRootScreen = false
private val _billHistoryDetailsState =
MutableStateFlow<BillTransactionsState>(BillTransactionsState.Loading)
val billHistoryDetailsState = _billHistoryDetailsState.asStateFlow()
@@ -338,7 +340,8 @@ constructor(
name = myBillEntity.billerName,
phoneNumber = myBillEntity.primaryCustomerParamValue,
normalisedPhoneNumber = myBillEntity.primaryCustomerParamValue
)
),
isRootScreen = isRootScreen
)
)
}

View File

@@ -48,6 +48,7 @@ import com.navi.bbps.common.NaviBbpsDimens
import com.navi.bbps.common.theme.NaviBbpsColor
import com.navi.bbps.common.ui.BbpsCircleImage
import com.navi.bbps.common.ui.NaviBbpsModalBottomSheetLayout
import com.navi.bbps.common.ui.SetStatusBarColor
import com.navi.bbps.entry.NaviBbpsActivity
import com.navi.bbps.feature.billhistorydetail.BillHistoryDetailsViewModel
import com.navi.bbps.feature.billhistorydetail.model.view.BillTransactionItemEntity
@@ -79,6 +80,8 @@ fun MyBillHistoryDetailsScreen(
naviBbpsAnalytics: NaviBbpsAnalytics.MyBillHistoryDetails =
NaviBbpsAnalytics.INSTANCE.MyBillHistoryDetails()
) {
SetStatusBarColor(activity = naviBbpsActivity)
LaunchedEffect(Unit) {
naviBbpsAnalytics.onLanded(myBillEntity = myBillEntity)

View File

@@ -30,6 +30,7 @@ import com.navi.bbps.common.NaviBbpsAnalytics
import com.navi.bbps.common.NaviBbpsDimens
import com.navi.bbps.common.theme.NaviBbpsColor
import com.navi.bbps.common.ui.NaviBbpsHeader
import com.navi.bbps.common.ui.SetStatusBarColor
import com.navi.bbps.entry.NaviBbpsActivity
import com.navi.bbps.feature.category.BillCategoriesViewModel
import com.navi.bbps.feature.category.model.view.BillCategoryEntity
@@ -54,6 +55,8 @@ fun BillCategoriesScreen(
) {
LaunchedEffect(Unit) { naviBbpsAnalytics.onLanded(source = source) }
SetStatusBarColor(activity = naviBbpsActivity)
val billCategoryState by viewModel.billCategoriesState.collectAsStateWithLifecycle()
val accountsCountText by viewModel.accountsCountText.collectAsStateWithLifecycle()

View File

@@ -85,6 +85,9 @@ constructor(
private val billCategoryEntity =
savedStateHandle.get<BillCategoryEntity>("billCategoryEntity")!!
private val isRootScreen = savedStateHandle.get<Boolean>("isRootScreen")!!
private val _contactListState = MutableStateFlow<ContactListState>(ContactListState.Loading)
val contactListUIState = _contactListState.asStateFlow()
@@ -245,14 +248,16 @@ constructor(
updateNextScreenDestinationState(
PrepaidRechargeScreenDestination(
phoneNumberDetail = phoneNumberDetail,
billCategoryEntity = billCategoryEntity
billCategoryEntity = billCategoryEntity,
isRootScreen = isRootScreen
)
)
} else {
updateNextScreenDestinationState(
BillerListScreenDestination(
phoneNumberDetail = phoneNumberDetail,
billCategoryEntity = billCategoryEntity
billCategoryEntity = billCategoryEntity,
isRootScreen = isRootScreen
)
)
}
@@ -403,7 +408,8 @@ constructor(
name = phoneNumberDetail.name,
phoneNumber = phoneNumberDetail.phoneNumber,
normalisedPhoneNumber = phoneNumberDetail.normalisedPhoneNumber
)
),
isRootScreen = isRootScreen
)
)
}
@@ -431,7 +437,8 @@ constructor(
searchBoxPlaceholderText = "",
billerListStateHeading = "",
billerListAllHeading = ""
)
),
isRootScreen = isRootScreen
)
)
} else {

View File

@@ -41,6 +41,7 @@ import com.navi.bbps.common.model.view.PermissionResult
import com.navi.bbps.common.model.view.rememberMultiplePermissions
import com.navi.bbps.common.ui.NaviBbpsHeader
import com.navi.bbps.common.ui.NaviBbpsModalBottomSheetLayout
import com.navi.bbps.common.ui.SetStatusBarColor
import com.navi.bbps.common.utils.BbpsSnackBarPredefinedConfig
import com.navi.bbps.common.utils.NaviBbpsCommonUtils.closeKeyboardOnScroll
import com.navi.bbps.customHide
@@ -75,6 +76,8 @@ fun ContactListScreen(
isRootScreen: Boolean = false
) {
SetStatusBarColor(activity = naviBbpsActivity)
LaunchedEffect(Unit) {
naviBbpsAnalytics.onLanded(
isRootScreen = isRootScreen,

View File

@@ -80,6 +80,8 @@ constructor(
private val billCategoryEntity =
savedStateHandle.get<BillCategoryEntity>("billCategoryEntity")!!
private val isRootScreen = savedStateHandle.get<Boolean>("isRootScreen") ?: false
private val _customerInputScreenState =
MutableStateFlow<CustomerInputScreenState>(CustomerInputScreenState.Loading)
val customerDataInputState = _customerInputScreenState.asStateFlow()

View File

@@ -78,6 +78,7 @@ fun CustomerDataInputScreen(
billCategoryEntity: BillCategoryEntity,
navigator: DestinationsNavigator,
customerDataInputViewModel: CustomerDataInputViewModel = hiltViewModel(),
isRootScreen: Boolean = false,
naviBbpsAnalytics: NaviBbpsAnalytics.CustomerInput = NaviBbpsAnalytics.INSTANCE.CustomerInput()
) {
var showKeyboard by remember { mutableStateOf(false) }

View File

@@ -100,6 +100,8 @@ constructor(
private val phoneNumberDetail = savedStateHandle.get<PhoneContactEntity>("phoneNumberDetail")
private val isRootScreen = savedStateHandle.get<Boolean>("isRootScreen") ?: false
private val _initialPaymentAmount = MutableStateFlow("")
val initialPaymentAmount = _initialPaymentAmount.asStateFlow()
@@ -537,7 +539,8 @@ constructor(
BbpsPostPaymentScreenDestination(
billTransactionItemEntity = billTransactionItemEntity,
myBillEntity = myBillEntity,
isSourcePaymentSummary = true
isSourcePaymentSummary = true,
isRootScreen = isRootScreen
)
)
} else {

View File

@@ -107,6 +107,7 @@ fun PayBillScreen(
navigator: DestinationsNavigator,
phoneNumberDetail: PhoneContactEntity,
payBillScreenSource: PayBillSource,
isRootScreen: Boolean = false,
naviBbpsAnalytics: NaviBbpsAnalytics.PayBill = NaviBbpsAnalytics.INSTANCE.PayBill()
) {
var paymentContainerId by remember { mutableIntStateOf(0) }

View File

@@ -156,6 +156,8 @@ constructor(
}
}
private val isRootScreen = savedStateHandle.get<Boolean>("isRootScreen") ?: false
private val allOperatorList = mutableListOf<OperatorItemEntity>()
private val allCircleList = mutableListOf<CircleItemEntity>()
@@ -754,7 +756,8 @@ constructor(
searchBoxPlaceholderText = billCategoryEntity.searchBoxPlaceholderText,
billerListStateHeading = billCategoryEntity.billerListStateHeading,
billerListAllHeading = billCategoryEntity.billerListAllHeading
)
),
isRootScreen = isRootScreen
)
)

View File

@@ -68,6 +68,7 @@ fun PrepaidRechargeScreen(
navigator: DestinationsNavigator,
prepaidRechargeViewModel: PrepaidRechargeViewModel = hiltViewModel(),
billCategoryEntity: BillCategoryEntity,
isRootScreen: Boolean = false,
naviBbpsAnalytics: NaviBbpsAnalytics.PrepaidPlansList =
NaviBbpsAnalytics.INSTANCE.PrepaidPlansList()
) {

View File

@@ -135,6 +135,7 @@ fun BbpsPostPaymentScreen(
bbpsTransactionDetailsViewModel: BbpsPostPaymentScreenViewModel = hiltViewModel(),
myBillEntity: MyBillEntity,
isSourcePaymentSummary: Boolean = false,
isRootScreen: Boolean = false,
naviBbpsAnalytics: NaviBbpsAnalytics.PostPaymentScreen =
NaviBbpsAnalytics.INSTANCE.PostPaymentScreen()
) {
@@ -156,15 +157,14 @@ fun BbpsPostPaymentScreen(
bbpsTransactionDetailsViewModel.naviBbpsPaymentSummaryConfig.collectAsStateWithLifecycle()
val onBackClick = {
if (isSourcePaymentSummary) {
if (isRootScreen) {
naviBbpsActivity.finish()
} else {
navigator.clearBackStackUpToAndNavigate(
destination = BillCategoriesScreenDestination(),
popUpTo = BillCategoriesScreenDestination,
inclusive = true
)
} else {
navigator.navigateUp()
Unit
}
}
@@ -177,11 +177,15 @@ fun BbpsPostPaymentScreen(
myBillEntity = myBillEntity,
billTransactionItemEntity = billTransactionItemEntity
)
navigator.clearBackStackUpToAndNavigate(
destination = BillCategoriesScreenDestination(),
popUpTo = BillCategoriesScreenDestination,
inclusive = true
)
if (isRootScreen) {
naviBbpsActivity.finish()
} else {
navigator.clearBackStackUpToAndNavigate(
destination = BillCategoriesScreenDestination(),
popUpTo = BillCategoriesScreenDestination,
inclusive = true
)
}
}
}
@@ -345,11 +349,7 @@ fun RenderPostPaymentScreen(
}
lifecycleOwner.lifecycle.addObserver(observer)
onDispose {
lifecycleOwner.lifecycle.removeObserver(observer)
naviBbpsActivity.window.statusBarColor =
ContextCompat.getColor(naviBbpsActivity, R.color.bbps_text_white)
}
onDispose { lifecycleOwner.lifecycle.removeObserver(observer) }
}
val scrollState = rememberScrollState()
@@ -373,8 +373,6 @@ fun RenderPostPaymentScreen(
PaymentStatusDescription(billEntity = billEntity)
Spacer(modifier = Modifier.height(24.dp))
paymentSummaryConfig
?.bbpsPaymentSummaryScreenConfig
?.paymentSummaryCards
@@ -389,14 +387,18 @@ fun RenderPostPaymentScreen(
onRewardsWonGratificationClicked =
onRewardsWonGratificationClicked
)
if (
rewardsGratificationUIState is
PaymentSummaryRewardsGratificationUIState.Gratification ||
rewardsGratificationUIState is
PaymentSummaryRewardsGratificationUIState.RewardsWonGratification
) {
Spacer(modifier = Modifier.height(24.dp))
}
Spacer(
modifier =
Modifier.height(
if (
rewardsGratificationUIState
is
PaymentSummaryRewardsGratificationUIState.RewardsWonGratification
)
24.dp
else 32.dp
)
)
}
NAVI_BBPS_CROSS_SELL_BANNER -> {
naviBbpsAnalytics.onCrossSellBannerView(
@@ -833,6 +835,8 @@ private fun RewardsGratificationSection(
)
) {
Column(modifier = Modifier.fillMaxWidth()) {
Spacer(modifier = Modifier.height(24.dp))
val lottieUrlFromUIStateInstance =
remember(key1 = rewardsGratificationUIState) {
(rewardsGratificationUIState
@@ -859,7 +863,7 @@ private fun RewardsGratificationSection(
when (rewardsGratificationUIState) {
is PaymentSummaryRewardsGratificationUIState.RewardsWonGratification -> {
Column {
Spacer(modifier = Modifier.height(8.dp))
Spacer(modifier = Modifier.height(32.dp))
Row(
modifier =
Modifier.fillMaxWidth()

View File

@@ -149,17 +149,6 @@ constructor(
val refundStatusWidgetProperties =
when (val refundStatus = billTransactionItemEntity.value.refundStatus) {
TransactionStatus.Pending ->
RefundStatusWidgetProperties(
icon = R.drawable.ic_bbps_share,
statusText = refundStatus.displayableText,
statusTextColor = NaviBbpsColor.textOrange,
description =
naviResourceProvider.getString(
R.string.bbps_th_refund_in_progress_description
),
textToCopy = ""
)
TransactionStatus.Success -> {
val rrn = billTransactionItemEntity.value.refundTransactionId
RefundStatusWidgetProperties(
@@ -186,7 +175,18 @@ constructor(
textToCopy = "",
isContactUsVisible = true
)
null -> null
else -> {
RefundStatusWidgetProperties(
icon = R.drawable.ic_bbps_share,
statusText = naviResourceProvider.getString(R.string.bbps_in_progress),
statusTextColor = NaviBbpsColor.textOrange,
description =
naviResourceProvider.getString(
R.string.bbps_th_refund_in_progress_description
),
textToCopy = ""
)
}
}
_refundStatusWidgetProperties.update { refundStatusWidgetProperties }
@@ -380,6 +380,7 @@ constructor(
}
if (!isTransactionStatusPending()) {
prepareRefundStatusWidgetProperties()
transactionStatusPoller.stopPolling()
// If transaction status is success but bill acknowledgment status is pending, then
// start
@@ -433,6 +434,8 @@ constructor(
if (!isBillAcknowledgmentStatusPending()) {
acknowledgmentStatusPoller.stopPolling()
}
prepareRefundStatusWidgetProperties()
} else {
acknowledgmentStatusPoller.stopPolling()
}

View File

@@ -68,6 +68,7 @@ import androidx.lifecycle.LifecycleEventObserver
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.navi.base.utils.EMPTY
import com.navi.bbps.R
import com.navi.bbps.clickableDebounce
import com.navi.bbps.common.NaviBbpsAnalytics
import com.navi.bbps.common.theme.NaviBbpsColor
import com.navi.bbps.common.ui.BbpsCircleImage
@@ -243,11 +244,7 @@ fun RenderBbpsTransactionDetailsScreen(
}
lifecycleOwner.lifecycle.addObserver(observer)
onDispose {
lifecycleOwner.lifecycle.removeObserver(observer)
naviBbpsActivity.window.statusBarColor =
ContextCompat.getColor(naviBbpsActivity, R.color.bbps_status_bar_default_color)
}
onDispose { lifecycleOwner.lifecycle.removeObserver(observer) }
}
val scrollState = rememberScrollState()
@@ -669,7 +666,16 @@ private fun RefundStatusCard(
) {
Row(
modifier =
Modifier.fillMaxWidth().background(color = NaviBbpsColor.bgAlt).padding(all = 16.dp),
Modifier.fillMaxWidth()
.clickableDebounce {
if (refundStatusWidgetProperties.isCopyIconVisible) {
onCopyIconClicked?.invoke(refundStatusWidgetProperties.textToCopy)
} else if (refundStatusWidgetProperties.isContactUsVisible) {
onContactUsClicked?.invoke()
}
}
.background(color = NaviBbpsColor.bgAlt)
.padding(all = 16.dp),
verticalAlignment = Alignment.CenterVertically
) {
Image(