Skip to content

Commit

Permalink
Add new feature popup for account signing and new trade protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
ripcurlx committed Oct 21, 2019
1 parent dac85bb commit fdadd88
Show file tree
Hide file tree
Showing 24 changed files with 241 additions and 103 deletions.
13 changes: 5 additions & 8 deletions core/src/main/resources/i18n/displayStrings.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2530,14 +2530,11 @@ popup.attention.forTradeWithId=Attention required for trade with ID {0}
popup.info.multiplePaymentAccounts.headline=Multiple payment accounts available
popup.info.multiplePaymentAccounts.msg=You have multiple payment accounts available for this offer. Please make sure you've picked the right one.

popup.dao.launch.headline=The complete vision, realized
popup.dao.launch.governance.title=Governance
popup.dao.launch.governance=Bisq’s trading network was already decentralized. \nWith the Bisq DAO, Bisq’s leadership is now decentralized too, making Bisq exceptionally resistant to censorship.
popup.dao.launch.trading.title=Trade
popup.dao.launch.trading=Trade BSQ (colored bitcoin) to participate in Bisq governance. You can buy and sell BSQ just like any other asset on Bisq.
popup.dao.launch.cheaperFees.title=Cheaper fees
# suppress inspection "TrailingSpacesInProperty"
popup.dao.launch.cheaperFees=Get a 90% discount on trading fees when you use BSQ. Save money and support the project at the same time!\n\n
popup.news.launch.headline=Two Critical Updates
popup.news.launch.accountSigning.headline=ACCOUNT SIGNING
popup.news.launch.accountSigning.description=Lift 0.01 BTC fiat trading limits by buying BTC from a signed peer.
popup.news.launch.ntp.headline=NEW TRADE PROTOCOL
popup.news.launch.ntp.description=Multisig escrows are now 2-of-2 with a new dispute resolution system.

popup.accountSigning.selectAccounts.headline=Select payment accounts
popup.accountSigning.selectAccounts.description=Based on the payment method and point of time all payment accounts that are connected to a dispute where a payout to the buyer occurred will be selected for you to sign.
Expand Down
70 changes: 24 additions & 46 deletions desktop/src/main/java/bisq/desktop/bisq.css
Original file line number Diff line number Diff line change
Expand Up @@ -1967,66 +1967,44 @@ textfield */
-fx-font-size: 0.923em;
}

