From e8072a2360b68c289a95b91b5b18c0a56b6ca580 Mon Sep 17 00:00:00 2001 From: Manfred Karrer Date: Tue, 26 Jun 2018 13:25:17 +0200 Subject: [PATCH 1/3] Add popup for feedback after trade completion See: https://github.com/bisq-network/bisq-desktop/issues/1584 --- .../overlays/windows/TradeFeedbackWindow.java | 92 +++++++++++++++++++ .../steps/buyer/BuyerStep4View.java | 40 ++++++-- 2 files changed, 122 insertions(+), 10 deletions(-) create mode 100644 src/main/java/bisq/desktop/main/overlays/windows/TradeFeedbackWindow.java diff --git a/src/main/java/bisq/desktop/main/overlays/windows/TradeFeedbackWindow.java b/src/main/java/bisq/desktop/main/overlays/windows/TradeFeedbackWindow.java new file mode 100644 index 00000000000..21f557ce441 --- /dev/null +++ b/src/main/java/bisq/desktop/main/overlays/windows/TradeFeedbackWindow.java @@ -0,0 +1,92 @@ +/* + * This file is part of Bisq. + * + * Bisq is free software: you can redistribute it and/or modify it + * under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or (at + * your option) any later version. + * + * Bisq is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public + * License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with Bisq. If not, see . + */ + +package bisq.desktop.main.overlays.windows; + +import bisq.desktop.components.AutoTooltipLabel; +import bisq.desktop.components.HyperlinkWithIcon; +import bisq.desktop.main.overlays.Overlay; + +import bisq.core.locale.Res; + +import com.google.inject.Inject; + +import javafx.scene.layout.GridPane; +import javafx.scene.layout.Priority; + +import javafx.geometry.HPos; +import javafx.geometry.Insets; + +import lombok.extern.slf4j.Slf4j; + +import static bisq.desktop.util.FormBuilder.addHyperlinkWithIcon; + +@Slf4j +public class TradeFeedbackWindow extends Overlay { + @Inject + public TradeFeedbackWindow() { + type = Type.Confirmation; + } + + @Override + public void show() { + headLine(Res.get("tradeFeedbackWindow.title")); + message(Res.get("tradeFeedbackWindow.msg.part1")); + hideCloseButton(); + actionButtonText(Res.get("shared.close")); + + super.show(); + } + + @Override + protected void addMessage() { + super.addMessage(); + + HyperlinkWithIcon survey = addHyperlinkWithIcon(gridPane, ++rowIndex, "Bisq survey", + "http://survey.io/survey/87c4f"); + GridPane.setMargin(survey, new Insets(-6, 0, 10, -4)); + + AutoTooltipLabel messageLabel2 = new AutoTooltipLabel(Res.get("tradeFeedbackWindow.msg.part2")); + messageLabel2.setMouseTransparent(true); + messageLabel2.setWrapText(true); + GridPane.setHalignment(messageLabel2, HPos.LEFT); + GridPane.setHgrow(messageLabel2, Priority.ALWAYS); + GridPane.setRowIndex(messageLabel2, ++rowIndex); + GridPane.setColumnIndex(messageLabel2, 0); + GridPane.setColumnSpan(messageLabel2, 2); + gridPane.getChildren().add(messageLabel2); + + HyperlinkWithIcon forum = addHyperlinkWithIcon(gridPane, ++rowIndex, "Bisq Forum", + "https://bisq.community", 40); + GridPane.setMargin(forum, new Insets(-6, 0, 10, -4)); + + AutoTooltipLabel messageLabel3 = new AutoTooltipLabel(Res.get("tradeFeedbackWindow.msg.part3")); + messageLabel3.setMouseTransparent(true); + messageLabel3.setWrapText(true); + GridPane.setHalignment(messageLabel3, HPos.LEFT); + GridPane.setHgrow(messageLabel3, Priority.ALWAYS); + GridPane.setRowIndex(messageLabel3, ++rowIndex); + GridPane.setColumnIndex(messageLabel3, 0); + GridPane.setColumnSpan(messageLabel3, 2); + gridPane.getChildren().add(messageLabel3); + } + + @Override + protected void onShow() { + display(); + } +} diff --git a/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/buyer/BuyerStep4View.java b/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/buyer/BuyerStep4View.java index 4a9971c0979..3e85b603855 100644 --- a/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/buyer/BuyerStep4View.java +++ b/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/buyer/BuyerStep4View.java @@ -24,6 +24,7 @@ import bisq.desktop.main.MainView; import bisq.desktop.main.overlays.notifications.Notification; import bisq.desktop.main.overlays.popups.Popup; +import bisq.desktop.main.overlays.windows.TradeFeedbackWindow; import bisq.desktop.main.portfolio.PortfolioView; import bisq.desktop.main.portfolio.closedtrades.ClosedTradesView; import bisq.desktop.main.portfolio.pendingtrades.PendingTradesViewModel; @@ -284,19 +285,38 @@ private void doWithdrawRequest(String toAddress, Coin amount, Coin fee, KeyParam @SuppressWarnings("PointlessBooleanExpression") private void handleTradeCompleted() { - if (!DevEnv.isDevMode()) { - String key = "tradeCompleteWithdrawCompletedInfo"; - //noinspection unchecked - new Popup<>().headLine(Res.get("portfolio.pending.step5_buyer.withdrawalCompleted.headline")) - .feedback(Res.get("portfolio.pending.step5_buyer.withdrawalCompleted.msg")) - .actionButtonTextWithGoTo("navigation.portfolio.closedTrades") - .onAction(() -> model.dataModel.navigation.navigateTo(MainView.class, PortfolioView.class, ClosedTradesView.class)) - .dontShowAgainId(key) - .show(); - } useSavingsWalletButton.setDisable(true); withdrawToExternalWalletButton.setDisable(true); model.dataModel.btcWalletService.swapTradeEntryToAvailableEntry(trade.getId(), AddressEntry.Context.TRADE_PAYOUT); + + openTradeFeedbackWindow(); + } + + private void openTradeFeedbackWindow() { + String key = "feedbackPopupAfterTrade"; + if (!DevEnv.isDevMode() && preferences.showAgain(key)) { + UserThread.runAfter(() -> { + new TradeFeedbackWindow() + .dontShowAgainId(key) + .onAction(this::showNavigateToClosedTradesViewPopup) + .show(); + }, 500, TimeUnit.MILLISECONDS); + } else { + showNavigateToClosedTradesViewPopup(); + } + } + + private void showNavigateToClosedTradesViewPopup() { + if (!DevEnv.isDevMode()) { + UserThread.runAfter(() -> { + new Popup<>().headLine(Res.get("portfolio.pending.step5_buyer.withdrawalCompleted.headline")) + .feedback(Res.get("portfolio.pending.step5_buyer.withdrawalCompleted.msg")) + .actionButtonTextWithGoTo("navigation.portfolio.closedTrades") + .onAction(() -> model.dataModel.navigation.navigateTo(MainView.class, PortfolioView.class, ClosedTradesView.class)) + .dontShowAgainId("tradeCompleteWithdrawCompletedInfo") + .show(); + }, 500, TimeUnit.MILLISECONDS); + } } private void validateWithdrawAddress() { From 5d34cd960101c9561b4c3a73f139d596d1169cbd Mon Sep 17 00:00:00 2001 From: Manfred Karrer Date: Tue, 26 Jun 2018 13:43:22 +0200 Subject: [PATCH 2/3] Use https://bisq.network/survey as link --- .../bisq/desktop/main/overlays/windows/TradeFeedbackWindow.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/bisq/desktop/main/overlays/windows/TradeFeedbackWindow.java b/src/main/java/bisq/desktop/main/overlays/windows/TradeFeedbackWindow.java index 21f557ce441..3eef3e846b1 100644 --- a/src/main/java/bisq/desktop/main/overlays/windows/TradeFeedbackWindow.java +++ b/src/main/java/bisq/desktop/main/overlays/windows/TradeFeedbackWindow.java @@ -57,7 +57,7 @@ protected void addMessage() { super.addMessage(); HyperlinkWithIcon survey = addHyperlinkWithIcon(gridPane, ++rowIndex, "Bisq survey", - "http://survey.io/survey/87c4f"); + "https://bisq.network/survey"); GridPane.setMargin(survey, new Insets(-6, 0, 10, -4)); AutoTooltipLabel messageLabel2 = new AutoTooltipLabel(Res.get("tradeFeedbackWindow.msg.part2")); From 9e6e0c6de6ede1a9dd9560af1724c80412a07692 Mon Sep 17 00:00:00 2001 From: Manfred Karrer Date: Tue, 26 Jun 2018 21:52:49 +0200 Subject: [PATCH 3/3] Add support for referrer IDs at offers and trades See: https://github.com/bisq-network/proposals/issues/28 --- .../desktop/main/overlays/windows/TradeFeedbackWindow.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/bisq/desktop/main/overlays/windows/TradeFeedbackWindow.java b/src/main/java/bisq/desktop/main/overlays/windows/TradeFeedbackWindow.java index 3eef3e846b1..5e477327ae4 100644 --- a/src/main/java/bisq/desktop/main/overlays/windows/TradeFeedbackWindow.java +++ b/src/main/java/bisq/desktop/main/overlays/windows/TradeFeedbackWindow.java @@ -56,7 +56,7 @@ public void show() { protected void addMessage() { super.addMessage(); - HyperlinkWithIcon survey = addHyperlinkWithIcon(gridPane, ++rowIndex, "Bisq survey", + HyperlinkWithIcon survey = addHyperlinkWithIcon(gridPane, ++rowIndex, "https://bisq.network/survey", "https://bisq.network/survey"); GridPane.setMargin(survey, new Insets(-6, 0, 10, -4)); @@ -70,7 +70,7 @@ protected void addMessage() { GridPane.setColumnSpan(messageLabel2, 2); gridPane.getChildren().add(messageLabel2); - HyperlinkWithIcon forum = addHyperlinkWithIcon(gridPane, ++rowIndex, "Bisq Forum", + HyperlinkWithIcon forum = addHyperlinkWithIcon(gridPane, ++rowIndex, "https://bisq.community", "https://bisq.community", 40); GridPane.setMargin(forum, new Insets(-6, 0, 10, -4));