From fc8dd8cccbce91ccfd8dbbb4e7c9e306a7e7ecdf Mon Sep 17 00:00:00 2001 From: Christoph Atteneder Date: Thu, 10 Oct 2019 12:09:22 +0200 Subject: [PATCH 1/5] Remove new badge from Altcoin instant feature --- .../components/paymentmethods/AssetsForm.java | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/desktop/src/main/java/bisq/desktop/components/paymentmethods/AssetsForm.java b/desktop/src/main/java/bisq/desktop/components/paymentmethods/AssetsForm.java index 58078de9e49..6ddde755889 100644 --- a/desktop/src/main/java/bisq/desktop/components/paymentmethods/AssetsForm.java +++ b/desktop/src/main/java/bisq/desktop/components/paymentmethods/AssetsForm.java @@ -17,9 +17,8 @@ package bisq.desktop.components.paymentmethods; -import bisq.desktop.components.InputTextField; -import bisq.desktop.components.NewBadge; import bisq.desktop.components.AutocompleteComboBox; +import bisq.desktop.components.InputTextField; import bisq.desktop.main.overlays.popups.Popup; import bisq.desktop.util.FormBuilder; import bisq.desktop.util.Layout; @@ -48,12 +47,9 @@ import javafx.scene.control.Label; import javafx.scene.control.TextField; import javafx.scene.layout.GridPane; -import javafx.scene.layout.Priority; -import javafx.scene.layout.Region; import javafx.scene.layout.VBox; import javafx.geometry.Insets; -import javafx.geometry.Pos; import javafx.util.StringConverter; @@ -120,19 +116,10 @@ public void addFormForAddAccount() { new Popup<>().information(Res.get("payment.altcoin.tradeInstant.popup")).show(); }); - // add new badge for this new feature for this release - // TODO: remove it with 0.9.6+ gridPane.getChildren().remove(tradeInstantCheckBox); tradeInstantCheckBox.setPadding(new Insets(0, 40, 0, 0)); - NewBadge instantTradeNewsBadge = new NewBadge(tradeInstantCheckBox, INSTANT_TRADE_NEWS, preferences); - instantTradeNewsBadge.setAlignment(Pos.CENTER_LEFT); - instantTradeNewsBadge.setMaxSize(Region.USE_PREF_SIZE, Region.USE_PREF_SIZE); - - GridPane.setRowIndex(instantTradeNewsBadge, gridRow); - GridPane.setHgrow(instantTradeNewsBadge, Priority.NEVER); - GridPane.setMargin(instantTradeNewsBadge, new Insets(10, 0, 0, 0)); - gridPane.getChildren().add(instantTradeNewsBadge); + gridPane.getChildren().add(tradeInstantCheckBox); addressInputTextField = FormBuilder.addInputTextField(gridPane, ++gridRow, Res.get("payment.altcoin.address")); From d0254f400fdad6ff6cc35b92df44a3db81bebcd2 Mon Sep 17 00:00:00 2001 From: Christoph Atteneder Date: Thu, 10 Oct 2019 12:09:59 +0200 Subject: [PATCH 2/5] Remove new badge from percentage user deposit feature --- .../java/bisq/desktop/main/offer/MutableOfferView.java | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferView.java b/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferView.java index 565f4311990..ac10b4570fb 100644 --- a/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferView.java +++ b/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferView.java @@ -28,7 +28,6 @@ import bisq.desktop.components.FundsTextField; import bisq.desktop.components.InfoInputTextField; import bisq.desktop.components.InputTextField; -import bisq.desktop.components.NewBadge; import bisq.desktop.components.TitledGroupBg; import bisq.desktop.main.MainView; import bisq.desktop.main.account.AccountView; @@ -1037,13 +1036,7 @@ private void addOptionsGroup() { GridPane.setMargin(advancedOptionsBox, new Insets(Layout.COMPACT_FIRST_ROW_AND_GROUP_DISTANCE, 0, 0, 0)); gridPane.getChildren().add(advancedOptionsBox); - // add new badge for this new feature for this release - // TODO: remove it with 0.9.6+ - NewBadge securityDepositBoxWithNewBadge = new NewBadge(getBuyerSecurityDepositBox(), - BUYER_SECURITY_DEPOSIT_NEWS, preferences); - - advancedOptionsBox.getChildren().addAll(securityDepositBoxWithNewBadge, getTradeFeeFieldsBox()); - + advancedOptionsBox.getChildren().addAll(getBuyerSecurityDepositBox(), getTradeFeeFieldsBox()); Tuple2 tuple = add2ButtonsAfterGroup(gridPane, ++gridRow, Res.get("shared.nextStep"), Res.get("shared.cancel")); From 5ca7815fdc8d9f08787c39b8b1d78ee17dd08c47 Mon Sep 17 00:00:00 2001 From: Christoph Atteneder Date: Thu, 10 Oct 2019 12:10:45 +0200 Subject: [PATCH 3/5] Fix line break issues in received payment confirmation popup --- core/src/main/resources/i18n/displayStrings.properties | 4 ++-- .../portfolio/pendingtrades/steps/seller/SellerStep3View.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/src/main/resources/i18n/displayStrings.properties b/core/src/main/resources/i18n/displayStrings.properties index 08f3d486b2e..2a0bf5bbd48 100644 --- a/core/src/main/resources/i18n/displayStrings.properties +++ b/core/src/main/resources/i18n/displayStrings.properties @@ -701,9 +701,9 @@ portfolio.pending.step3_seller.westernUnion=The buyer has to send you the MTCN ( portfolio.pending.step3_seller.halCash=The buyer has to send you the HalCash code as text message. Beside that you will receive a message from HalCash with the required information to withdraw the EUR from a HalCash supporting ATM.\n\n\ After you have picked up the money from the ATM please confirm here the receipt of the payment! -portfolio.pending.step3_seller.bankCheck=\n\nPlease also verify that the sender's name in your bank statement matches that one from the trade contract:\nSender's name: {0}\n\n\ +portfolio.pending.step3_seller.bankCheck=\n\nPlease also verify that the sender''s name in your bank statement matches that one from the trade contract:\nSender''s name: {0}\n\n\ If the name is not the same as the one displayed here, {1} -portfolio.pending.step3_seller.openDispute=please don't confirm but open a dispute by entering \"alt + o\" or \"option + o\". +portfolio.pending.step3_seller.openDispute=please don't confirm but open a dispute by entering \"alt + o\" or \"option + o\".\n\n portfolio.pending.step3_seller.confirmPaymentReceipt=Confirm payment receipt portfolio.pending.step3_seller.amountToReceive=Amount to receive portfolio.pending.step3_seller.yourAddress=Your {0} address diff --git a/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/seller/SellerStep3View.java b/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/seller/SellerStep3View.java index 55f741fbd1a..2990067d3f1 100644 --- a/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/seller/SellerStep3View.java +++ b/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/seller/SellerStep3View.java @@ -348,7 +348,7 @@ else if (paymentAccountPayload instanceof F2FAccountPayload) Optional optionalHolderName = getOptionalHolderName(); if (optionalHolderName.isPresent()) { - message = message + Res.get("portfolio.pending.step3_seller.bankCheck", optionalHolderName.get(), part); + message += Res.get("portfolio.pending.step3_seller.bankCheck", optionalHolderName.get(), part); } if (model.isSignWitnessTrade(true)) { From 4578704a5b52ffa31e0ad519bf2b03dbd7163bee Mon Sep 17 00:00:00 2001 From: Christoph Atteneder Date: Thu, 10 Oct 2019 12:11:42 +0200 Subject: [PATCH 4/5] Check if received payload fulfills signing state condition and not any personal witness --- core/src/main/java/bisq/core/app/BisqSetup.java | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/core/src/main/java/bisq/core/app/BisqSetup.java b/core/src/main/java/bisq/core/app/BisqSetup.java index 5f17f2d33ed..95aa8cfcf29 100644 --- a/core/src/main/java/bisq/core/app/BisqSetup.java +++ b/core/src/main/java/bisq/core/app/BisqSetup.java @@ -19,7 +19,6 @@ import bisq.core.account.sign.SignedWitness; import bisq.core.account.sign.SignedWitnessService; -import bisq.core.account.witness.AccountAgeWitness; import bisq.core.account.witness.AccountAgeWitnessService; import bisq.core.alert.Alert; import bisq.core.alert.AlertManager; @@ -106,6 +105,7 @@ import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.concurrent.TimeUnit; import java.util.function.BiConsumer; @@ -773,15 +773,12 @@ private boolean isSignedWitnessOfMineWithState(PersistableNetworkPayload payload if (payload instanceof SignedWitness && user.getPaymentAccounts() != null) { // We know at this point that it is already added to the signed witness list // Check if new signed witness is for one of my own accounts - return user.getPaymentAccounts().stream() .filter(a -> PaymentMethod.hasChargebackRisk(a.getPaymentMethod(), a.getTradeCurrencies())) - .anyMatch(a -> { - AccountAgeWitness myWitness = accountAgeWitnessService.getMyWitness(a.getPaymentAccountPayload()); - AccountAgeWitnessService.SignState signState = accountAgeWitnessService.getSignState(myWitness); - - return (signState.equals(state)); - }); + .filter(a -> Arrays.equals(((SignedWitness) payload).getWitnessHash(), + accountAgeWitnessService.getMyWitness(a.getPaymentAccountPayload()).getHash())) + .anyMatch(a -> accountAgeWitnessService.getSignState(accountAgeWitnessService.getMyWitness( + a.getPaymentAccountPayload())).equals(state)); } return false; } From 3e3fdcbf1c9d751d05209cd53fa1904e4a75a3ba Mon Sep 17 00:00:00 2001 From: Christoph Atteneder Date: Thu, 10 Oct 2019 12:13:21 +0200 Subject: [PATCH 5/5] Show additional badge for account sections to guide user to check out new signing states --- .../main/java/bisq/desktop/main/MainView.java | 9 +- .../java/bisq/desktop/main/MainViewModel.java | 50 ++++------- .../desktop/main/account/AccountView.java | 5 ++ .../presentation/AccountPresentation.java | 82 +++++++++++++++++++ 4 files changed, 110 insertions(+), 36 deletions(-) create mode 100644 desktop/src/main/java/bisq/desktop/main/presentation/AccountPresentation.java diff --git a/desktop/src/main/java/bisq/desktop/main/MainView.java b/desktop/src/main/java/bisq/desktop/main/MainView.java index ff09adc716a..ad98f7bbe42 100644 --- a/desktop/src/main/java/bisq/desktop/main/MainView.java +++ b/desktop/src/main/java/bisq/desktop/main/MainView.java @@ -44,9 +44,9 @@ import bisq.core.dao.monitoring.DaoStateMonitoringService; import bisq.core.exceptions.BisqException; import bisq.core.locale.GlobalSettings; +import bisq.core.locale.LanguageUtil; import bisq.core.locale.Res; import bisq.core.util.BSFormatter; -import bisq.core.locale.LanguageUtil; import bisq.common.Timer; import bisq.common.UserThread; @@ -82,9 +82,9 @@ import javafx.scene.text.TextAlignment; import javafx.geometry.Insets; +import javafx.geometry.NodeOrientation; import javafx.geometry.Orientation; import javafx.geometry.Pos; -import javafx.geometry.NodeOrientation; import javafx.beans.binding.ObjectBinding; import javafx.beans.property.BooleanProperty; @@ -194,6 +194,8 @@ protected void initialize() { JFXBadge supportButtonWithBadge = new JFXBadge(supportButton); JFXBadge daoButtonWithBadge = new JFXBadge(daoButton); daoButtonWithBadge.getStyleClass().add("new"); + JFXBadge accountButtonWithBadge = new JFXBadge(accountButton); + accountButtonWithBadge.getStyleClass().add("new"); Locale locale = GlobalSettings.getLocale(); DecimalFormat currencyFormat = (DecimalFormat) NumberFormat.getNumberInstance(locale); @@ -322,7 +324,7 @@ protected Tooltip computeValue() { HBox.setHgrow(primaryNav, Priority.SOMETIMES); HBox secondaryNav = new HBox(supportButtonWithBadge, getNavigationSpacer(), settingsButton, - getNavigationSpacer(), accountButton, getNavigationSpacer(), daoButtonWithBadge); + getNavigationSpacer(), accountButtonWithBadge, getNavigationSpacer(), daoButtonWithBadge); secondaryNav.getStyleClass().add("nav-secondary"); HBox.setHgrow(secondaryNav, Priority.SOMETIMES); @@ -366,6 +368,7 @@ protected Tooltip computeValue() { setupBadge(portfolioButtonWithBadge, model.getNumPendingTrades(), model.getShowPendingTradesNotification()); setupBadge(supportButtonWithBadge, model.getNumOpenSupportTickets(), model.getShowOpenSupportTicketsNotification()); setupBadge(daoButtonWithBadge, new SimpleStringProperty(Res.get("shared.new")), model.getShowDaoUpdatesNotification()); + setupBadge(accountButtonWithBadge, new SimpleStringProperty(Res.get("shared.new")), model.getShowAccountUpdatesNotification()); navigation.addListener(viewPath -> { if (viewPath.size() != 2 || viewPath.indexOf(MainView.class) != 0) diff --git a/desktop/src/main/java/bisq/desktop/main/MainViewModel.java b/desktop/src/main/java/bisq/desktop/main/MainViewModel.java index c0f41460f6b..41fc37a88b5 100644 --- a/desktop/src/main/java/bisq/desktop/main/MainViewModel.java +++ b/desktop/src/main/java/bisq/desktop/main/MainViewModel.java @@ -30,6 +30,7 @@ import bisq.desktop.main.overlays.windows.TorNetworkSettingsWindow; import bisq.desktop.main.overlays.windows.WalletPasswordWindow; import bisq.desktop.main.overlays.windows.downloadupdate.DisplayUpdateDownloadWindow; +import bisq.desktop.main.presentation.AccountPresentation; import bisq.desktop.main.presentation.DaoPresentation; import bisq.desktop.main.presentation.MarketPricePresentation; import bisq.desktop.main.shared.PriceFeedComboBoxItem; @@ -105,6 +106,7 @@ public class MainViewModel implements ViewModel, BisqSetup.BisqSetupCompleteList private final SupportTicketsPresentation supportTicketsPresentation; private final MarketPricePresentation marketPricePresentation; private final DaoPresentation daoPresentation; + private final AccountPresentation accountPresentation; private final P2PService p2PService; private final TradeManager tradeManager; @Getter @@ -146,7 +148,7 @@ public MainViewModel(BisqSetup bisqSetup, SupportTicketsPresentation supportTicketsPresentation, MarketPricePresentation marketPricePresentation, DaoPresentation daoPresentation, - P2PService p2PService, + AccountPresentation accountPresentation, P2PService p2PService, TradeManager tradeManager, Preferences preferences, PrivateNotificationManager privateNotificationManager, @@ -167,6 +169,7 @@ public MainViewModel(BisqSetup bisqSetup, this.supportTicketsPresentation = supportTicketsPresentation; this.marketPricePresentation = marketPricePresentation; this.daoPresentation = daoPresentation; + this.accountPresentation = accountPresentation; this.p2PService = p2PService; this.tradeManager = tradeManager; this.preferences = preferences; @@ -241,6 +244,7 @@ public void onSetupComplete() { marketPricePresentation.setup(); daoPresentation.setup(); + accountPresentation.setup(); if (DevEnv.isDevMode()) { preferences.setShowOwnOffersInOfferBook(true); @@ -350,38 +354,14 @@ private void setupHandlers() { popupQueue.add(popup); } }); - bisqSetup.setDisplaySignedByArbitratorHandler(key -> { - if (!DevEnv.isDevMode()) { - preferences.dontShowAgain(key, true); - new Popup<>().information(Res.get("popup.accountSigning.signedByArbitrator", - Res.get("popup.accountSigning.generalInformation"))) - .show(); - } - }); - bisqSetup.setDisplaySignedByPeerHandler(key -> { - if (!DevEnv.isDevMode()) { - preferences.dontShowAgain(key, true); - new Popup<>().information(Res.get("popup.accountSigning.signedByPeer", - Res.get("popup.accountSigning.generalInformation"))) - .show(); - } - }); - bisqSetup.setDisplayPeerLimitLiftedHandler(key -> { - if (!DevEnv.isDevMode()) { - preferences.dontShowAgain(key, true); - new Popup<>().information(Res.get("popup.accountSigning.peerLimitLifted", - Res.get("popup.accountSigning.generalInformation"))) - .show(); - } - }); - bisqSetup.setDisplayPeerSignerHandler(key -> { - if (!DevEnv.isDevMode()) { - preferences.dontShowAgain(key, true); - new Popup<>().information(Res.get("popup.accountSigning.peerSigner", - Res.get("popup.accountSigning.generalInformation"))) - .show(); - } - }); + bisqSetup.setDisplaySignedByArbitratorHandler(key -> accountPresentation.showOneTimeAccountSigningPopup( + key, "popup.accountSigning.signedByArbitrator")); + bisqSetup.setDisplaySignedByPeerHandler(key -> accountPresentation.showOneTimeAccountSigningPopup( + key, "popup.accountSigning.signedByPeer")); + bisqSetup.setDisplayPeerLimitLiftedHandler(key -> accountPresentation.showOneTimeAccountSigningPopup( + key, "popup.accountSigning.peerLimitLifted")); + bisqSetup.setDisplayPeerSignerHandler(key -> accountPresentation.showOneTimeAccountSigningPopup( + key, "popup.accountSigning.peerSigner")); bisqSetup.setWrongOSArchitectureHandler(msg -> new Popup<>().warning(msg).show()); @@ -636,6 +616,10 @@ public BooleanProperty getShowDaoUpdatesNotification() { return daoPresentation.getShowDaoUpdatesNotification(); } + public BooleanProperty getShowAccountUpdatesNotification() { + return accountPresentation.getShowAccountUpdatesNotification(); + } + private void maybeAddDaoLaunchWindowToQueue() { if (DevEnv.isDaoActivated()) { String daoLaunchPopupKey = "daoLaunchPopup"; diff --git a/desktop/src/main/java/bisq/desktop/main/account/AccountView.java b/desktop/src/main/java/bisq/desktop/main/account/AccountView.java index e13272a1d1c..692f13c536d 100644 --- a/desktop/src/main/java/bisq/desktop/main/account/AccountView.java +++ b/desktop/src/main/java/bisq/desktop/main/account/AccountView.java @@ -34,8 +34,10 @@ import bisq.desktop.main.account.register.mediator.MediatorRegistrationView; import bisq.desktop.main.account.register.refundagent.RefundAgentRegistrationView; import bisq.desktop.main.overlays.popups.Popup; +import bisq.desktop.main.presentation.AccountPresentation; import bisq.core.locale.Res; +import bisq.core.user.DontShowAgainLookup; import bisq.common.app.DevEnv; import bisq.common.util.Utilities; @@ -206,6 +208,9 @@ private void onRefundAgentRegistrationTabRemoved() { @Override protected void activate() { + // Hide account new badge if user saw this section + DontShowAgainLookup.dontShowAgain(AccountPresentation.ACCOUNT_NEWS, true); + navigation.addListener(navigationListener); root.getSelectionModel().selectedItemProperty().addListener(tabChangeListener); diff --git a/desktop/src/main/java/bisq/desktop/main/presentation/AccountPresentation.java b/desktop/src/main/java/bisq/desktop/main/presentation/AccountPresentation.java new file mode 100644 index 00000000000..72be3bb7f57 --- /dev/null +++ b/desktop/src/main/java/bisq/desktop/main/presentation/AccountPresentation.java @@ -0,0 +1,82 @@ +/* + * 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.presentation; + +import bisq.desktop.main.overlays.popups.Popup; + +import bisq.core.locale.Res; +import bisq.core.user.DontShowAgainLookup; +import bisq.core.user.Preferences; + +import bisq.common.app.DevEnv; + +import javax.inject.Inject; +import javax.inject.Singleton; + +import javafx.beans.property.BooleanProperty; +import javafx.beans.property.SimpleBooleanProperty; + +import javafx.collections.MapChangeListener; + + +@Singleton +public class AccountPresentation { + + public static final String ACCOUNT_NEWS = "accountNews"; + + private Preferences preferences; + + private final SimpleBooleanProperty showNotification = new SimpleBooleanProperty(false); + + @Inject + public AccountPresentation(Preferences preferences) { + + this.preferences = preferences; + + preferences.getDontShowAgainMapAsObservable().addListener((MapChangeListener) change -> { + if (change.getKey().equals(ACCOUNT_NEWS)) { + showNotification.set(!change.wasAdded()); + } + }); + } + + /////////////////////////////////////////////////////////////////////////////////////////// + // Public + /////////////////////////////////////////////////////////////////////////////////////////// + + public BooleanProperty getShowAccountUpdatesNotification() { + return showNotification; + } + + public void setup() { + showNotification.set(preferences.showAgain(ACCOUNT_NEWS)); + } + + public void showOneTimeAccountSigningPopup(String key, String s) { + if (!DevEnv.isDevMode()) { + + DontShowAgainLookup.dontShowAgain(ACCOUNT_NEWS, false); + showNotification.set(true); + + DontShowAgainLookup.dontShowAgain(key, true); + new Popup<>().information(Res.get(s, + Res.get("popup.accountSigning.generalInformation"))) + .show(); + } + } +}