|
37 | 37 | import bisq.core.payment.AssetAccount;
|
38 | 38 | import bisq.core.payment.PaymentAccount;
|
39 | 39 | import bisq.core.payment.payload.PaymentMethod;
|
| 40 | +import bisq.core.user.DontShowAgainLookup; |
40 | 41 | import bisq.core.util.coin.CoinFormatter;
|
41 | 42 | import bisq.core.util.validation.InputValidator;
|
42 | 43 |
|
|
67 | 68 | import javafx.util.StringConverter;
|
68 | 69 |
|
69 | 70 | import java.util.Date;
|
| 71 | +import java.util.List; |
70 | 72 | import java.util.concurrent.TimeUnit;
|
71 | 73 |
|
72 | 74 | import lombok.extern.slf4j.Slf4j;
|
@@ -118,8 +120,13 @@ public TradeCurrency fromString(String s) {
|
118 | 120 | }
|
119 | 121 | });
|
120 | 122 | currencyComboBox.setOnAction(e -> {
|
121 |
| - paymentAccount.setSingleTradeCurrency(currencyComboBox.getSelectionModel().getSelectedItem()); |
| 123 | + TradeCurrency selectedCurrency = currencyComboBox.getSelectionModel().getSelectedItem(); |
| 124 | + paymentAccount.setSingleTradeCurrency(selectedCurrency); |
122 | 125 | updateFromInputs();
|
| 126 | + |
| 127 | + if (isArgentinePesos(selectedCurrency)) { |
| 128 | + maybeShowArgentinePesosBlueRatePopup(); |
| 129 | + } |
123 | 130 | });
|
124 | 131 | }
|
125 | 132 |
|
@@ -299,19 +306,32 @@ void fillUpFlowPaneWithCurrencies(boolean isEditable, FlowPane flowPane,
|
299 | 306 | TradeCurrency e, PaymentAccount paymentAccount) {
|
300 | 307 | CheckBox checkBox = new AutoTooltipCheckBox(e.getCode());
|
301 | 308 | checkBox.setMouseTransparent(!isEditable);
|
302 |
| - checkBox.setSelected(paymentAccount.getTradeCurrencies().contains(e)); |
| 309 | + |
| 310 | + boolean isCurrencySelected = paymentAccount.getTradeCurrencies().contains(e); |
| 311 | + checkBox.setSelected(isCurrencySelected); |
| 312 | + |
303 | 313 | checkBox.setMinWidth(60);
|
304 | 314 | checkBox.setMaxWidth(checkBox.getMinWidth());
|
305 | 315 | checkBox.setTooltip(new Tooltip(e.getName()));
|
306 | 316 | checkBox.setOnAction(event -> {
|
307 |
| - if (checkBox.isSelected()) |
| 317 | + if (checkBox.isSelected()) { |
308 | 318 | paymentAccount.addCurrency(e);
|
309 |
| - else |
| 319 | + |
| 320 | + if (isArgentinePesos(e)) { |
| 321 | + maybeShowArgentinePesosBlueRatePopup(); |
| 322 | + } |
| 323 | + |
| 324 | + } else { |
310 | 325 | paymentAccount.removeCurrency(e);
|
| 326 | + } |
311 | 327 |
|
312 | 328 | updateAllInputsValid();
|
313 | 329 | });
|
314 | 330 | flowPane.getChildren().add(checkBox);
|
| 331 | + |
| 332 | + if (isCurrencySelected && isArgentinePesos(e)) { |
| 333 | + maybeShowArgentinePesosBlueRatePopup(); |
| 334 | + } |
315 | 335 | }
|
316 | 336 |
|
317 | 337 | protected abstract void autoFillNameTextField();
|
@@ -352,4 +372,22 @@ void removeAcceptedCountry(String countryCode) {
|
352 | 372 |
|
353 | 373 | void addAcceptedCountry(String countryCode) {
|
354 | 374 | }
|
| 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 | + } |
355 | 393 | }
|
0 commit comments