TP-63383 | loading & sucess lotties | status bar color fix (#10438)
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -802,17 +802,34 @@ fun RenderAPIResultScreen(
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun FullScreenLottie(lottieFileName: String = NAVI_PAY_LOADER) {
|
||||
fun FullScreenLottie(lottieFileName: String = NAVI_PAY_LOADER, title: String? = null) {
|
||||
val spec = LottieCompositionSpec.Asset(lottieFileName)
|
||||
val composition by rememberLottieComposition(spec)
|
||||
|
||||
Box(modifier = Modifier.fillMaxSize().background(Color.White)) {
|
||||
LottieAnimation(
|
||||
composition,
|
||||
composition = composition,
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
iterations = LottieConstants.IterateForever,
|
||||
contentScale = ContentScale.Crop,
|
||||
)
|
||||
if (!title.isNullOrEmpty()) {
|
||||
Column(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
verticalArrangement = Arrangement.Center,
|
||||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
) {
|
||||
Spacer(modifier = Modifier.height(120.dp))
|
||||
NaviText(
|
||||
text = title,
|
||||
fontSize = 16.sp,
|
||||
fontFamily = ttComposeFontFamily,
|
||||
color = NaviPayColor.textPrimary,
|
||||
fontWeight = getFontWeight(FontWeightEnum.NAVI_HEADLINE_REGULAR),
|
||||
textAlign = TextAlign.Center
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,6 @@ import androidx.compose.ui.platform.LocalLifecycleOwner
|
||||
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
|
||||
import androidx.compose.ui.platform.LocalView
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.hilt.navigation.compose.hiltViewModel
|
||||
import androidx.lifecycle.Lifecycle
|
||||
@@ -46,7 +45,7 @@ import com.navi.pay.R
|
||||
import com.navi.pay.analytics.NaviPayAnalytics
|
||||
import com.navi.pay.common.model.view.NaviPayButtonAction
|
||||
import com.navi.pay.common.model.view.SnackbarState
|
||||
import com.navi.pay.common.ui.LoadingScreen
|
||||
import com.navi.pay.common.ui.FullScreenLottie
|
||||
import com.navi.pay.common.ui.NaviPayLottieAnimation
|
||||
import com.navi.pay.common.ui.NaviPayModalBottomSheetLayout
|
||||
import com.navi.pay.common.utils.ErrorEventHandler
|
||||
@@ -76,7 +75,7 @@ import com.navi.pay.utils.ACTION_PIN_SET
|
||||
import com.navi.pay.utils.COLLECT_REQUEST_ERROR
|
||||
import com.navi.pay.utils.INTENT_OR_SCAN_PAY_TRANSACTION_ERROR
|
||||
import com.navi.pay.utils.INVALID_VPA
|
||||
import com.navi.pay.utils.NAVI_PAY_PAYMENT_PENDING_LOTTIE
|
||||
import com.navi.pay.utils.NAVI_PAY_COIN_LOADER_LOTTIE
|
||||
import com.navi.pay.utils.NAVI_PAY_PAYMENT_SUCCESSFUL_MAIN_LOTTIE
|
||||
import com.navi.pay.utils.PSP_DOWN
|
||||
import com.navi.pay.utils.QR_ERROR
|
||||
@@ -112,6 +111,8 @@ fun SendMoneyScreen(
|
||||
val lifecycleOwner = LocalLifecycleOwner.current
|
||||
val rewardsNudgeDetailEntity by
|
||||
sendMoneyViewModel.rewardsNudgeDetailEntity.collectAsStateWithLifecycle()
|
||||
val setDefaultStatusBarColor by
|
||||
sendMoneyViewModel.setDefaultStatusBarColor.collectAsStateWithLifecycle()
|
||||
|
||||
val onBackClick = {
|
||||
sendMoneyViewModel.handleBackPress(needsResult = naviPayActivity.needsResult)
|
||||
@@ -121,20 +122,21 @@ fun SendMoneyScreen(
|
||||
onDispose { AlfredManager.setCurrentScreenName(naviPayActivity.screenName) }
|
||||
}
|
||||
|
||||
DisposableEffect(key1 = lifecycleOwner) {
|
||||
DisposableEffect(key1 = lifecycleOwner, key2 = setDefaultStatusBarColor) {
|
||||
val colorResId =
|
||||
if (setDefaultStatusBarColor) R.color.navi_pay_status_bar_default_color
|
||||
else R.color.navi_pay_bg_alt
|
||||
|
||||
val observer = LifecycleEventObserver { _, event ->
|
||||
when (event) {
|
||||
Lifecycle.Event.ON_RESUME,
|
||||
Lifecycle.Event.ON_CREATE -> {
|
||||
naviPayActivity.window.statusBarColor =
|
||||
ContextCompat.getColor(naviPayActivity, R.color.navi_pay_bg_alt)
|
||||
ContextCompat.getColor(naviPayActivity, colorResId)
|
||||
}
|
||||
Lifecycle.Event.ON_PAUSE -> {
|
||||
naviPayActivity.window.statusBarColor =
|
||||
ContextCompat.getColor(
|
||||
naviPayActivity,
|
||||
R.color.navi_pay_status_bar_default_color
|
||||
)
|
||||
ContextCompat.getColor(naviPayActivity, colorResId)
|
||||
}
|
||||
else -> Unit
|
||||
}
|
||||
@@ -490,11 +492,7 @@ private fun LoadingStatesView(
|
||||
id = R.string.payment_in_progress,
|
||||
paymentAmount.getDisplayableAmount()
|
||||
)
|
||||
LoadingScreen(
|
||||
lottieFileName = NAVI_PAY_PAYMENT_PENDING_LOTTIE,
|
||||
lottieFileSize = 140.dp,
|
||||
title = title
|
||||
)
|
||||
FullScreenLottie(lottieFileName = NAVI_PAY_COIN_LOADER_LOTTIE, title = title)
|
||||
}
|
||||
is SendMoneyScreenState.PaymentSuccess -> {
|
||||
AlfredManager.setCurrentScreenName(
|
||||
|
||||
@@ -331,6 +331,9 @@ constructor(
|
||||
upiTransactionTypeEnumNavType.get(savedStateHandle, "transactionType")
|
||||
?: UpiTransactionType.P2P_PAY
|
||||
|
||||
private val _setDefaultStatusBarColor = MutableStateFlow(false)
|
||||
val setDefaultStatusBarColor = _setDefaultStatusBarColor.asStateFlow()
|
||||
|
||||
private val _blockUserResult = MutableSharedFlow<SendMoneyUserAction>()
|
||||
val blockUserResult = _blockUserResult.asSharedFlow()
|
||||
|
||||
@@ -498,6 +501,10 @@ constructor(
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateSetDefaultStatusBarColor(setDefaultStatusBarColor: Boolean) {
|
||||
_setDefaultStatusBarColor.update { setDefaultStatusBarColor }
|
||||
}
|
||||
|
||||
fun updateBottomSheetUIState(
|
||||
showBottomSheet: Boolean,
|
||||
bottomSheetStateChange: Boolean? = null,
|
||||
@@ -1099,6 +1106,7 @@ constructor(
|
||||
)
|
||||
}
|
||||
|
||||
updateSetDefaultStatusBarColor(setDefaultStatusBarColor = true)
|
||||
updateScreenState(screenState = SendMoneyScreenState.PaymentInProgress)
|
||||
|
||||
val isExternalUpiRequestIdAvailable =
|
||||
@@ -1514,6 +1522,7 @@ constructor(
|
||||
}
|
||||
} else {
|
||||
updateScreenState(screenState = SendMoneyScreenState.MainScreen)
|
||||
updateSetDefaultStatusBarColor(setDefaultStatusBarColor = false)
|
||||
if (!npciError.isUserAborted) {
|
||||
notifyError()
|
||||
}
|
||||
@@ -1696,6 +1705,7 @@ constructor(
|
||||
)
|
||||
}
|
||||
TransactionStatus.DECLINED -> {
|
||||
updateSetDefaultStatusBarColor(setDefaultStatusBarColor = false)
|
||||
updateScreenState(
|
||||
screenState =
|
||||
SendMoneyScreenState.PaymentDeclined(
|
||||
@@ -1758,6 +1768,7 @@ constructor(
|
||||
liteAccountSyncUseCase.execute()
|
||||
}
|
||||
|
||||
updateSetDefaultStatusBarColor(setDefaultStatusBarColor = false)
|
||||
updateScreenState(screenState = SendMoneyScreenState.MainScreen)
|
||||
|
||||
if (source is SendMoneyScreenSource.CollectRequest) {
|
||||
|
||||
@@ -137,7 +137,7 @@ fun UPILiteLoadingStates(
|
||||
id = R.string.upi_lite_top_up_in_progress,
|
||||
topUpAmount.getFormattedAmountWithDecimal()
|
||||
)
|
||||
FullScreenLottie(lottieFileName = NAVI_PAY_COIN_LOADER_LOTTIE)
|
||||
FullScreenLottie(lottieFileName = NAVI_PAY_COIN_LOADER_LOTTIE, title = title)
|
||||
}
|
||||
else -> {}
|
||||
}
|
||||
|
||||
@@ -79,24 +79,26 @@ fun UPILiteScreen(
|
||||
)
|
||||
|
||||
val lifecycleOwner = LocalLifecycleOwner.current
|
||||
val setDefaultStatusBarColor by
|
||||
upiLiteViewModel.setDefaultStatusBarColor.collectAsStateWithLifecycle()
|
||||
|
||||
DisposableEffect(key1 = lifecycleOwner) {
|
||||
DisposableEffect(key1 = lifecycleOwner, key2 = setDefaultStatusBarColor) {
|
||||
val colorResId =
|
||||
if (setDefaultStatusBarColor) {
|
||||
R.color.navi_pay_status_bar_default_color
|
||||
} else {
|
||||
R.color.navi_pay_upi_lite_status_bar_color
|
||||
}
|
||||
val observer = LifecycleEventObserver { _, event ->
|
||||
when (event) {
|
||||
Lifecycle.Event.ON_RESUME,
|
||||
Lifecycle.Event.ON_CREATE -> {
|
||||
naviPayActivity.window.statusBarColor =
|
||||
ContextCompat.getColor(
|
||||
naviPayActivity,
|
||||
R.color.navi_pay_upi_lite_status_bar_color
|
||||
)
|
||||
ContextCompat.getColor(naviPayActivity, colorResId)
|
||||
}
|
||||
Lifecycle.Event.ON_PAUSE -> {
|
||||
naviPayActivity.window.statusBarColor =
|
||||
ContextCompat.getColor(
|
||||
naviPayActivity,
|
||||
R.color.navi_pay_status_bar_default_color
|
||||
)
|
||||
ContextCompat.getColor(naviPayActivity, colorResId)
|
||||
}
|
||||
else -> Unit
|
||||
}
|
||||
|
||||
@@ -181,6 +181,9 @@ constructor(
|
||||
private val _upiLiteTnCUrl = MutableStateFlow(NAVI_PAY_TNC_URL)
|
||||
val upiLiteTnCUrl = _upiLiteTnCUrl.asStateFlow()
|
||||
|
||||
private val _setDefaultStatusBarColor = MutableStateFlow(false)
|
||||
val setDefaultStatusBarColor = _setDefaultStatusBarColor.asStateFlow()
|
||||
|
||||
private val _upiLiteTopBanner = MutableStateFlow("")
|
||||
val upiLiteTopBanner = _upiLiteTopBanner.asStateFlow()
|
||||
|
||||
@@ -507,6 +510,9 @@ constructor(
|
||||
}
|
||||
|
||||
fun updateUIState(uiState: UPILiteUIState) {
|
||||
if (uiState == UPILiteUIState.MAIN_SCREEN) {
|
||||
updateSetDefaultStatusBarColor(setDefaultStatusBarColor = false)
|
||||
}
|
||||
_uiState.update { uiState }
|
||||
}
|
||||
|
||||
@@ -622,6 +628,10 @@ constructor(
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateSetDefaultStatusBarColor(setDefaultStatusBarColor: Boolean) {
|
||||
_setDefaultStatusBarColor.update { setDefaultStatusBarColor }
|
||||
}
|
||||
|
||||
private fun updateDataFromLiteConfig() {
|
||||
updateMaxTopUpLimit(maxTopUpLimit = naviPayUPILiteConfig.config.maxTopUpLimit)
|
||||
updateAmountChips(amountChips = naviPayUPILiteConfig.config.amountChips)
|
||||
@@ -1598,6 +1608,7 @@ constructor(
|
||||
if (loadMoneyType == LoadMoneyType.INITIAL_TOPUP) {
|
||||
updateBottomSheetUIState(showBottomSheet = false)
|
||||
}
|
||||
updateSetDefaultStatusBarColor(setDefaultStatusBarColor = true)
|
||||
updateUIState(uiState = UPILiteUIState.UPILITE_TOPUP_IN_PROGRESS)
|
||||
|
||||
val upiRequestId = commonRepository.getUpiRequestId()
|
||||
|
||||
@@ -39,7 +39,6 @@ const val NAVI_PAY_FAIL_LOTTIE = "navi-pay-failed.lottie"
|
||||
const val NAVI_PAY_PENDING_LOTTIE = "navi-pay-pending.lottie"
|
||||
const val NAVI_PAY_PAYMENT_STATUS_SUCCESS_LOTTIE = "navi-pay-payment-status-success.lottie"
|
||||
const val NAVI_PAY_PAYMENT_SUCCESSFUL_MAIN_LOTTIE = "navi-pay-payment-successful-main.lottie"
|
||||
const val NAVI_PAY_PAYMENT_PENDING_LOTTIE = "navi-pay-payment-pending.lottie"
|
||||
const val NAVI_PAY_PRIMARY_CTA_LOADER_LOTTIE = "navi-pay-primary-cta-loader.lottie"
|
||||
const val NAVI_PAY_TOP_UP_SUCCESSFUL_LOTTIE = "navi-pay-top-up-successful.lottie"
|
||||
const val NAVI_PAY_DISABLE_UPI_LITE_SUCCESS_LOTTIE = "navi-pay-disable-upi-lite-success.lottie"
|
||||
|
||||
@@ -463,7 +463,7 @@
|
||||
<string name="payment_summary">Payment summary</string>
|
||||
<string name="initiating_request">Initiating request</string>
|
||||
<string name="payment_in_progress">Payment of ₹%s in progress</string>
|
||||
<string name="upi_lite_top_up_in_progress">Top up of ₹%s in progress</string>
|
||||
<string name="upi_lite_top_up_in_progress">Top-up of ₹%s in progress</string>
|
||||
<string name="blocking_x">Blocking %s</string>
|
||||
<string name="declining_request">Declining request</string>
|
||||
<string name="block_user_confirmation_description">%s will not be able to request money from you after being blocked.</string>
|
||||
|
||||
Reference in New Issue
Block a user