diff --git a/core/src/main/java/bisq/core/app/BisqSetup.java b/core/src/main/java/bisq/core/app/BisqSetup.java index a4a479ba088..6027f7f892a 100644 --- a/core/src/main/java/bisq/core/app/BisqSetup.java +++ b/core/src/main/java/bisq/core/app/BisqSetup.java @@ -223,45 +223,6 @@ public BisqSetup(DomainInitialisation domainInitialisation, this.appStartupState = appStartupState; } - - /////////////////////////////////////////////////////////////////////////////////////////// - // Setup - /////////////////////////////////////////////////////////////////////////////////////////// - - public void addBisqSetupListener(BisqSetupListener listener) { - bisqSetupListeners.add(listener); - } - - public void start() { - maybeReSyncSPVChain(); - maybeShowTac(this::step2); - } - - private void step2() { - torSetup.cleanupTorFiles(); - readMapsFromResources(this::step3); - checkForCorrectOSArchitecture(); - checkOSXVersion(); - checkIfRunningOnQubesOS(); - } - - private void step3() { - startP2pNetworkAndWallet(this::step4); - } - - private void step4() { - initDomainServices(); - - bisqSetupListeners.forEach(BisqSetupListener::onSetupComplete); - - // We set that after calling the setupCompleteHandler to not trigger a popup from the dev dummy accounts - // in MainViewModel - maybeShowSecurityRecommendation(); - maybeShowLocalhostRunningInfo(); - maybeShowAccountSigningStateInfo(); - } - - /////////////////////////////////////////////////////////////////////////////////////////// // API /////////////////////////////////////////////////////////////////////////////////////////// @@ -286,58 +247,45 @@ public void displayAlertIfPresent(Alert alert, boolean openNewVersionPopup) { /////////////////////////////////////////////////////////////////////////////////////////// - // Getters + // Main startup tasks /////////////////////////////////////////////////////////////////////////////////////////// - // Wallet - public StringProperty getBtcInfo() { - return walletAppSetup.getBtcInfo(); - } - - public DoubleProperty getBtcSyncProgress() { - return walletAppSetup.getBtcSyncProgress(); - } - - public StringProperty getWalletServiceErrorMsg() { - return walletAppSetup.getWalletServiceErrorMsg(); - } - - public StringProperty getBtcSplashSyncIconId() { - return walletAppSetup.getBtcSplashSyncIconId(); - } - - public BooleanProperty getUseTorForBTC() { - return walletAppSetup.getUseTorForBTC(); + public void addBisqSetupListener(BisqSetupListener listener) { + bisqSetupListeners.add(listener); } - // P2P - public StringProperty getP2PNetworkInfo() { - return p2PNetworkSetup.getP2PNetworkInfo(); + public void start() { + maybeReSyncSPVChain(); + maybeShowTac(this::step2); } - public BooleanProperty getSplashP2PNetworkAnimationVisible() { - return p2PNetworkSetup.getSplashP2PNetworkAnimationVisible(); + private void step2() { + torSetup.cleanupTorFiles(); + readMapsFromResources(this::step3); + checkForCorrectOSArchitecture(); + checkOSXVersion(); + checkIfRunningOnQubesOS(); } - public StringProperty getP2pNetworkWarnMsg() { - return p2PNetworkSetup.getP2pNetworkWarnMsg(); + private void step3() { + startP2pNetworkAndWallet(this::step4); } - public StringProperty getP2PNetworkIconId() { - return p2PNetworkSetup.getP2PNetworkIconId(); - } + private void step4() { + initDomainServices(); - public BooleanProperty getUpdatedDataReceived() { - return p2PNetworkSetup.getUpdatedDataReceived(); - } + bisqSetupListeners.forEach(BisqSetupListener::onSetupComplete); - public StringProperty getP2pNetworkLabelId() { - return p2PNetworkSetup.getP2pNetworkLabelId(); + // We set that after calling the setupCompleteHandler to not trigger a popup from the dev dummy accounts + // in MainViewModel + maybeShowSecurityRecommendation(); + maybeShowLocalhostRunningInfo(); + maybeShowAccountSigningStateInfo(); } /////////////////////////////////////////////////////////////////////////////////////////// - // Private + // Sub tasks /////////////////////////////////////////////////////////////////////////////////////////// private void maybeReSyncSPVChain() { @@ -467,6 +415,35 @@ private void initWallet() { () -> walletInitialized.set(true)); } + private void initDomainServices() { + log.info("initDomainServices"); + + domainInitialisation.initDomainServices(rejectedTxErrorMessageHandler, + displayPrivateNotificationHandler, + daoErrorMessageHandler, + daoWarnMessageHandler, + filterWarningHandler, + voteResultExceptionHandler, + revolutAccountsUpdateHandler); + + if (walletsSetup.downloadPercentageProperty().get() == 1) { + checkForLockedUpFunds(); + checkForInvalidMakerFeeTxs(); + } + + alertManager.alertMessageProperty().addListener((observable, oldValue, newValue) -> + displayAlertIfPresent(newValue, false)); + displayAlertIfPresent(alertManager.alertMessageProperty().get(), false); + + allBasicServicesInitialized = true; + + appStartupState.onDomainServicesInitialized(); + } + + + /////////////////////////////////////////////////////////////////////////////////////////// + // Utils + /////////////////////////////////////////////////////////////////////////////////////////// private void checkForLockedUpFunds() { // We check if there are locked up funds in failed or closed trades @@ -547,31 +524,6 @@ private void checkIfRunningOnQubesOS() { } } - private void initDomainServices() { - log.info("initDomainServices"); - - domainInitialisation.initDomainServices(rejectedTxErrorMessageHandler, - displayPrivateNotificationHandler, - daoErrorMessageHandler, - daoWarnMessageHandler, - filterWarningHandler, - voteResultExceptionHandler, - revolutAccountsUpdateHandler); - - if (walletsSetup.downloadPercentageProperty().get() == 1) { - checkForLockedUpFunds(); - checkForInvalidMakerFeeTxs(); - } - - alertManager.alertMessageProperty().addListener((observable, oldValue, newValue) -> - displayAlertIfPresent(newValue, false)); - displayAlertIfPresent(alertManager.alertMessageProperty().get(), false); - - allBasicServicesInitialized = true; - - appStartupState.onDomainServicesInitialized(); - } - private void maybeShowSecurityRecommendation() { String key = "remindPasswordAndBackup"; user.getPaymentAccountsAsObservable().addListener((SetChangeListener<PaymentAccount>) change -> { @@ -640,4 +592,57 @@ private void maybeTriggerDisplayHandler(String key, Consumer<String> displayHand displayHandler.accept(key); } } + + + /////////////////////////////////////////////////////////////////////////////////////////// + // Getters + /////////////////////////////////////////////////////////////////////////////////////////// + + // Wallet + public StringProperty getBtcInfo() { + return walletAppSetup.getBtcInfo(); + } + + public DoubleProperty getBtcSyncProgress() { + return walletAppSetup.getBtcSyncProgress(); + } + + public StringProperty getWalletServiceErrorMsg() { + return walletAppSetup.getWalletServiceErrorMsg(); + } + + public StringProperty getBtcSplashSyncIconId() { + return walletAppSetup.getBtcSplashSyncIconId(); + } + + public BooleanProperty getUseTorForBTC() { + return walletAppSetup.getUseTorForBTC(); + } + + // P2P + public StringProperty getP2PNetworkInfo() { + return p2PNetworkSetup.getP2PNetworkInfo(); + } + + public BooleanProperty getSplashP2PNetworkAnimationVisible() { + return p2PNetworkSetup.getSplashP2PNetworkAnimationVisible(); + } + + public StringProperty getP2pNetworkWarnMsg() { + return p2PNetworkSetup.getP2pNetworkWarnMsg(); + } + + public StringProperty getP2PNetworkIconId() { + return p2PNetworkSetup.getP2PNetworkIconId(); + } + + public BooleanProperty getUpdatedDataReceived() { + return p2PNetworkSetup.getUpdatedDataReceived(); + } + + public StringProperty getP2pNetworkLabelId() { + return p2PNetworkSetup.getP2pNetworkLabelId(); + } + + }