diff --git a/core/src/main/resources/i18n/displayStrings.properties b/core/src/main/resources/i18n/displayStrings.properties index 8a9291db80d..bb7a625a46d 100644 --- a/core/src/main/resources/i18n/displayStrings.properties +++ b/core/src/main/resources/i18n/displayStrings.properties @@ -1787,6 +1787,13 @@ popup.info.securityDepositInfo=To ensure that both traders follow the trade prot popup.info.cashDepositInfo=Please be sure that you have a bank branch in your area to be able to make the cash deposit.\n\ The bank ID (BIC/SWIFT) of the seller''s bank is: {0}. popup.info.cashDepositInfo.confirm=I confirm that I can make the deposit +popup.info.shutDownWithOpenOffers=You try to shut down Bisq with open offers. \n\n\ + When you shut down Bisq your offers are not available anymore in the P2P network. \ + The next time you start up Bisq again your offers will get re-published to the P2P network.\n\n\ + If you want to keep your offers online you need to leave Bisq running. \ + Be sure that your computer does not switch to standby mode when not active. \ + Standby mode of the monitor is not a problem. + popup.privateNotification.headline=Important private notification! diff --git a/desktop/src/main/java/bisq/desktop/app/BisqApp.java b/desktop/src/main/java/bisq/desktop/app/BisqApp.java index 10a74df32bb..97e450c17f3 100644 --- a/desktop/src/main/java/bisq/desktop/app/BisqApp.java +++ b/desktop/src/main/java/bisq/desktop/app/BisqApp.java @@ -39,6 +39,8 @@ import bisq.core.btc.wallet.WalletsManager; import bisq.core.filter.FilterManager; import bisq.core.locale.Res; +import bisq.core.offer.OpenOfferManager; +import bisq.core.user.Preferences; import bisq.common.UserThread; import bisq.common.app.DevEnv; @@ -212,7 +214,7 @@ private void setupStage(Scene scene) { stage.setOnCloseRequest(event -> { event.consume(); - stop(); + shutDownByUser(); }); // configure the primary stage @@ -247,7 +249,7 @@ private void addSceneKeyEventHandler(Scene scene, Injector injector) { scene.addEventHandler(KeyEvent.KEY_RELEASED, keyEvent -> { if (Utilities.isCtrlPressed(KeyCode.W, keyEvent) || Utilities.isCtrlPressed(KeyCode.Q, keyEvent)) { - stop(); + shutDownByUser(); } else { if (Utilities.isAltOrCtrlPressed(KeyCode.E, keyEvent)) { showBtcEmergencyWalletPopup(injector); @@ -280,6 +282,26 @@ private void addSceneKeyEventHandler(Scene scene, Injector injector) { }); } + private void shutDownByUser() { + if (injector.getInstance(OpenOfferManager.class).getObservableList().isEmpty()) { + // No open offers, so no need to show the popup. + stop(); + return; + } + + // We show a popup to inform user that open offers will be removed if Bisq is not running. + String key = "showOpenOfferWarnPopupAtShutDown"; + if (injector.getInstance(Preferences.class).showAgain(key)) { + new Popup<>().information(Res.get("popup.info.shutDownWithOpenOffers")) + .dontShowAgainId(key) + .useShutDownButton() + .closeButtonText(Res.get("shared.cancel")) + .show(); + } else { + stop(); + } + } + private void showSendAlertMessagePopup(Injector injector) { AlertManager alertManager = injector.getInstance(AlertManager.class); boolean useDevPrivilegeKeys = injector.getInstance(Key.get(Boolean.class, Names.named(AppOptionKeys.USE_DEV_PRIVILEGE_KEYS))); diff --git a/desktop/src/main/java/bisq/desktop/main/overlays/windows/WebCamWindow.java b/desktop/src/main/java/bisq/desktop/main/overlays/windows/WebCamWindow.java index 18a22b91671..78df5f25a4d 100644 --- a/desktop/src/main/java/bisq/desktop/main/overlays/windows/WebCamWindow.java +++ b/desktop/src/main/java/bisq/desktop/main/overlays/windows/WebCamWindow.java @@ -23,6 +23,8 @@ import bisq.core.locale.Res; +import bisq.common.UserThread; + import javafx.scene.control.Label; import javafx.scene.image.Image; import javafx.scene.image.ImageView; @@ -80,8 +82,12 @@ private void addContent() { protected void addCloseButton() { super.addCloseButton(); - closeButton.setVisible(false); - listener = (observable, oldValue, newValue) -> closeButton.setVisible(newValue != null); + closeButton.setText(Res.get("shared.cancel")); + + listener = (observable, oldValue, newValue) -> { + if (newValue != null) + UserThread.execute(() -> closeButton.setText(Res.get("shared.close"))); + }; imageView.imageProperty().addListener(listener); } diff --git a/desktop/src/main/java/bisq/desktop/util/GUIUtil.java b/desktop/src/main/java/bisq/desktop/util/GUIUtil.java index ceed04e2458..725832de112 100644 --- a/desktop/src/main/java/bisq/desktop/util/GUIUtil.java +++ b/desktop/src/main/java/bisq/desktop/util/GUIUtil.java @@ -462,6 +462,8 @@ else if (!walletsSetup.hasSufficientPeersForBroadcast()) new Popup<>().information(Res.get("popup.warning.notSufficientConnectionsToBtcNetwork", walletsSetup.getMinBroadcastConnections())).show(); else if (!walletsSetup.isDownloadComplete()) new Popup<>().information(Res.get("popup.warning.downloadNotComplete")).show(); + else + log.warn("showNotReadyForTxBroadcastPopups called but no case matched. This should never happen if isReadyForTxBroadcast was called before."); } public static void requestFocus(Node node) { diff --git a/p2p/src/main/java/bisq/network/p2p/network/Connection.java b/p2p/src/main/java/bisq/network/p2p/network/Connection.java index 8daa6cd7fef..2484b281438 100644 --- a/p2p/src/main/java/bisq/network/p2p/network/Connection.java +++ b/p2p/src/main/java/bisq/network/p2p/network/Connection.java @@ -336,7 +336,7 @@ public void removeMessageListener(MessageListener messageListener) { "That might happen because of async behaviour of CopyOnWriteArraySet"); } - public void addWeakRCapabilitiesListener(SupportedCapabilitiesListener listener) { + public void addWeakCapabilitiesListener(SupportedCapabilitiesListener listener) { capabilitiesListeners.add(new WeakReference<>(listener)); } diff --git a/p2p/src/main/java/bisq/network/p2p/peers/PeerManager.java b/p2p/src/main/java/bisq/network/p2p/peers/PeerManager.java index ed968f98178..dbdf7dbce3a 100644 --- a/p2p/src/main/java/bisq/network/p2p/peers/PeerManager.java +++ b/p2p/src/main/java/bisq/network/p2p/peers/PeerManager.java @@ -676,7 +676,7 @@ private Set getConnectedReportedPeers() { .orElse(new ArrayList<>()); } Peer peer = new Peer(connection.getPeersNodeAddressOptional().get(), supportedCapabilities); - connection.addWeakRCapabilitiesListener(peer); + connection.addWeakCapabilitiesListener(peer); return peer; }) .collect(Collectors.toSet());