TP-66425 | lite back-press when opened from pps/tds check-bal (#10811)

This commit is contained in:
Shaurya Rehan
2024-05-13 14:58:07 +05:30
committed by GitHub
parent c49ebceb52
commit fca2eb26ad
3 changed files with 13 additions and 8 deletions

View File

@@ -118,7 +118,8 @@ object NaviPayRouter {
val screenIdentifier = url.split("/").last()
return when (screenIdentifier) {
NaviPayScreenType.NAVI_PAY_QR_SCANNER_SCREEN.name -> QrScannerScreenDestination
NaviPayScreenType.NAVI_PAY_UPI_LITE.name -> UPILiteScreenDestination()
NaviPayScreenType.NAVI_PAY_UPI_LITE.name ->
UPILiteScreenDestination(shouldNavigateUp = false)
NaviPayScreenType.NAVI_PAY_CHECK_BALANCE.name ->
LinkedAccountsScreenDestination(isIntentOfTypeCheckBalance = true)
NaviPayScreenType.NAVI_PAY_CHECK_PRIMARY_BALANCE.name ->

View File

@@ -21,7 +21,6 @@ import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.snapshotFlow
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
@@ -57,12 +56,12 @@ import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.launch
@Destination
@OptIn(ExperimentalMaterialApi::class, ExperimentalComposeUiApi::class)
@OptIn(ExperimentalMaterialApi::class)
@Composable
fun UPILiteScreen(
naviPayActivity: NaviPayActivity,
navigator: DestinationsNavigator,
shouldNavigateUp: Boolean = false,
shouldNavigateUp: Boolean = true,
upiLiteViewModel: UPILiteViewModel = hiltViewModel(),
naviPayAnalytics: NaviPayAnalytics.NaviPayUPILite = NaviPayAnalytics.INSTANCE.NaviPayUPILite()
) {
@@ -129,11 +128,12 @@ fun UPILiteScreen(
val closeSheet = { upiLiteViewModel.updateBottomSheetUIState(showBottomSheet = false) }
val onBackClick = {
if (shouldNavigateUp || !naviPayActivity.needsResult) {
if (naviPayActivity.needsResult || !shouldNavigateUp) {
upiLiteViewModel.handleBackPress()
} else {
naviPayActivity.finish()
navigator.navigateUp()
}
Unit
}
BackHandler {
@@ -175,7 +175,11 @@ fun UPILiteScreen(
// Do nothing, back press is disabled for N seconds when top-up is in progress
}
is UpiLiteBackPressAction.GoBack -> {
navigator.navigateUp()
if (naviPayActivity.needsResult) {
naviPayActivity.finish()
} else {
navigator.navigateUp()
}
}
}
}

View File

@@ -285,7 +285,7 @@ constructor(
?.categoryTags
?.contains(TransactionCategoryTags.UPI_LITE_ADD_MONEY_AND_CLOSURE.value) ==
true -> {
updateNavigationToNextScreen(UPILiteScreenDestination(shouldNavigateUp = true))
updateNavigationToNextScreen(UPILiteScreenDestination())
}
transactionEntity.value
?.categoryTags