Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI: Various improvements and fixes #142

Merged
merged 16 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ fun TopBar(
isHome: Boolean = false,
customBackButton: @Composable (() -> Unit)? = null,
backConfirmation: Boolean = false,
backBehavior: (() -> Unit)? = null,
isFlowScreen: Boolean = false,
stepText: String = ""
) {
Expand Down Expand Up @@ -138,8 +139,15 @@ fun TopBar(
},
)

// TODO: What if both backBehavior and backConfirmation are set
rodvar marked this conversation as resolved.
Show resolved Hide resolved
if (backBehavior != null) {
BackHandler(onBackPressed = {
backBehavior.invoke()
})
}

if (backConfirmation) {
BackHandler( onBackPressed = {
BackHandler(onBackPressed = {
showBackConfirmationDialog = true
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,20 @@ fun TabContainerScreen() {
Routes.TabSettings.name -> "Settings"
else -> "App"
},
backBehavior = {
if (currentRoute != Routes.TabHome.name) {
rodvar marked this conversation as resolved.
Show resolved Hide resolved
navController.navigate(Routes.TabHome.name) {
navController.graph.startDestinationRoute?.let { route ->
popUpTo(route) { saveState = false }
}
launchSingleTop = true
restoreState = false
}
} else {
presenter.showSnackbar("Press back again to exit")
presenter.goBack()
}
}
)

},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,6 @@ class CreateOfferReviewPresenter(
}

fun onGoToOfferList() {
rootNavigator.navigate(Routes.Offerbook.name)
rootNavigator.popBackStack(Routes.Offerbook.name, false, false)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ open class CreateProfilePresenter(
popUpTo(Routes.CreateProfile.name) { inclusive = true }
} */
rootNavigator.navigate(Routes.TabContainer.name) {
popUpTo(Routes.CreateProfile.name) { inclusive = true }
popUpTo(Routes.Onboarding.name) { inclusive = true }
}
}.onFailure { e ->
// TODO give user feedback (we could have a general error screen covering usual
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class TakeOfferReviewPresenter(

fun onGoToOpenTrades() {
rootNavigator.navigate(Routes.TradeFlow.name) {
popUpTo(Routes.TakeOfferTradeAmount.name) { inclusive = true }
popUpTo(Routes.Offerbook.name)
}
}

Expand Down
Loading