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

fix/node navigation onboarding #115

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
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 @@ -15,9 +15,10 @@ class NodeSplashPresenter(
) : SplashPresenter(mainPresenter, applicationBootstrapFacade, userProfileService, settingsRepository) {

/**
* Default implementation in shared is for xClients. Override on node to avoid this.
*
*/
override fun doCustomNavigationLogic(settings: Settings) {
override fun doCustomNavigationLogic(settings: Settings): Boolean {
// do nothin
return false
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,10 @@ import androidx.compose.foundation.layout.*
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.navigation.NavController
import androidx.navigation.NavHostController
import network.bisq.mobile.presentation.ui.components.atoms.BisqText
import network.bisq.mobile.presentation.ui.components.layout.BisqScrollLayout
import network.bisq.mobile.presentation.ui.theme.BisqTheme
import org.jetbrains.compose.resources.ExperimentalResourceApi
import org.koin.compose.koinInject
import org.koin.core.qualifier.named

@OptIn(ExperimentalResourceApi::class)
@Composable
fun SettingsScreen(
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,14 @@ open class SplashPresenter(
val settings: Settings? = settingsRepository.data.value

if (settings == null) {
rootNavigator.navigate(Routes.TrustedNodeSetup.name) {
popUpTo(Routes.Splash.name) { inclusive = true }
if (!doCustomNavigationLogic(Settings())) {
navigateToHome()
}
} else {
if (userProfileService.hasUserProfile()) {
// rootNavigator.navigate(Routes.TrustedNodeSetup.name) {
// [DONE] For androidNode, goto TabContainer
rootNavigator.navigate(Routes.TabContainer.name) {
popUpTo(Routes.Splash.name) { inclusive = true }
if (!doCustomNavigationLogic(settings)) {
navigateToHome()
}

doCustomNavigationLogic(settings)
} else {
// If firstTimeApp launch, goto Onboarding[clientMode] (androidNode / xClient)
// If not, goto CreateProfile
Expand All @@ -75,19 +71,24 @@ open class SplashPresenter(
}
}

private fun navigateToHome() {
rootNavigator.navigate(Routes.TabContainer.name) {
popUpTo(Routes.Splash.name) { inclusive = true }
}
}
/**
* Default implementation in shared is for xClients. Override on node to avoid this.
* @return true if handled, false otherwise
*/
open fun doCustomNavigationLogic(settings: Settings) {
open fun doCustomNavigationLogic(settings: Settings): Boolean {
if (settings.bisqApiUrl.isNotEmpty()) {
// Test if the Bisq remote instance is up and responding
// If yes, goto TabContainer screen.
// If no, goto TrustedNodeSetupScreen
navigateToHome()
} else {
rootNavigator.navigate(Routes.TrustedNodeSetup.name) {
popUpTo(Routes.Splash.name) { inclusive = true }
}
}
return true
}

private fun cancelJob() {
Expand Down
Loading