NTP-4789 | tstore tds screen deeplink handling (#13931)
Co-authored-by: Mehul Garg <mehul.garg@navi.com>
This commit is contained in:
@@ -198,7 +198,9 @@ object NaviPayRouter {
|
||||
LinkedAccountDetailScreenDestination(bankAccountUniqueId = EMPTY)
|
||||
NaviPayScreenType.NAVI_PAY_LINK_UPI_NUMBER.name -> LinkUpiNumberScreenDestination()
|
||||
NaviPayScreenType.NAVI_PAY_ORDER_DETAILS.name -> {
|
||||
OrderDetailsScreenDestination(orderReferenceId = EMPTY)
|
||||
OrderDetailsScreenDestination(
|
||||
orderReferenceId = bundle.getString("orderReferenceId").orEmpty()
|
||||
)
|
||||
}
|
||||
NaviPayScreenType.NAVI_PAY_UPI_NUMBER_SCREEN_V2.name -> UpiNumberScreenV2Destination()
|
||||
NaviPayScreenType.NAVI_PAY_ADD_NEW_UPI_NUMBER_V2.name ->
|
||||
|
||||
@@ -38,6 +38,7 @@ import com.navi.pay.tstore.details.ui.bbps.BbpsShareImageUtils
|
||||
import com.navi.pay.tstore.details.viewmodel.OrderDetailsScreenUIState
|
||||
import com.navi.pay.tstore.details.viewmodel.OrderDetailsViewModel
|
||||
import com.navi.pay.utils.SAVINGS_ONLY_ENABLED_ACCOUNTS
|
||||
import com.navi.pay.utils.clearBackStackUpToAndNavigate
|
||||
import com.navi.pay.utils.shareReceipt
|
||||
import com.ramcosta.composedestinations.annotation.Destination
|
||||
import com.ramcosta.composedestinations.navigation.DestinationsNavigator
|
||||
@@ -91,6 +92,17 @@ fun OrderDetailsScreen(
|
||||
}
|
||||
}
|
||||
|
||||
LaunchedEffect(Unit) {
|
||||
orderDetailsViewModel.clearAndNavigateBack.collect {
|
||||
naviPayActivity.window.statusBarColor =
|
||||
ContextCompat.getColor(naviPayActivity, R.color.navi_pay_status_bar_default_color)
|
||||
navigator.clearBackStackUpToAndNavigate(
|
||||
destination = OrderHistoryScreenDestination(),
|
||||
popUpTo = OrderHistoryScreenDestination
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
LaunchedEffect(Unit) {
|
||||
orderDetailsViewModel.navigateToNextScreenFromHelpCta.collectLatest {
|
||||
it?.let { NaviPayRouter.onCtaClick(naviPayActivity = naviPayActivity, ctaData = it) }
|
||||
|
||||
@@ -113,6 +113,8 @@ import kotlinx.coroutines.flow.update
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
typealias IsError = Boolean
|
||||
|
||||
@HiltViewModel
|
||||
class OrderDetailsViewModel
|
||||
@Inject
|
||||
@@ -170,6 +172,9 @@ constructor(
|
||||
private val _navigateToNextScreen = MutableSharedFlow<Direction>()
|
||||
val navigateToNextScreen = _navigateToNextScreen.asSharedFlow()
|
||||
|
||||
private val _clearAndNavigateBack = MutableSharedFlow<Boolean>(replay = 1)
|
||||
val clearAndNavigateBack = _clearAndNavigateBack.asSharedFlow()
|
||||
|
||||
private val _navigateToNextScreenFromHelpCta = MutableSharedFlow<CtaData?>()
|
||||
val navigateToNextScreenFromHelpCta = _navigateToNextScreenFromHelpCta.asSharedFlow()
|
||||
|
||||
@@ -246,7 +251,11 @@ constructor(
|
||||
|
||||
init {
|
||||
viewModelScope.launch(dispatcherProvider.io) {
|
||||
getOrderDetails()
|
||||
val isError = getOrderDetails()
|
||||
if (isError) {
|
||||
return@launch
|
||||
}
|
||||
|
||||
updateUiState(uiState = OrderDetailsScreenUIState.Loaded)
|
||||
updateUserTransactionBankInfo()
|
||||
prepareRefundStatusWidgetProperties()
|
||||
@@ -257,9 +266,14 @@ constructor(
|
||||
}
|
||||
}
|
||||
|
||||
private suspend fun getOrderDetails() {
|
||||
private suspend fun getOrderDetails(): IsError {
|
||||
|
||||
_orderEntity.update { orderDetailsRepository.getOrderEntity(orderReferenceId) }
|
||||
val orderDetails = orderDetailsRepository.getOrderEntity(orderId = orderReferenceId)
|
||||
if (orderDetails == null) {
|
||||
_clearAndNavigateBack.emit(true)
|
||||
return true
|
||||
}
|
||||
_orderEntity.update { orderDetails }
|
||||
|
||||
_otherUserVpa.update { orderEntity.value?.otherUserInfo.orEmpty() }
|
||||
|
||||
@@ -287,6 +301,7 @@ constructor(
|
||||
naviResourceProvider = resourceProvider
|
||||
)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
private fun updateUiState(uiState: OrderDetailsScreenUIState) {
|
||||
|
||||
Reference in New Issue
Block a user