Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show ARS Blue Rate popup during payment account creation #7338

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import bisq.core.payment.AssetAccount;
import bisq.core.payment.PaymentAccount;
import bisq.core.payment.payload.PaymentMethod;
import bisq.core.user.DontShowAgainLookup;
import bisq.core.util.coin.CoinFormatter;
import bisq.core.util.validation.InputValidator;

Expand Down Expand Up @@ -67,6 +68,7 @@
import javafx.util.StringConverter;

import java.util.Date;
import java.util.List;
import java.util.concurrent.TimeUnit;

import lombok.extern.slf4j.Slf4j;
Expand Down Expand Up @@ -118,8 +120,13 @@ public TradeCurrency fromString(String s) {
}
});
currencyComboBox.setOnAction(e -> {
paymentAccount.setSingleTradeCurrency(currencyComboBox.getSelectionModel().getSelectedItem());
TradeCurrency selectedCurrency = currencyComboBox.getSelectionModel().getSelectedItem();
paymentAccount.setSingleTradeCurrency(selectedCurrency);
updateFromInputs();

if (isArgentinePesos(selectedCurrency)) {
maybeShowArgentinePesosBlueRatePopup();
}
});
}

Expand Down Expand Up @@ -299,19 +306,32 @@ void fillUpFlowPaneWithCurrencies(boolean isEditable, FlowPane flowPane,
TradeCurrency e, PaymentAccount paymentAccount) {
CheckBox checkBox = new AutoTooltipCheckBox(e.getCode());
checkBox.setMouseTransparent(!isEditable);
checkBox.setSelected(paymentAccount.getTradeCurrencies().contains(e));

boolean isCurrencySelected = paymentAccount.getTradeCurrencies().contains(e);
checkBox.setSelected(isCurrencySelected);

checkBox.setMinWidth(60);
checkBox.setMaxWidth(checkBox.getMinWidth());
checkBox.setTooltip(new Tooltip(e.getName()));
checkBox.setOnAction(event -> {
if (checkBox.isSelected())
if (checkBox.isSelected()) {
paymentAccount.addCurrency(e);
else

if (isArgentinePesos(e)) {
maybeShowArgentinePesosBlueRatePopup();
}

} else {
paymentAccount.removeCurrency(e);
}

updateAllInputsValid();
});
flowPane.getChildren().add(checkBox);

if (isCurrencySelected && isArgentinePesos(e)) {
maybeShowArgentinePesosBlueRatePopup();
}
}

protected abstract void autoFillNameTextField();
Expand Down Expand Up @@ -352,4 +372,22 @@ void removeAcceptedCountry(String countryCode) {

void addAcceptedCountry(String countryCode) {
}

public static boolean isArgentinePesos(TradeCurrency tradeCurrency) {
FiatCurrency arsCurrency = new FiatCurrency("ARS");
return tradeCurrency.equals(arsCurrency);
}

public static void maybeShowArgentinePesosBlueRatePopup() {
String key = "arsBlueMarketNotificationPopup";
if (DontShowAgainLookup.showAgain(key)) {
new Popup()
.headLine(Res.get("popup.arsBlueMarket.title"))
.information(Res.get("popup.arsBlueMarket.info"))
.actionButtonText(Res.get("shared.iUnderstand"))
.hideCloseButton()
.dontShowAgainId(key)
.show();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -126,19 +126,6 @@ public void onSaveNewAccount(PaymentAccount paymentAccount) {

accountAgeWitnessService.publishMyAccountAgeWitness(paymentAccount.getPaymentAccountPayload());
accountAgeWitnessService.signAndPublishSameNameAccounts();

if (paymentAccount.getSingleTradeCurrency().getCode().equals("ARS")) {
String key = "arsBlueMarketNotificationPopup";
if (DontShowAgainLookup.showAgain(key)) {
new Popup()
.headLine(Res.get("popup.arsBlueMarket.title"))
.information(Res.get("popup.arsBlueMarket.info"))
.actionButtonText(Res.get("shared.iUnderstand"))
.hideCloseButton()
.dontShowAgainId(key)
.show();
}
}
}

public void onUpdateAccount(PaymentAccount paymentAccount) {
Expand Down
11 changes: 9 additions & 2 deletions desktop/src/main/java/bisq/desktop/util/GUIUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import bisq.desktop.components.BisqTextArea;
import bisq.desktop.components.InfoAutoTooltipLabel;
import bisq.desktop.components.indicator.TxConfidenceIndicator;
import bisq.desktop.components.paymentmethods.PaymentMethodForm;
import bisq.desktop.main.MainView;
import bisq.desktop.main.account.AccountView;
import bisq.desktop.main.account.content.fiataccounts.FiatAccountsView;
Expand Down Expand Up @@ -1103,8 +1104,14 @@ public TradeCurrency fromString(String string) {
});
currencyComboBox.setDisable(true);

currencyComboBox.setOnAction(e ->
onTradeCurrencySelectedHandler.accept(currencyComboBox.getSelectionModel().getSelectedItem()));
currencyComboBox.setOnAction(e -> {
TradeCurrency selectedCurrency = currencyComboBox.getSelectionModel().getSelectedItem();
onTradeCurrencySelectedHandler.accept(selectedCurrency);

if (PaymentMethodForm.isArgentinePesos(selectedCurrency)) {
PaymentMethodForm.maybeShowArgentinePesosBlueRatePopup();
}
});

return new Tuple2<>(currencyComboBox, gridRow);
}
Expand Down
Loading