Skip to content

Commit

Permalink
Minor correction for handling deeplinks for Biometry screen
Browse files Browse the repository at this point in the history
  • Loading branch information
stzouvaras committed Jul 23, 2024
1 parent 4834db1 commit f870e5e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ import eu.europa.ec.uilogic.extension.resetBackStack
import eu.europa.ec.uilogic.extension.setBackStackFlowCancelled
import eu.europa.ec.uilogic.extension.setBackStackFlowSuccess
import eu.europa.ec.uilogic.navigation.CommonScreens
import eu.europa.ec.uilogic.navigation.DashboardScreens
import eu.europa.ec.uilogic.navigation.helper.handleDeepLinkAction
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.collect
Expand Down Expand Up @@ -122,19 +122,22 @@ fun BiometricScreen(
}

is Effect.Navigation.Deeplink -> {

context.cacheDeepLink(navigationEffect.link)

if (navigationEffect.isPreAuthorization) {
navController.navigate(DashboardScreens.Dashboard.screenRoute) {
popUpTo(CommonScreens.Biometric.screenRoute) { inclusive = true }
navigationEffect.routeToPop?.let { route ->
context.cacheDeepLink(navigationEffect.link)
if (navigationEffect.isPreAuthorization) {
navController.navigate(route) {
popUpTo(CommonScreens.Biometric.screenRoute) {
inclusive = true
}
}
} else {
navController.popBackStack(
route = route,
inclusive = false
)
}
} else {
navController.popBackStack(
route = DashboardScreens.Dashboard.screenRoute,
inclusive = false
)
}
} ?: handleDeepLinkAction(navController, navigationEffect.link)

}

is Effect.Navigation.Pop -> navController.popBackStack()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,12 @@ sealed class Effect : ViewSideEffect {
) : Navigation()

data object LaunchBiometricsSystemScreen : Navigation()
data class Deeplink(val link: Uri, val isPreAuthorization: Boolean) : Navigation()
data class Deeplink(
val link: Uri,
val isPreAuthorization: Boolean,
val routeToPop: String? = null
) : Navigation()

data object Pop : Navigation()
data object Finish : Navigation()
}
Expand Down Expand Up @@ -272,7 +277,8 @@ class BiometricViewModel(

is NavigationType.Deeplink -> Effect.Navigation.Deeplink(
nav.link.toUri(),
viewState.value.config.isPreAuthorization
viewState.value.config.isPreAuthorization,
nav.routeToPop
)

is NavigationType.Pop -> Effect.Navigation.Pop
Expand Down

0 comments on commit f870e5e

Please sign in to comment.