Skip to content

Commit

Permalink
Merge pull request #145 from niscy-eudiw/main
Browse files Browse the repository at this point in the history
minor cleanup
  • Loading branch information
stzouvaras authored Jul 8, 2024
2 parents 96e1fd6 + fe091a4 commit 0438f63
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,23 +69,6 @@ fun DocumentOfferCodeScreen(
}
}

private fun handleNavigationEffect(
navigationEffect: Effect.Navigation,
navController: NavController
) {
when (navigationEffect) {
is Effect.Navigation.SwitchScreen -> {
navController.navigate(navigationEffect.screenRoute) {
popUpTo(IssuanceScreens.DocumentOfferCode.screenRoute) {
inclusive = true
}
}
}

is Effect.Navigation.Pop -> navController.popBackStack()
}
}

@Composable
private fun Content(
context: Context,
Expand Down Expand Up @@ -130,7 +113,7 @@ private fun Content(
}

@Composable
fun CodeFieldLayout(
private fun CodeFieldLayout(
state: State,
onPinInput: (String) -> Unit,
) {
Expand All @@ -143,4 +126,21 @@ fun CodeFieldLayout(
pinWidth = 46.dp,
focusOnCreate = true,
)
}

private fun handleNavigationEffect(
navigationEffect: Effect.Navigation,
navController: NavController
) {
when (navigationEffect) {
is Effect.Navigation.SwitchScreen -> {
navController.navigate(navigationEffect.screenRoute) {
popUpTo(IssuanceScreens.DocumentOfferCode.screenRoute) {
inclusive = true
}
}
}

is Effect.Navigation.Pop -> navController.popBackStack()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -139,41 +139,6 @@ fun DocumentOfferScreen(
}
}

private fun handleNavigationEffect(
context: Context,
navigationEffect: Effect.Navigation,
navController: NavController
) {
when (navigationEffect) {
is Effect.Navigation.SwitchScreen -> {
navController.navigate(navigationEffect.screenRoute) {
if (navigationEffect.shouldPopToSelf) {
popUpTo(IssuanceScreens.DocumentOffer.screenRoute) {
inclusive = true
}
}
}
}

is Effect.Navigation.PopBackStackUpTo -> {
navController.popBackStack(
route = navigationEffect.screenRoute,
inclusive = navigationEffect.inclusive
)
}

is Effect.Navigation.DeepLink -> {
context.cacheDeepLink(navigationEffect.link)
navController.popBackStack(
route = DashboardScreens.Dashboard.screenRoute,
inclusive = false
)
}

is Effect.Navigation.Pop -> navController.popBackStack()
}
}

@OptIn(ExperimentalMaterial3Api::class)
@Composable
private fun Content(
Expand Down Expand Up @@ -310,4 +275,39 @@ private fun StickyBottomSection(
Text(text = stringResource(id = R.string.issuance_document_offer_secondary_button_text))
}
}
}

private fun handleNavigationEffect(
context: Context,
navigationEffect: Effect.Navigation,
navController: NavController
) {
when (navigationEffect) {
is Effect.Navigation.SwitchScreen -> {
navController.navigate(navigationEffect.screenRoute) {
if (navigationEffect.shouldPopToSelf) {
popUpTo(IssuanceScreens.DocumentOffer.screenRoute) {
inclusive = true
}
}
}
}

is Effect.Navigation.PopBackStackUpTo -> {
navController.popBackStack(
route = navigationEffect.screenRoute,
inclusive = navigationEffect.inclusive
)
}

is Effect.Navigation.DeepLink -> {
context.cacheDeepLink(navigationEffect.link)
navController.popBackStack(
route = DashboardScreens.Dashboard.screenRoute,
inclusive = false
)
}

is Effect.Navigation.Pop -> navController.popBackStack()
}
}

0 comments on commit 0438f63

Please sign in to comment.