Skip to content

Commit fb39bab

Browse files
committed
Show ARS Blue Rate popup during payment account creation
At the moment, we show the ARS Blue Rate popup when the user saves a single currency payment account (PR bisq-network#7122). This misses many payment accounts that support ARS. The new behaviour is to show the ARS Blue Rate popup when ARS is selected during account generation (either pre-selected or later selected by the user). Payment accounts supporting ARS: - CashByMail - CashDeposit - F2F - MoneyGram - National bank - OKPayAccount (deprecated) - Same bank - Specific bank - Transferwise - Uphold - Western Union
1 parent f079e26 commit fb39bab

File tree

3 files changed

+51
-19
lines changed

3 files changed

+51
-19
lines changed

desktop/src/main/java/bisq/desktop/components/paymentmethods/PaymentMethodForm.java

+42-4
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import bisq.core.payment.AssetAccount;
3838
import bisq.core.payment.PaymentAccount;
3939
import bisq.core.payment.payload.PaymentMethod;
40+
import bisq.core.user.DontShowAgainLookup;
4041
import bisq.core.util.coin.CoinFormatter;
4142
import bisq.core.util.validation.InputValidator;
4243

@@ -67,6 +68,7 @@
6768
import javafx.util.StringConverter;
6869

6970
import java.util.Date;
71+
import java.util.List;
7072
import java.util.concurrent.TimeUnit;
7173

7274
import lombok.extern.slf4j.Slf4j;
@@ -118,8 +120,13 @@ public TradeCurrency fromString(String s) {
118120
}
119121
});
120122
currencyComboBox.setOnAction(e -> {
121-
paymentAccount.setSingleTradeCurrency(currencyComboBox.getSelectionModel().getSelectedItem());
123+
TradeCurrency selectedCurrency = currencyComboBox.getSelectionModel().getSelectedItem();
124+
paymentAccount.setSingleTradeCurrency(selectedCurrency);
122125
updateFromInputs();
126+
127+
if (isArgentinePesos(selectedCurrency)) {
128+
maybeShowArgentinePesosBlueRatePopup();
129+
}
123130
});
124131
}
125132

@@ -299,19 +306,32 @@ void fillUpFlowPaneWithCurrencies(boolean isEditable, FlowPane flowPane,
299306
TradeCurrency e, PaymentAccount paymentAccount) {
300307
CheckBox checkBox = new AutoTooltipCheckBox(e.getCode());
301308
checkBox.setMouseTransparent(!isEditable);
302-
checkBox.setSelected(paymentAccount.getTradeCurrencies().contains(e));
309+
310+
boolean isCurrencySelected = paymentAccount.getTradeCurrencies().contains(e);
311+
checkBox.setSelected(isCurrencySelected);
312+
303313
checkBox.setMinWidth(60);
304314
checkBox.setMaxWidth(checkBox.getMinWidth());
305315
checkBox.setTooltip(new Tooltip(e.getName()));
306316
checkBox.setOnAction(event -> {
307-
if (checkBox.isSelected())
317+
if (checkBox.isSelected()) {
308318
paymentAccount.addCurrency(e);
309-
else
319+
320+
if (isArgentinePesos(e)) {
321+
maybeShowArgentinePesosBlueRatePopup();
322+
}
323+
324+
} else {
310325
paymentAccount.removeCurrency(e);
326+
}
311327

312328
updateAllInputsValid();
313329
});
314330
flowPane.getChildren().add(checkBox);
331+
332+
if (isCurrencySelected && isArgentinePesos(e)) {
333+
maybeShowArgentinePesosBlueRatePopup();
334+
}
315335
}
316336

317337
protected abstract void autoFillNameTextField();
@@ -352,4 +372,22 @@ void removeAcceptedCountry(String countryCode) {
352372

353373
void addAcceptedCountry(String countryCode) {
354374
}
375+
376+
public static boolean isArgentinePesos(TradeCurrency tradeCurrency) {
377+
FiatCurrency arsCurrency = new FiatCurrency("ARS");
378+
return tradeCurrency.equals(arsCurrency);
379+
}
380+
381+
public static void maybeShowArgentinePesosBlueRatePopup() {
382+
String key = "arsBlueMarketNotificationPopup";
383+
if (DontShowAgainLookup.showAgain(key)) {
384+
new Popup()
385+
.headLine(Res.get("popup.arsBlueMarket.title"))
386+
.information(Res.get("popup.arsBlueMarket.info"))
387+
.actionButtonText(Res.get("shared.iUnderstand"))
388+
.hideCloseButton()
389+
.dontShowAgainId(key)
390+
.show();
391+
}
392+
}
355393
}

desktop/src/main/java/bisq/desktop/main/account/content/fiataccounts/FiatAccountsDataModel.java

-13
Original file line numberDiff line numberDiff line change
@@ -126,19 +126,6 @@ public void onSaveNewAccount(PaymentAccount paymentAccount) {
126126

127127
accountAgeWitnessService.publishMyAccountAgeWitness(paymentAccount.getPaymentAccountPayload());
128128
accountAgeWitnessService.signAndPublishSameNameAccounts();
129-
130-
if (paymentAccount.getSingleTradeCurrency().getCode().equals("ARS")) {
131-
String key = "arsBlueMarketNotificationPopup";
132-
if (DontShowAgainLookup.showAgain(key)) {
133-
new Popup()
134-
.headLine(Res.get("popup.arsBlueMarket.title"))
135-
.information(Res.get("popup.arsBlueMarket.info"))
136-
.actionButtonText(Res.get("shared.iUnderstand"))
137-
.hideCloseButton()
138-
.dontShowAgainId(key)
139-
.show();
140-
}
141-
}
142129
}
143130

144131
public void onUpdateAccount(PaymentAccount paymentAccount) {

desktop/src/main/java/bisq/desktop/util/GUIUtil.java

+9-2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import bisq.desktop.components.BisqTextArea;
2525
import bisq.desktop.components.InfoAutoTooltipLabel;
2626
import bisq.desktop.components.indicator.TxConfidenceIndicator;
27+
import bisq.desktop.components.paymentmethods.PaymentMethodForm;
2728
import bisq.desktop.main.MainView;
2829
import bisq.desktop.main.account.AccountView;
2930
import bisq.desktop.main.account.content.fiataccounts.FiatAccountsView;
@@ -1103,8 +1104,14 @@ public TradeCurrency fromString(String string) {
11031104
});
11041105
currencyComboBox.setDisable(true);
11051106

1106-
currencyComboBox.setOnAction(e ->
1107-
onTradeCurrencySelectedHandler.accept(currencyComboBox.getSelectionModel().getSelectedItem()));
1107+
currencyComboBox.setOnAction(e -> {
1108+
TradeCurrency selectedCurrency = currencyComboBox.getSelectionModel().getSelectedItem();
1109+
onTradeCurrencySelectedHandler.accept(selectedCurrency);
1110+
1111+
if (PaymentMethodForm.isArgentinePesos(selectedCurrency)) {
1112+
PaymentMethodForm.maybeShowArgentinePesosBlueRatePopup();
1113+
}
1114+
});
11081115

11091116
return new Tuple2<>(currencyComboBox, gridRow);
11101117
}

0 commit comments

Comments
 (0)