From 93d89cadaacf9906f46b6d76b7b867c37697212e Mon Sep 17 00:00:00 2001 From: Manfred Karrer Date: Wed, 9 Mar 2016 13:20:05 +0100 Subject: [PATCH] Add popup for support ticket --- .../java/io/bitsquare/gui/main/MainView.java | 4 +- .../gui/main/disputes/DisputesView.java | 58 ++++++++++- .../bitsquare/gui/main/overlays/Overlay.java | 4 +- .../windows/OpenEmergencyTicketWindow.java | 96 ------------------- .../pendingtrades/PendingTradesView.java | 18 +++- .../io/bitsquare/gui/util/BSFormatter.java | 7 +- 6 files changed, 82 insertions(+), 105 deletions(-) delete mode 100644 gui/src/main/java/io/bitsquare/gui/main/overlays/windows/OpenEmergencyTicketWindow.java diff --git a/gui/src/main/java/io/bitsquare/gui/main/MainView.java b/gui/src/main/java/io/bitsquare/gui/main/MainView.java index 825b5a344c..18388a3e80 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/MainView.java +++ b/gui/src/main/java/io/bitsquare/gui/main/MainView.java @@ -148,10 +148,10 @@ public class MainView extends InitializableView { Tuple2 availableBalanceBox = getBalanceBox("Available balance"); availableBalanceBox.first.textProperty().bind(model.availableBalance); - Tuple2 reservedBalanceBox = getBalanceBox("Reserved balance"); + Tuple2 reservedBalanceBox = getBalanceBox("Reserved in offers"); reservedBalanceBox.first.textProperty().bind(model.reservedBalance); - Tuple2 lockedBalanceBox = getBalanceBox("Locked balance"); + Tuple2 lockedBalanceBox = getBalanceBox("Locked in trades"); lockedBalanceBox.first.textProperty().bind(model.lockedBalance); HBox rightNavPane = new HBox(marketPriceBox.third, availableBalanceBox.second, reservedBalanceBox.second, lockedBalanceBox.second, diff --git a/gui/src/main/java/io/bitsquare/gui/main/disputes/DisputesView.java b/gui/src/main/java/io/bitsquare/gui/main/disputes/DisputesView.java index 014ad705d0..6440b20ba5 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/disputes/DisputesView.java +++ b/gui/src/main/java/io/bitsquare/gui/main/disputes/DisputesView.java @@ -17,6 +17,7 @@ package io.bitsquare.gui.main.disputes; +import io.bitsquare.app.BitsquareApp; import io.bitsquare.arbitration.Arbitrator; import io.bitsquare.arbitration.ArbitratorManager; import io.bitsquare.common.crypto.KeyRing; @@ -26,7 +27,11 @@ import io.bitsquare.gui.common.view.*; import io.bitsquare.gui.main.MainView; import io.bitsquare.gui.main.disputes.arbitrator.ArbitratorDisputeView; import io.bitsquare.gui.main.disputes.trader.TraderDisputeView; +import io.bitsquare.gui.main.overlays.popups.Popup; +import io.bitsquare.gui.main.portfolio.PortfolioView; +import io.bitsquare.gui.main.portfolio.pendingtrades.PendingTradesView; import io.bitsquare.p2p.NodeAddress; +import io.bitsquare.user.Preferences; import javafx.beans.value.ChangeListener; import javafx.collections.MapChangeListener; import javafx.fxml.FXML; @@ -47,6 +52,7 @@ public class DisputesView extends ActivatableViewAndModel private final Navigation navigation; private final ArbitratorManager arbitratorManager; private final KeyRing keyRing; + private Preferences preferences; private Navigation.Listener navigationListener; private ChangeListener tabChangeListener; @@ -56,13 +62,15 @@ public class DisputesView extends ActivatableViewAndModel private boolean isArbitrator; @Inject - public DisputesView(CachingViewLoader viewLoader, Navigation navigation, ArbitratorManager arbitratorManager, KeyRing keyRing) { + public DisputesView(CachingViewLoader viewLoader, Navigation navigation, ArbitratorManager arbitratorManager, + KeyRing keyRing, Preferences preferences) { this.viewLoader = viewLoader; this.navigation = navigation; this.arbitratorManager = arbitratorManager; this.keyRing = keyRing; + this.preferences = preferences; } @Override @@ -109,6 +117,54 @@ public class DisputesView extends ActivatableViewAndModel navigation.navigateTo(MainView.class, DisputesView.class, ArbitratorDisputeView.class); else navigation.navigateTo(MainView.class, DisputesView.class, TraderDisputeView.class); + + String key = "supportInfo"; + if (!BitsquareApp.DEV_MODE) + new Popup().backgroundInfo("Bitsquare is not a company and not operating any kind of customer support.\n\n" + + "If there are disputes in the trade process (e.g. one trader does not follow the trade protocol) " + + "the application will display a \"Open dispute\" button after the trade period is over " + + "for contacting the arbitrator.\n" + + "In cases of software bugs or network problems, which are detected by the application there will " + + "be displayed a \"Open support ticket\" button to contact the arbitrator who will forward the issue " + + "to the developers.\n\n" + + "In cases where a user got stuck by a bug without getting displayed that \"Open support ticket\" button, " + + "you can open a support ticket manually with a special short cut.\n\n" + + "Please use that only if you are sure that the software is not working like expected. " + + "If you have problems how to use Bitsquare or any questions please review the FAQ at the " + + "Bitsquare.io web page or contact the Bitsquare team using " + + "any of the communication channels offered " + + "at the Bitsquare.io web page.\n\n" + + "If you are sure you want to open a support ticket please select the trade which causes the problem " + + "under \"Portfolio/Open trades\" and type the key combination \"cmd + o\" to open the support ticket.") + .closeButtonText("Go to \"Open trades\"") + .onClose(() -> navigation.navigateTo(MainView.class, PortfolioView.class, PendingTradesView.class)) + .actionButtonText("Close") + .onAction(() -> { + }) + .dontShowAgainId(key, preferences) + .show(); + /* + .backgroundInfo("Bitsquare is not a company and not operating any kind of customer support.\n\n" + + "If there are disputes in the trade process (e.g. one trader does not follow the trade protocol) " + + "the application will display a \"Open dispute\" button after the trade period is over " + + "for contacting the arbitrator.\n" + + "In cases of software bugs or network problems, which are detected by the application there will " + + "be displayed a \"Open support ticket\" button to contact the arbitrator who will forward the issue " + + "to the developers.\n\n" + + "In cases where a user got stuck by a bug without getting displayed that \"Open support ticket\" button, " + + "you can open here a support ticket manually.\n\n" + + "Please use that only if you are sure that the software is not working like expected. " + + "If you have problems how to use Bitsquare of questions please review the FAQ at the " + + "Bitsquare.io web page or contact the Bitsquare over " + + "any of the communication channels offered " + + "at the Bitsquare.io web page.") + .closeButtonText("Open Bitsquare.io web page") + .onClose(() -> Utilities.openWebPage("https://bitsquare.io")) + .actionButtonText("I understand") + .onAction(() -> { + }) + .dontShowAgainId(key, preferences) + .show();*/ } @Override diff --git a/gui/src/main/java/io/bitsquare/gui/main/overlays/Overlay.java b/gui/src/main/java/io/bitsquare/gui/main/overlays/Overlay.java index 101ed6f14c..d33d1b4903 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/overlays/Overlay.java +++ b/gui/src/main/java/io/bitsquare/gui/main/overlays/Overlay.java @@ -671,8 +671,8 @@ public abstract class Overlay { } protected void setTruncatedMessage() { - if (message != null && message.length() > 900) - truncatedMessage = StringUtils.abbreviate(message, 900); + if (message != null && message.length() > 1200) + truncatedMessage = StringUtils.abbreviate(message, 1200); else truncatedMessage = message; } diff --git a/gui/src/main/java/io/bitsquare/gui/main/overlays/windows/OpenEmergencyTicketWindow.java b/gui/src/main/java/io/bitsquare/gui/main/overlays/windows/OpenEmergencyTicketWindow.java deleted file mode 100644 index 983223fabe..0000000000 --- a/gui/src/main/java/io/bitsquare/gui/main/overlays/windows/OpenEmergencyTicketWindow.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * This file is part of Bitsquare. - * - * Bitsquare 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. - * - * Bitsquare 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 Bitsquare. If not, see . - */ - -package io.bitsquare.gui.main.overlays.windows; - -import io.bitsquare.common.handlers.ResultHandler; -import io.bitsquare.gui.main.overlays.Overlay; -import javafx.geometry.Insets; -import javafx.scene.control.Button; -import javafx.scene.layout.GridPane; -import javafx.scene.layout.HBox; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import static io.bitsquare.gui.util.FormBuilder.addMultilineLabel; - -public class OpenEmergencyTicketWindow extends Overlay { - private static final Logger log = LoggerFactory.getLogger(OpenEmergencyTicketWindow.class); - private Button openTicketButton; - private ResultHandler openTicketHandler; - - - /////////////////////////////////////////////////////////////////////////////////////////// - // Public API - /////////////////////////////////////////////////////////////////////////////////////////// - - public OpenEmergencyTicketWindow() { - } - - public void show() { - if (headLine == null) - headLine = "Open support ticket"; - - width = 700; - createGridPane(); - addHeadLine(); - addSeparator(); - addContent(); - applyStyles(); - display(); - } - - public OpenEmergencyTicketWindow onOpenTicket(ResultHandler openTicketHandler) { - this.openTicketHandler = openTicketHandler; - return this; - } - - - /////////////////////////////////////////////////////////////////////////////////////////// - // Protected - /////////////////////////////////////////////////////////////////////////////////////////// - - private void addContent() { - addMultilineLabel(gridPane, ++rowIndex, - "Please use that only in emergency case if you don't get displayed a support or dispute screen in the UI.\n" + - "When you open a ticket the trade will be interrupted and handled by the arbitrator.", - 10); - - - openTicketButton = new Button("Open support ticket"); - openTicketButton.setOnAction(e -> { - openTicketHandler.handleResult(); - hide(); - }); - - closeButton = new Button("Cancel"); - closeButton.setOnAction(e -> { - hide(); - closeHandlerOptional.ifPresent(closeHandler -> closeHandler.run()); - }); - - HBox hBox = new HBox(); - hBox.setSpacing(10); - GridPane.setRowIndex(hBox, ++rowIndex); - GridPane.setColumnIndex(hBox, 1); - hBox.getChildren().addAll(openTicketButton, closeButton); - gridPane.getChildren().add(hBox); - GridPane.setMargin(hBox, new Insets(10, 0, 0, 0)); - } - - -} diff --git a/gui/src/main/java/io/bitsquare/gui/main/portfolio/pendingtrades/PendingTradesView.java b/gui/src/main/java/io/bitsquare/gui/main/portfolio/pendingtrades/PendingTradesView.java index be054509a5..19e2ba7df7 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/portfolio/pendingtrades/PendingTradesView.java +++ b/gui/src/main/java/io/bitsquare/gui/main/portfolio/pendingtrades/PendingTradesView.java @@ -22,7 +22,7 @@ import io.bitsquare.common.UserThread; import io.bitsquare.gui.common.view.ActivatableViewAndModel; import io.bitsquare.gui.common.view.FxmlView; import io.bitsquare.gui.components.HyperlinkWithIcon; -import io.bitsquare.gui.main.overlays.windows.OpenEmergencyTicketWindow; +import io.bitsquare.gui.main.overlays.popups.Popup; import io.bitsquare.gui.main.overlays.windows.TradeDetailsWindow; import io.bitsquare.gui.util.BSFormatter; import javafx.beans.property.ReadOnlyObjectWrapper; @@ -95,8 +95,20 @@ public class PendingTradesView extends ActivatableViewAndModel