From bfa836985bbb0646081bd1b924b48f9ef6e79edd Mon Sep 17 00:00:00 2001 From: Rodrigo Varela Date: Thu, 19 Dec 2024 12:16:51 +1100 Subject: [PATCH 1/2] - reusing bisq onboarding trusted node setup screen with minimal adaptations --- .../ui/uicases/settings/SettingsPresenter.kt | 3 ++- .../uicases/settings/TrustedSettingsScreen.kt | 24 ------------------- .../uicases/startup/TrustedNodeSetupScreen.kt | 7 +++--- 3 files changed, 5 insertions(+), 29 deletions(-) delete mode 100644 shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/uicases/settings/TrustedSettingsScreen.kt diff --git a/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/uicases/settings/SettingsPresenter.kt b/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/uicases/settings/SettingsPresenter.kt index f592f678..59670612 100644 --- a/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/uicases/settings/SettingsPresenter.kt +++ b/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/uicases/settings/SettingsPresenter.kt @@ -4,6 +4,7 @@ import network.bisq.mobile.domain.data.repository.SettingsRepository import network.bisq.mobile.presentation.BasePresenter import network.bisq.mobile.presentation.MainPresenter import network.bisq.mobile.presentation.ui.components.molecules.settings.MenuItem +import network.bisq.mobile.presentation.ui.uicases.startup.TrustedNodeSetupScreen /** * SettingsPresenter with default implementation @@ -29,7 +30,7 @@ open class SettingsPresenter( } protected open fun addCustomSettings(menuItems: MutableList): List { - menuItems.add(MenuItem.Leaf("Trusted Node", content = { TrustedNodeSettingsScreen() })) + menuItems.add(MenuItem.Leaf("Trusted Node", content = { TrustedNodeSetupScreen(false) })) return menuItems.toList() } } \ No newline at end of file diff --git a/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/uicases/settings/TrustedSettingsScreen.kt b/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/uicases/settings/TrustedSettingsScreen.kt deleted file mode 100644 index e7229d4d..00000000 --- a/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/uicases/settings/TrustedSettingsScreen.kt +++ /dev/null @@ -1,24 +0,0 @@ -package network.bisq.mobile.presentation.ui.uicases.settings - -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.material3.MaterialTheme -import androidx.compose.material3.Text -import androidx.compose.runtime.Composable -import androidx.compose.ui.Modifier -import androidx.compose.ui.unit.sp -import network.bisq.mobile.presentation.ui.helpers.RememberPresenterLifecycle -import network.bisq.mobile.presentation.ui.theme.BisqTheme - -@Composable -fun TrustedNodeSettingsScreen() { - -// RememberPresenterLifecycle() - Column(modifier = Modifier.fillMaxSize()) { - Text( - text = "TrustedNodeSettingsScreen", - style = MaterialTheme.typography.bodyLarge.copy(color = BisqTheme.colors.light1 , fontSize = 16.sp), - modifier = Modifier.weight(1f) - ) - } -} \ No newline at end of file diff --git a/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/uicases/startup/TrustedNodeSetupScreen.kt b/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/uicases/startup/TrustedNodeSetupScreen.kt index b118556f..1bdd7a68 100644 --- a/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/uicases/startup/TrustedNodeSetupScreen.kt +++ b/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/ui/uicases/startup/TrustedNodeSetupScreen.kt @@ -45,8 +45,7 @@ interface ITrustedNodeSetupPresenter: ViewPresenter { @OptIn(ExperimentalResourceApi::class) @Composable -fun TrustedNodeSetupScreen( -) { +fun TrustedNodeSetupScreen(isWorkflow: Boolean = true) { val strings = LocalStrings.current val presenter: ITrustedNodeSetupPresenter = koinInject() val navController: NavHostController = presenter.getRootNavController() @@ -151,9 +150,9 @@ fun TrustedNodeSetupScreen( ) { BisqButton( - text = "Next", + text = if (isWorkflow) "Next" else "Save", color = BisqTheme.colors.light1, - onClick = { presenter.navigateToNextScreen() }, + onClick = { if (isWorkflow) presenter.navigateToNextScreen() else presenter.testConnection(true) }, padding = PaddingValues(horizontal = 32.dp, vertical = 12.dp), ) } From d794c9b058ea398f42da9e1f365ca4a95f4eeb19 Mon Sep 17 00:00:00 2001 From: Rodrigo Varela Date: Thu, 19 Dec 2024 12:20:46 +1100 Subject: [PATCH 2/2] turn off notifications test code --- .../kotlin/network/bisq/mobile/presentation/MainPresenter.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/MainPresenter.kt b/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/MainPresenter.kt index 98c6dcc8..4097f95b 100644 --- a/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/MainPresenter.kt +++ b/shared/presentation/src/commonMain/kotlin/network/bisq/mobile/presentation/MainPresenter.kt @@ -24,7 +24,7 @@ open class MainPresenter(private val notificationServiceController: Notification companion object { // FIXME this will be erased eventually, for now you can turn on to see the notifications working // it will push a notification every 60 sec - const val testNotifications = true + const val testNotifications = false const val PUSH_DELAY = 60000L }