.dao-launch-version {
.price-trend-up {
-fx-text-fill: -bs-color-primary;
-fx-padding: 2 0 0 0;
}

.price-trend-down {
-fx-text-fill: -bs-red;
-fx-padding: 2 0 0 0;
}

/********************************************************************************************************************
* *
* News *
* *
********************************************************************************************************************/

.news-version {
-fx-alignment: center;
-fx-font-size: 1.077em;
}

.dao-launch-headline {
.news-headline {
-fx-font-size: 2.154em;
-fx-text-fill: -bs-rd-font-dark-gray;
-fx-font-family: "IBM Plex Sans Light";
}

.dao-launch-description {
-fx-font-size: 1.538em;
.news-feature-headline {
-fx-font-size: 1.462em;
-fx-text-fill: -bs-rd-font-dark-gray;
-fx-font-family: "IBM Plex Sans Light";
}

.dao-launch-paging-button {
-fx-text-fill: -bs-rd-font-light;
-fx-fill: -bs-rd-font-light;
}

.dao-launch-tab-box {
-fx-border-style: solid;
-fx-border-width: 1 0 0 0;
-fx-border-color: -bs-rd-tab-border;
}

.slider-section-button {
-fx-cursor: hand;
-fx-background-color: transparent;
-fx-translate-y: -1;
-fx-padding: 11;
}

.slider-section-button .text {
-fx-font-size: 0.923em;
-fx-fill: -bs-rd-font-dark-gray;
.news-feature-description {
-fx-font-size: 1.231em;
-fx-text-fill: -bs-rd-font-dark-gray;
-fx-font-family: "IBM Plex Sans Light";
}

.slider-section-button:selected {
-fx-border-style: solid;
-fx-border-width: 1 0 0 0;
-fx-border-color: -bs-rd-green;
}

.slider-section-button:selected .text {
-fx-fill: -bs-rd-green;
}

.price-trend-up {
-fx-text-fill: -bs-color-primary;
-fx-padding: 2 0 0 0;
}

.price-trend-down {
-fx-text-fill: -bs-red;
-fx-padding: 2 0 0 0;
}

/********************************************************************************************************************
* *
* Notifications *
Expand Down
29 changes: 4 additions & 25 deletions desktop/src/main/java/bisq/desktop/images.css
Original file line number Diff line number Diff line change
Expand Up @@ -279,31 +279,10 @@
-fx-image: url("../../images/avatars/avatar_15.png");
}

#poloniex {
-fx-image: url("../../images/poloniex.png");
#image-account-signing-screenshot {
-fx-image: url("../../images/account_signing_screenshot.png");
}

#btcaverage {
-fx-image: url("../../images/btcaverage.png");
#image-new-trade-protocol-screenshot {
-fx-image: url("../../images/new_trade_protocol_screenshot.png");
}

#accepted {
-fx-image: url("../../images/accepted.png");
}

#rejected {
-fx-image: url("../../images/rejected.png");
}

#dao-screenshot-governance {
-fx-image: url("../../images/dao-screenshot-governance.png");
}

#dao-screenshot-trading {
-fx-image: url("../../images/dao-screenshot-trading.png");
}

#dao-screenshot-cheaper-fees {
-fx-image: url("../../images/dao-screenshot-cheaper-fees.png");
}

30 changes: 11 additions & 19 deletions desktop/src/main/java/bisq/desktop/main/MainViewModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
import bisq.desktop.main.overlays.Overlay;
import bisq.desktop.main.overlays.notifications.NotificationCenter;
import bisq.desktop.main.overlays.popups.Popup;
import bisq.desktop.main.overlays.windows.DaoLaunchWindow;
import bisq.desktop.main.overlays.windows.DisplayAlertMessageWindow;
import bisq.desktop.main.overlays.windows.NewTradeProtocolLaunchWindow;
import bisq.desktop.main.overlays.windows.TacWindow;
import bisq.desktop.main.overlays.windows.TorNetworkSettingsWindow;
import bisq.desktop.main.overlays.windows.WalletPasswordWindow;
Expand Down Expand Up @@ -70,8 +70,6 @@

import com.google.inject.Inject;

import javafx.geometry.HPos;

import org.fxmisc.easybind.EasyBind;
import org.fxmisc.easybind.monadic.MonadicBinding;

Expand Down Expand Up @@ -268,7 +266,7 @@ void onSplashScreenRemoved() {
// in MainView showAppScreen handler
notificationCenter.onAllServicesAndViewsInitialized();

maybeAddDaoLaunchWindowToQueue();
maybeAddNewTradeProtocolLaunchWindowToQueue();
maybeShowPopupsFromQueue();
}

Expand Down Expand Up @@ -621,21 +619,15 @@ public BooleanProperty getShowAccountUpdatesNotification() {
return accountPresentation.getShowAccountUpdatesNotification();
}

private void maybeAddDaoLaunchWindowToQueue() {
if (DevEnv.isDaoActivated()) {
String daoLaunchPopupKey = "daoLaunchPopup";
if (DontShowAgainLookup.showAgain(daoLaunchPopupKey)) {
DaoLaunchWindow daoLaunchWindow = new DaoLaunchWindow()
.headLine(Res.get("popup.dao.launch.headline"))
.closeButtonText(Res.get("shared.dismiss"))
.actionButtonText(Res.get("shared.learnMore"))
.onAction(() -> GUIUtil.openWebPage("https://docs.bisq.network/dao.html"))
.buttonAlignment(HPos.CENTER);
daoLaunchWindow.setDisplayOrderPriority(1);
popupQueue.add(daoLaunchWindow);

DontShowAgainLookup.dontShowAgain(daoLaunchPopupKey, true);
}
private void maybeAddNewTradeProtocolLaunchWindowToQueue() {
String newTradeProtocolWithAccountSigningLaunchPopupKey = "newTradeProtocolWithAccountSigningLaunchPopup";
if (DontShowAgainLookup.showAgain(newTradeProtocolWithAccountSigningLaunchPopupKey)) {
NewTradeProtocolLaunchWindow newTradeProtocolLaunchWindow = new NewTradeProtocolLaunchWindow()
.headLine(Res.get("popup.news.launch.headline"));
newTradeProtocolLaunchWindow.setDisplayOrderPriority(1);
popupQueue.add(newTradeProtocolLaunchWindow);

DontShowAgainLookup.dontShowAgain(newTradeProtocolWithAccountSigningLaunchPopupKey, true);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
/*
* 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 <http://www.gnu.org/licenses/>.
*/

package bisq.desktop.main.overlays.windows;

import bisq.desktop.components.AutoTooltipButton;
import bisq.desktop.components.AutoTooltipLabel;
import bisq.desktop.main.overlays.Overlay;
import bisq.desktop.util.FormBuilder;
import bisq.desktop.util.GUIUtil;

import bisq.core.app.BisqEnvironment;
import bisq.core.locale.Res;
import bisq.core.user.DontShowAgainLookup;

import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIcon;

import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.image.ImageView;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;
import javafx.scene.layout.VBox;
import javafx.scene.text.TextAlignment;

import javafx.geometry.HPos;
import javafx.geometry.Insets;
import javafx.geometry.Pos;

import lombok.extern.slf4j.Slf4j;

import org.jetbrains.annotations.NotNull;

import static bisq.desktop.util.FormBuilder.addLabel;

@Slf4j
public class NewTradeProtocolLaunchWindow extends Overlay<NewTradeProtocolLaunchWindow> {


///////////////////////////////////////////////////////////////////////////////////////////
// Public API
///////////////////////////////////////////////////////////////////////////////////////////

@Override
public void show() {
width = 700;
hideCloseButton();
super.show();
}


///////////////////////////////////////////////////////////////////////////////////////////
// Protected
///////////////////////////////////////////////////////////////////////////////////////////

@Override
protected void createGridPane() {
super.createGridPane();
gridPane.setVgap(20);
gridPane.getColumnConstraints().get(0).setHalignment(HPos.CENTER);
gridPane.setPadding(new Insets(74, 64, 74, 64));
}

@Override
protected void addHeadLine() {

Label versionNumber = new AutoTooltipLabel(BisqEnvironment.DEFAULT_APP_NAME + " v1.2.0");
versionNumber.getStyleClass().add("news-version");
HBox.setHgrow(versionNumber, Priority.ALWAYS);
versionNumber.setMaxWidth(Double.MAX_VALUE);

Button closeButton = FormBuilder.getIconButton(MaterialDesignIcon.CLOSE);
closeButton.setOnAction(event -> hide());
HBox.setHgrow(closeButton, Priority.NEVER);

HBox header = new HBox(versionNumber, closeButton);

GridPane.setRowIndex(header, ++rowIndex);
GridPane.setColumnSpan(header, 2);
gridPane.getChildren().add(header);

Label headlineLabel = addLabel(gridPane, ++rowIndex, headLine);
headlineLabel.getStyleClass().add("news-headline");
GridPane.setMargin(headlineLabel, new Insets(10, 0, 0, 0));
GridPane.setColumnSpan(headlineLabel, 2);
}

@Override
protected void addMessage() {
createContent();
}

@Override
protected void onShow() {
display();
}

///////////////////////////////////////////////////////////////////////////////////////////
// Private
///////////////////////////////////////////////////////////////////////////////////////////

private void createContent() {
HBox content = new HBox();
content.setMinWidth(700);
content.setAlignment(Pos.CENTER);
content.setSpacing(20);

VBox accountSigning = getFeatureBox(Res.get("popup.news.launch.accountSigning.headline"),
Res.get("popup.news.launch.accountSigning.description"),
"image-account-signing-screenshot",
"https://docs.bisq.network/payment-methods#account-signing");

VBox newTradeProtocol = getFeatureBox(Res.get("popup.news.launch.ntp.headline"),
Res.get("popup.news.launch.ntp.description"),
"image-new-trade-protocol-screenshot",
"https://docs.bisq.network/trading-rules");

content.getChildren().addAll(accountSigning, newTradeProtocol);

GridPane.setRowIndex(content, ++rowIndex);
GridPane.setColumnSpan(content, 2);
GridPane.setHgrow(content, Priority.ALWAYS);
gridPane.getChildren().add(content);
}

@NotNull
private VBox getFeatureBox(String title, String description, String imageId, String url) {
Label featureTitle = new Label(title);
featureTitle.setTextAlignment(TextAlignment.CENTER);
featureTitle.getStyleClass().add("news-feature-headline");

ImageView sectionScreenshot = new ImageView();
sectionScreenshot.setId(imageId);

Label featureDescription = new Label(description);
featureDescription.setTextAlignment(TextAlignment.CENTER);
featureDescription.getStyleClass().add("news-feature-description");
featureDescription.setWrapText(true);

AutoTooltipButton learnMoreButton = new AutoTooltipButton(Res.get("shared.learnMore"));
learnMoreButton.getStyleClass().add("action-button");
learnMoreButton.setOnAction(event -> {

if (DontShowAgainLookup.showAgain(GUIUtil.OPEN_WEB_PAGE_KEY)) {
hide();
GUIUtil.openWebPage(url, true, () -> {
this.rowIndex = -1;
this.show();
});
} else {
GUIUtil.openWebPage(url);
}
});

VBox vBox = new VBox(featureTitle, sectionScreenshot, featureDescription, learnMoreButton);
vBox.setAlignment(Pos.CENTER);
vBox.setSpacing(20);
vBox.setMaxWidth(300);
return vBox;
}
}
Loading

0 comments on commit fdadd88

Please sign in to comment.