mirror of
https://github.com/bisq-network/bisq.git
synced 2025-03-01 01:32:17 +01:00
Move ARS blue rate popup code to new class
This commit is contained in:
parent
fb39babbac
commit
33eced1117
3 changed files with 37 additions and 29 deletions
|
@ -0,0 +1,28 @@
|
|||
package bisq.desktop.components.paymentmethods;
|
||||
|
||||
import bisq.desktop.main.overlays.popups.Popup;
|
||||
|
||||
import bisq.core.locale.FiatCurrency;
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.locale.TradeCurrency;
|
||||
import bisq.core.user.DontShowAgainLookup;
|
||||
|
||||
public class ArsBlueRatePopup {
|
||||
public static boolean isTradeCurrencyArgentinePesos(TradeCurrency tradeCurrency) {
|
||||
FiatCurrency arsCurrency = new FiatCurrency("ARS");
|
||||
return tradeCurrency.equals(arsCurrency);
|
||||
}
|
||||
|
||||
public static void showMaybe() {
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -37,7 +37,6 @@ import bisq.core.offer.OfferDirection;
|
|||
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;
|
||||
|
||||
|
@ -68,7 +67,6 @@ import javafx.collections.FXCollections;
|
|||
import javafx.util.StringConverter;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
@ -124,8 +122,8 @@ public abstract class PaymentMethodForm {
|
|||
paymentAccount.setSingleTradeCurrency(selectedCurrency);
|
||||
updateFromInputs();
|
||||
|
||||
if (isArgentinePesos(selectedCurrency)) {
|
||||
maybeShowArgentinePesosBlueRatePopup();
|
||||
if (ArsBlueRatePopup.isTradeCurrencyArgentinePesos(selectedCurrency)) {
|
||||
ArsBlueRatePopup.showMaybe();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -317,8 +315,8 @@ public abstract class PaymentMethodForm {
|
|||
if (checkBox.isSelected()) {
|
||||
paymentAccount.addCurrency(e);
|
||||
|
||||
if (isArgentinePesos(e)) {
|
||||
maybeShowArgentinePesosBlueRatePopup();
|
||||
if (ArsBlueRatePopup.isTradeCurrencyArgentinePesos(e)) {
|
||||
ArsBlueRatePopup.showMaybe();
|
||||
}
|
||||
|
||||
} else {
|
||||
|
@ -329,8 +327,8 @@ public abstract class PaymentMethodForm {
|
|||
});
|
||||
flowPane.getChildren().add(checkBox);
|
||||
|
||||
if (isCurrencySelected && isArgentinePesos(e)) {
|
||||
maybeShowArgentinePesosBlueRatePopup();
|
||||
if (isCurrencySelected && ArsBlueRatePopup.isTradeCurrencyArgentinePesos(e)) {
|
||||
ArsBlueRatePopup.showMaybe();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -372,22 +370,4 @@ public abstract class PaymentMethodForm {
|
|||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ import bisq.desktop.components.BisqScrollPane;
|
|||
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.components.paymentmethods.ArsBlueRatePopup;
|
||||
import bisq.desktop.main.MainView;
|
||||
import bisq.desktop.main.account.AccountView;
|
||||
import bisq.desktop.main.account.content.fiataccounts.FiatAccountsView;
|
||||
|
@ -1108,8 +1108,8 @@ public class GUIUtil {
|
|||
TradeCurrency selectedCurrency = currencyComboBox.getSelectionModel().getSelectedItem();
|
||||
onTradeCurrencySelectedHandler.accept(selectedCurrency);
|
||||
|
||||
if (PaymentMethodForm.isArgentinePesos(selectedCurrency)) {
|
||||
PaymentMethodForm.maybeShowArgentinePesosBlueRatePopup();
|
||||
if (ArsBlueRatePopup.isTradeCurrencyArgentinePesos(selectedCurrency)) {
|
||||
ArsBlueRatePopup.showMaybe();
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue