Skip to content

Commit 33eced1

Browse files
committed
Move ARS blue rate popup code to new class
1 parent fb39bab commit 33eced1

File tree

3 files changed

+37
-29
lines changed

3 files changed

+37
-29
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package bisq.desktop.components.paymentmethods;
2+
3+
import bisq.desktop.main.overlays.popups.Popup;
4+
5+
import bisq.core.locale.FiatCurrency;
6+
import bisq.core.locale.Res;
7+
import bisq.core.locale.TradeCurrency;
8+
import bisq.core.user.DontShowAgainLookup;
9+
10+
public class ArsBlueRatePopup {
11+
public static boolean isTradeCurrencyArgentinePesos(TradeCurrency tradeCurrency) {
12+
FiatCurrency arsCurrency = new FiatCurrency("ARS");
13+
return tradeCurrency.equals(arsCurrency);
14+
}
15+
16+
public static void showMaybe() {
17+
String key = "arsBlueMarketNotificationPopup";
18+
if (DontShowAgainLookup.showAgain(key)) {
19+
new Popup()
20+
.headLine(Res.get("popup.arsBlueMarket.title"))
21+
.information(Res.get("popup.arsBlueMarket.info"))
22+
.actionButtonText(Res.get("shared.iUnderstand"))
23+
.hideCloseButton()
24+
.dontShowAgainId(key)
25+
.show();
26+
}
27+
}
28+
}

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

+6-26
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
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;
4140
import bisq.core.util.coin.CoinFormatter;
4241
import bisq.core.util.validation.InputValidator;
4342

@@ -68,7 +67,6 @@
6867
import javafx.util.StringConverter;
6968

7069
import java.util.Date;
71-
import java.util.List;
7270
import java.util.concurrent.TimeUnit;
7371

7472
import lombok.extern.slf4j.Slf4j;
@@ -124,8 +122,8 @@ public TradeCurrency fromString(String s) {
124122
paymentAccount.setSingleTradeCurrency(selectedCurrency);
125123
updateFromInputs();
126124

127-
if (isArgentinePesos(selectedCurrency)) {
128-
maybeShowArgentinePesosBlueRatePopup();
125+
if (ArsBlueRatePopup.isTradeCurrencyArgentinePesos(selectedCurrency)) {
126+
ArsBlueRatePopup.showMaybe();
129127
}
130128
});
131129
}
@@ -317,8 +315,8 @@ void fillUpFlowPaneWithCurrencies(boolean isEditable, FlowPane flowPane,
317315
if (checkBox.isSelected()) {
318316
paymentAccount.addCurrency(e);
319317

320-
if (isArgentinePesos(e)) {
321-
maybeShowArgentinePesosBlueRatePopup();
318+
if (ArsBlueRatePopup.isTradeCurrencyArgentinePesos(e)) {
319+
ArsBlueRatePopup.showMaybe();
322320
}
323321

324322
} else {
@@ -329,8 +327,8 @@ void fillUpFlowPaneWithCurrencies(boolean isEditable, FlowPane flowPane,
329327
});
330328
flowPane.getChildren().add(checkBox);
331329

332-
if (isCurrencySelected && isArgentinePesos(e)) {
333-
maybeShowArgentinePesosBlueRatePopup();
330+
if (isCurrencySelected && ArsBlueRatePopup.isTradeCurrencyArgentinePesos(e)) {
331+
ArsBlueRatePopup.showMaybe();
334332
}
335333
}
336334

@@ -372,22 +370,4 @@ void removeAcceptedCountry(String countryCode) {
372370

373371
void addAcceptedCountry(String countryCode) {
374372
}
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-
}
393373
}

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +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;
27+
import bisq.desktop.components.paymentmethods.ArsBlueRatePopup;
2828
import bisq.desktop.main.MainView;
2929
import bisq.desktop.main.account.AccountView;
3030
import bisq.desktop.main.account.content.fiataccounts.FiatAccountsView;
@@ -1108,8 +1108,8 @@ public TradeCurrency fromString(String string) {
11081108
TradeCurrency selectedCurrency = currencyComboBox.getSelectionModel().getSelectedItem();
11091109
onTradeCurrencySelectedHandler.accept(selectedCurrency);
11101110

1111-
if (PaymentMethodForm.isArgentinePesos(selectedCurrency)) {
1112-
PaymentMethodForm.maybeShowArgentinePesosBlueRatePopup();
1111+
if (ArsBlueRatePopup.isTradeCurrencyArgentinePesos(selectedCurrency)) {
1112+
ArsBlueRatePopup.showMaybe();
11131113
}
11141114
});
11151115

0 commit comments

Comments
 (0)