From 5aba26ff82ac14efac68cfed98c972e9782c37ba Mon Sep 17 00:00:00 2001 From: woodser Date: Fri, 19 May 2023 14:08:53 -0400 Subject: [PATCH] refactor offer tabs to fiat, bitcoin, other (with gold and silver) --- .../java/haveno/core/locale/CurrencyUtil.java | 27 +++++++- .../core/payment/CashDepositAccount.java | 2 +- .../core/payment/NationalBankAccount.java | 2 +- .../haveno/core/payment/PaymentAccount.java | 4 ++ .../haveno/core/payment/SameBankAccount.java | 2 +- .../core/payment/SpecificBanksAccount.java | 2 +- .../haveno/core/payment/SwiftAccount.java | 4 +- .../core/payment/WesternUnionAccount.java | 2 +- .../core/payment/payload/PaymentMethod.java | 1 + .../java/haveno/core/user/Preferences.java | 10 +-- .../resources/i18n/displayStrings.properties | 13 ++-- .../i18n/displayStrings_cs.properties | 8 +-- .../i18n/displayStrings_de.properties | 8 +-- .../i18n/displayStrings_es.properties | 8 +-- .../i18n/displayStrings_fa.properties | 8 +-- .../i18n/displayStrings_fr.properties | 8 +-- .../i18n/displayStrings_it.properties | 8 +-- .../i18n/displayStrings_ja.properties | 8 +-- .../i18n/displayStrings_pt-br.properties | 8 +-- .../i18n/displayStrings_pt.properties | 8 +-- .../i18n/displayStrings_ru.properties | 8 +-- .../i18n/displayStrings_th.properties | 8 +-- .../i18n/displayStrings_vi.properties | 8 +-- .../i18n/displayStrings_zh-hans.properties | 8 +-- .../i18n/displayStrings_zh-hant.properties | 8 +-- .../main/offer/MutableOfferViewModel.java | 4 +- .../haveno/desktop/main/offer/OfferView.java | 62 +++++++++---------- .../desktop/main/offer/OfferViewUtil.java | 4 +- .../offer/createoffer/CreateOfferView.java | 9 ++- .../offerbook/OtherOfferBookViewModel.java | 26 +++++++- ...ferBookView.fxml => XmrOfferBookView.fxml} | 2 +- ...ferBookView.java => XmrOfferBookView.java} | 8 +-- ...wModel.java => XmrOfferBookViewModel.java} | 22 +++++-- .../settings/preferences/PreferencesView.java | 8 +-- .../java/haveno/desktop/util/GUIUtil.java | 4 +- .../offerbook/OfferBookViewModelTest.java | 22 +++---- 36 files changed, 204 insertions(+), 148 deletions(-) rename desktop/src/main/java/haveno/desktop/main/offer/offerbook/{BtcOfferBookView.fxml => XmrOfferBookView.fxml} (97%) rename desktop/src/main/java/haveno/desktop/main/offer/offerbook/{BtcOfferBookView.java => XmrOfferBookView.java} (90%) rename desktop/src/main/java/haveno/desktop/main/offer/offerbook/{BtcOfferBookViewModel.java => XmrOfferBookViewModel.java} (91%) diff --git a/core/src/main/java/haveno/core/locale/CurrencyUtil.java b/core/src/main/java/haveno/core/locale/CurrencyUtil.java index 0b9f7035..bde94244 100644 --- a/core/src/main/java/haveno/core/locale/CurrencyUtil.java +++ b/core/src/main/java/haveno/core/locale/CurrencyUtil.java @@ -73,6 +73,18 @@ public class CurrencyUtil { CurrencyUtil.baseCurrencyCode = baseCurrencyCode; } + public static Collection getAllSortedFiatCurrencies(Comparator comparator) { + return getAllSortedTraditionalCurrencies(comparator).stream() + .filter(currency -> CurrencyUtil.isFiatCurrency(currency.getCode())) + .collect(Collectors.toList()); // sorted by currency name + } + + public static List getAllFiatCurrencies() { + return getAllTraditionalCurrencies().stream() + .filter(currency -> CurrencyUtil.isFiatCurrency(currency.getCode())) + .collect(Collectors.toList()); // sorted by currency name + } + public static Collection getAllSortedTraditionalCurrencies() { return traditionalCurrencyMapSupplier.get().values(); // sorted by currency name } @@ -98,8 +110,7 @@ public class CurrencyUtil { .collect(Collectors.toMap(TradeCurrency::getCode, Function.identity(), (x, y) -> x, LinkedHashMap::new)); } - public static List getMainTraditionalCurrencies() { - TradeCurrency defaultTradeCurrency = getDefaultTradeCurrency(); + public static List getMainFiatCurrencies() { List list = new ArrayList<>(); list.add(new TraditionalCurrency("USD")); list.add(new TraditionalCurrency("EUR")); @@ -109,18 +120,28 @@ public class CurrencyUtil { list.add(new TraditionalCurrency("RUB")); list.add(new TraditionalCurrency("INR")); list.add(new TraditionalCurrency("NGN")); + postProcessTraditionalCurrenciesList(list); + return list; + } + + public static List getMainTraditionalCurrencies() { + List list = getMainFiatCurrencies(); list.add(new TraditionalCurrency("XAG")); list.add(new TraditionalCurrency("XAU")); + postProcessTraditionalCurrenciesList(list); + return list; + } + private static void postProcessTraditionalCurrenciesList(List list) { list.sort(TradeCurrency::compareTo); + TradeCurrency defaultTradeCurrency = getDefaultTradeCurrency(); TraditionalCurrency defaultTraditionalCurrency = defaultTradeCurrency instanceof TraditionalCurrency ? (TraditionalCurrency) defaultTradeCurrency : null; if (defaultTraditionalCurrency != null && list.contains(defaultTraditionalCurrency)) { list.remove(defaultTradeCurrency); list.add(0, defaultTraditionalCurrency); } - return list; } public static Collection getAllSortedCryptoCurrencies() { diff --git a/core/src/main/java/haveno/core/payment/CashDepositAccount.java b/core/src/main/java/haveno/core/payment/CashDepositAccount.java index 01b56926..e4d952f6 100644 --- a/core/src/main/java/haveno/core/payment/CashDepositAccount.java +++ b/core/src/main/java/haveno/core/payment/CashDepositAccount.java @@ -30,7 +30,7 @@ import java.util.List; public final class CashDepositAccount extends CountryBasedPaymentAccount implements SameCountryRestrictedBankAccount { - public static final List SUPPORTED_CURRENCIES = CurrencyUtil.getAllTraditionalCurrencies(); + public static final List SUPPORTED_CURRENCIES = CurrencyUtil.getAllFiatCurrencies(); public CashDepositAccount() { super(PaymentMethod.CASH_DEPOSIT); diff --git a/core/src/main/java/haveno/core/payment/NationalBankAccount.java b/core/src/main/java/haveno/core/payment/NationalBankAccount.java index a3558690..7a7b1ee0 100644 --- a/core/src/main/java/haveno/core/payment/NationalBankAccount.java +++ b/core/src/main/java/haveno/core/payment/NationalBankAccount.java @@ -32,7 +32,7 @@ import java.util.List; @EqualsAndHashCode(callSuper = true) public final class NationalBankAccount extends CountryBasedPaymentAccount implements SameCountryRestrictedBankAccount { - public static final List SUPPORTED_CURRENCIES = CurrencyUtil.getAllTraditionalCurrencies(); + public static final List SUPPORTED_CURRENCIES = CurrencyUtil.getAllFiatCurrencies(); public NationalBankAccount() { super(PaymentMethod.NATIONAL_BANK); diff --git a/core/src/main/java/haveno/core/payment/PaymentAccount.java b/core/src/main/java/haveno/core/payment/PaymentAccount.java index 3bd18408..e113558f 100644 --- a/core/src/main/java/haveno/core/payment/PaymentAccount.java +++ b/core/src/main/java/haveno/core/payment/PaymentAccount.java @@ -117,6 +117,10 @@ public abstract class PaymentAccount implements PersistablePayload { paymentAccountPayload = payload; } + public boolean isFiat() { + return getSingleTradeCurrency() == null || CurrencyUtil.isFiatCurrency(getSingleTradeCurrency().getCode()); // TODO: check if trade currencies contain fiat + } + /////////////////////////////////////////////////////////////////////////////////////////// // PROTO BUFFER diff --git a/core/src/main/java/haveno/core/payment/SameBankAccount.java b/core/src/main/java/haveno/core/payment/SameBankAccount.java index 10be62b3..c5d9316e 100644 --- a/core/src/main/java/haveno/core/payment/SameBankAccount.java +++ b/core/src/main/java/haveno/core/payment/SameBankAccount.java @@ -32,7 +32,7 @@ import java.util.List; @EqualsAndHashCode(callSuper = true) public final class SameBankAccount extends CountryBasedPaymentAccount implements BankNameRestrictedBankAccount, SameCountryRestrictedBankAccount { - public static final List SUPPORTED_CURRENCIES = CurrencyUtil.getAllTraditionalCurrencies(); + public static final List SUPPORTED_CURRENCIES = CurrencyUtil.getAllFiatCurrencies(); public SameBankAccount() { super(PaymentMethod.SAME_BANK); diff --git a/core/src/main/java/haveno/core/payment/SpecificBanksAccount.java b/core/src/main/java/haveno/core/payment/SpecificBanksAccount.java index dc9431e1..4f187957 100644 --- a/core/src/main/java/haveno/core/payment/SpecificBanksAccount.java +++ b/core/src/main/java/haveno/core/payment/SpecificBanksAccount.java @@ -32,7 +32,7 @@ import java.util.List; @EqualsAndHashCode(callSuper = true) public final class SpecificBanksAccount extends CountryBasedPaymentAccount implements BankNameRestrictedBankAccount, SameCountryRestrictedBankAccount { - public static final List SUPPORTED_CURRENCIES = CurrencyUtil.getAllTraditionalCurrencies(); + public static final List SUPPORTED_CURRENCIES = CurrencyUtil.getAllFiatCurrencies(); public SpecificBanksAccount() { super(PaymentMethod.SPECIFIC_BANKS); diff --git a/core/src/main/java/haveno/core/payment/SwiftAccount.java b/core/src/main/java/haveno/core/payment/SwiftAccount.java index f055cac2..2ffa7cea 100644 --- a/core/src/main/java/haveno/core/payment/SwiftAccount.java +++ b/core/src/main/java/haveno/core/payment/SwiftAccount.java @@ -18,6 +18,7 @@ package haveno.core.payment; import haveno.core.api.model.PaymentAccountFormField; +import haveno.core.locale.CurrencyUtil; import haveno.core.locale.TradeCurrency; import haveno.core.payment.payload.PaymentAccountPayload; import haveno.core.payment.payload.PaymentMethod; @@ -28,13 +29,12 @@ import lombok.NonNull; import java.util.ArrayList; import java.util.List; -import static haveno.core.locale.CurrencyUtil.getAllSortedTraditionalCurrencies; import static java.util.Comparator.comparing; @EqualsAndHashCode(callSuper = true) public final class SwiftAccount extends PaymentAccount { - public static final List SUPPORTED_CURRENCIES = new ArrayList<>(getAllSortedTraditionalCurrencies(comparing(TradeCurrency::getCode))); + public static final List SUPPORTED_CURRENCIES = new ArrayList<>(CurrencyUtil.getAllSortedFiatCurrencies(comparing(TradeCurrency::getCode))); private static final List INPUT_FIELD_IDS = List.of( PaymentAccountFormField.FieldId.ACCOUNT_NAME, diff --git a/core/src/main/java/haveno/core/payment/WesternUnionAccount.java b/core/src/main/java/haveno/core/payment/WesternUnionAccount.java index 71b03f68..e4846b62 100644 --- a/core/src/main/java/haveno/core/payment/WesternUnionAccount.java +++ b/core/src/main/java/haveno/core/payment/WesternUnionAccount.java @@ -29,7 +29,7 @@ import java.util.List; public final class WesternUnionAccount extends CountryBasedPaymentAccount { - public static final List SUPPORTED_CURRENCIES = CurrencyUtil.getAllTraditionalCurrencies(); + public static final List SUPPORTED_CURRENCIES = CurrencyUtil.getAllFiatCurrencies(); public WesternUnionAccount() { super(PaymentMethod.WESTERN_UNION); diff --git a/core/src/main/java/haveno/core/payment/payload/PaymentMethod.java b/core/src/main/java/haveno/core/payment/payload/PaymentMethod.java index 503ff4ca..e9fcc5d2 100644 --- a/core/src/main/java/haveno/core/payment/payload/PaymentMethod.java +++ b/core/src/main/java/haveno/core/payment/payload/PaymentMethod.java @@ -387,6 +387,7 @@ public final class PaymentMethod implements PersistablePayload, Comparable supportedAssetCodes; diff --git a/core/src/main/java/haveno/core/user/Preferences.java b/core/src/main/java/haveno/core/user/Preferences.java index 41915ac9..8e972fe2 100644 --- a/core/src/main/java/haveno/core/user/Preferences.java +++ b/core/src/main/java/haveno/core/user/Preferences.java @@ -225,7 +225,7 @@ public final class Preferences implements PersistedDataHost, BridgeAddressProvid GlobalSettings.setUseAnimations(prefPayload.isUseAnimations()); TradeCurrency preferredTradeCurrency = checkNotNull(prefPayload.getPreferredTradeCurrency(), "preferredTradeCurrency must not be null"); setPreferredTradeCurrency(preferredTradeCurrency); - setFiatCurrencies(prefPayload.getTraditionalCurrencies()); + setTraditionalCurrencies(prefPayload.getTraditionalCurrencies()); setCryptoCurrencies(prefPayload.getCryptoCurrencies()); GlobalSettings.setDefaultTradeCurrency(preferredTradeCurrency); @@ -255,7 +255,7 @@ public final class Preferences implements PersistedDataHost, BridgeAddressProvid } prefPayload.setPreferredTradeCurrency(preferredTradeCurrency); - setFiatCurrencies(CurrencyUtil.getMainTraditionalCurrencies()); + setTraditionalCurrencies(CurrencyUtil.getMainFiatCurrencies()); setCryptoCurrencies(CurrencyUtil.getMainCryptoCurrencies()); BaseCurrencyNetwork baseCurrencyNetwork = Config.baseCurrencyNetwork(); @@ -608,9 +608,9 @@ public final class Preferences implements PersistedDataHost, BridgeAddressProvid requestPersistence(); } - private void setFiatCurrencies(List currencies) { + public void setTraditionalCurrencies(List currencies) { traditionalCurrenciesAsObservable.setAll(currencies.stream() - .map(fiatCurrency -> new TraditionalCurrency(fiatCurrency.getCurrency())) + .map(traditionalCurrency -> new TraditionalCurrency(traditionalCurrency.getCurrency())) .distinct().collect(Collectors.toList())); requestPersistence(); } @@ -909,7 +909,7 @@ public final class Preferences implements PersistedDataHost, BridgeAddressProvid void setPayFeeInXmr(boolean payFeeInXmr); - void setFiatCurrencies(List currencies); + void setTraditionalCurrencies(List currencies); void setCryptoCurrencies(List currencies); diff --git a/core/src/main/resources/i18n/displayStrings.properties b/core/src/main/resources/i18n/displayStrings.properties index 368ae779..8f8924e5 100644 --- a/core/src/main/resources/i18n/displayStrings.properties +++ b/core/src/main/resources/i18n/displayStrings.properties @@ -200,8 +200,9 @@ shared.makerTxFee=Maker: {0} shared.takerTxFee=Taker: {0} shared.iConfirm=I confirm shared.openURL=Open {0} -shared.traditional=Traditional +shared.fiat=Fiat shared.crypto=Crypto +shared.traditional=Traditional shared.otherAssets=other assets shared.other=Other shared.all=All @@ -1243,12 +1244,12 @@ setting.preferences.ignorePeers=Ignored peers [onion address:port] setting.preferences.ignoreDustThreshold=Min. non-dust output value setting.preferences.currenciesInList=Currencies in market price feed list setting.preferences.prefCurrency=Preferred currency -setting.preferences.displayFiat=Display national currencies -setting.preferences.noFiat=There are no national currencies selected +setting.preferences.displayTraditional=Display traditional currencies +setting.preferences.noTraditional=There are no traditional currencies selected setting.preferences.cannotRemovePrefCurrency=You cannot remove your selected preferred display currency -setting.preferences.displayCryptos=Display cryptos +setting.preferences.displayCryptos=Display cryptose setting.preferences.noCryptos=There are no cryptos selected -setting.preferences.addFiat=Add national currency +setting.preferences.addTraditional=Add traditional currency setting.preferences.addCrypto=Add cryptocurrency setting.preferences.displayOptions=Display options setting.preferences.showOwnOffers=Show my own offers in offer book @@ -1402,7 +1403,7 @@ account.tab.mediatorRegistration=Mediator registration account.tab.refundAgentRegistration=Refund agent registration account.tab.signing=Signing -account.menu.paymentAccount=National currency accounts +account.menu.paymentAccount=Traditional currency accounts account.menu.altCoinsAccountView=Cryptocurrency accounts account.menu.password=Wallet password account.menu.seedWords=Wallet seed diff --git a/core/src/main/resources/i18n/displayStrings_cs.properties b/core/src/main/resources/i18n/displayStrings_cs.properties index 48d619cc..3300a2d1 100644 --- a/core/src/main/resources/i18n/displayStrings_cs.properties +++ b/core/src/main/resources/i18n/displayStrings_cs.properties @@ -190,7 +190,7 @@ shared.makerTxFee=Tvůrce: {0} shared.takerTxFee=Příjemce: {0} shared.iConfirm=Potvrzuji shared.openURL=Otevřené {0} -shared.traditional=Traditional +shared.fiat=Fiat shared.crypto=Krypto shared.all=Vše shared.edit=Upravit @@ -995,12 +995,12 @@ setting.preferences.ignorePeers=Ignorované peer uzly [onion addresa:port] setting.preferences.ignoreDustThreshold=Min. hodnota výstupu bez drobných setting.preferences.currenciesInList=Měny v seznamu zdrojů tržních cen setting.preferences.prefCurrency=Preferovaná měna -setting.preferences.displayFiat=Zobrazit národní měny -setting.preferences.noFiat=Nejsou vybrány žádné národní měny +setting.preferences.displayTraditional=Zobrazit národní měny +setting.preferences.noTraditional=Nejsou vybrány žádné národní měny setting.preferences.cannotRemovePrefCurrency=Vybranou zobrazovanou měnu nelze odebrat. setting.preferences.displayCryptos=Zobrazit cryptoy setting.preferences.noCryptos=Nejsou vybrány žádné cryptoy -setting.preferences.addFiat=Přidejte národní měnu +setting.preferences.addTraditional=Přidejte národní měnu setting.preferences.addCrypto=Přidejte crypto setting.preferences.displayOptions=Zobrazit možnosti setting.preferences.showOwnOffers=Zobrazit mé vlastní nabídky v seznamu nabídek diff --git a/core/src/main/resources/i18n/displayStrings_de.properties b/core/src/main/resources/i18n/displayStrings_de.properties index d74a48e0..e0a76d70 100644 --- a/core/src/main/resources/i18n/displayStrings_de.properties +++ b/core/src/main/resources/i18n/displayStrings_de.properties @@ -190,7 +190,7 @@ shared.makerTxFee=Ersteller: {0} shared.takerTxFee=Abnehmer: {0} shared.iConfirm=Ich bestätige shared.openURL=Öffne {0} -shared.traditional=Traditional +shared.fiat=Fiat shared.crypto=Crypto shared.all=Alle shared.edit=Bearbeiten @@ -995,12 +995,12 @@ setting.preferences.ignorePeers=Ignorierte Peers [Onion Adresse:Port] setting.preferences.ignoreDustThreshold=Min. nicht-dust Ausgabewert setting.preferences.currenciesInList=Währungen in Liste der Marktpreise setting.preferences.prefCurrency=Bevorzugte Währung -setting.preferences.displayFiat=Nationale Währungen anzeigen -setting.preferences.noFiat=Es wurden keine nationalen Währungen ausgewählt +setting.preferences.displayTraditional=Nationale Währungen anzeigen +setting.preferences.noTraditional=Es wurden keine nationalen Währungen ausgewählt setting.preferences.cannotRemovePrefCurrency=Sie können Ihre ausgewählte bevorzugte Anzeigewährung nicht entfernen setting.preferences.displayCryptos=Cryptos anzeigen setting.preferences.noCryptos=Es sind keine Cryptos ausgewählt -setting.preferences.addFiat=Nationale Währung hinzufügen +setting.preferences.addTraditional=Nationale Währung hinzufügen setting.preferences.addCrypto=Crypto hinzufügen setting.preferences.displayOptions=Darstellungsoptionen setting.preferences.showOwnOffers=Eigenen Angebote im Angebotsbuch zeigen diff --git a/core/src/main/resources/i18n/displayStrings_es.properties b/core/src/main/resources/i18n/displayStrings_es.properties index a9ae66a9..508b2401 100644 --- a/core/src/main/resources/i18n/displayStrings_es.properties +++ b/core/src/main/resources/i18n/displayStrings_es.properties @@ -190,7 +190,7 @@ shared.makerTxFee=Creador: {0} shared.takerTxFee=Tomador: {0} shared.iConfirm=Confirmo shared.openURL=Abrir {0} -shared.traditional=Traditional +shared.fiat=Fiat shared.crypto=Cripto shared.all=Todos shared.edit=Editar @@ -995,12 +995,12 @@ setting.preferences.ignorePeers=Pares ignorados [dirección onion:puerto] setting.preferences.ignoreDustThreshold=Valor mínimo de output que no sea dust setting.preferences.currenciesInList=Monedas en lista para precio de mercado setting.preferences.prefCurrency=Moneda preferida -setting.preferences.displayFiat=Mostrar monedas nacionales -setting.preferences.noFiat=No hay monedas nacionales seleccionadas +setting.preferences.displayTraditional=Mostrar monedas nacionales +setting.preferences.noTraditional=No hay monedas nacionales seleccionadas setting.preferences.cannotRemovePrefCurrency=No puede eliminar su moneda preferida para mostrar seleccionada setting.preferences.displayCryptos=Mostrar cryptos setting.preferences.noCryptos=No hay cryptos seleccionadas -setting.preferences.addFiat=Añadir moneda nacional +setting.preferences.addTraditional=Añadir moneda nacional setting.preferences.addCrypto=Añadir crypto setting.preferences.displayOptions=Mostrar opciones setting.preferences.showOwnOffers=Mostrar mis propias ofertas en el libro de ofertas diff --git a/core/src/main/resources/i18n/displayStrings_fa.properties b/core/src/main/resources/i18n/displayStrings_fa.properties index 61a50fe9..6c82f263 100644 --- a/core/src/main/resources/i18n/displayStrings_fa.properties +++ b/core/src/main/resources/i18n/displayStrings_fa.properties @@ -190,7 +190,7 @@ shared.makerTxFee=سفارش گذار: {0} shared.takerTxFee=پذیرنده سفارش: {0} shared.iConfirm=تایید می‌کنم shared.openURL=باز {0} -shared.traditional=فیات +shared.fiat=فیات shared.crypto=کریپتو shared.all=همه shared.edit=ویرایش @@ -995,12 +995,12 @@ setting.preferences.ignorePeers=Ignored peers [onion address:port] setting.preferences.ignoreDustThreshold=Min. non-dust output value setting.preferences.currenciesInList=ارزها در لیست قیمت روز بازار setting.preferences.prefCurrency=ارز مطلوب -setting.preferences.displayFiat=نمایش ارزهای ملی -setting.preferences.noFiat=هیچ ارز ملی انتخاب نشده است +setting.preferences.displayTraditional=نمایش ارزهای ملی +setting.preferences.noTraditional=هیچ ارز ملی انتخاب نشده است setting.preferences.cannotRemovePrefCurrency=شما نمی‌توانید ارز مطلوب انتخاب شده‌ی خود را حذف کنید setting.preferences.displayCryptos=نمایش آلت‌کوین‌ها setting.preferences.noCryptos=هیچ آلتکوینی انتخاب نشده است -setting.preferences.addFiat=افزودن ارز ملی +setting.preferences.addTraditional=افزودن ارز ملی setting.preferences.addCrypto=افزودن آلتکوین setting.preferences.displayOptions=نمایش گزینه‌ها setting.preferences.showOwnOffers=نمایش پیشنهادهای من در دفتر پیشنهاد diff --git a/core/src/main/resources/i18n/displayStrings_fr.properties b/core/src/main/resources/i18n/displayStrings_fr.properties index 2ead7a53..ad0282f3 100644 --- a/core/src/main/resources/i18n/displayStrings_fr.properties +++ b/core/src/main/resources/i18n/displayStrings_fr.properties @@ -190,7 +190,7 @@ shared.makerTxFee=Maker: {0} shared.takerTxFee=Taker: {0} shared.iConfirm=Je confirme shared.openURL=Ouvert {0} -shared.traditional=Traditional +shared.fiat=Fiat shared.crypto=Crypto shared.all=Tout shared.edit=Modifier @@ -996,12 +996,12 @@ setting.preferences.ignorePeers=Pairs ignorés [adresse onion:port] setting.preferences.ignoreDustThreshold=Valeur de l'output considérée comme "non-dust" minimale setting.preferences.currenciesInList=Devises disponibles dans le flux de cotation du marché setting.preferences.prefCurrency=Devise privilégiée -setting.preferences.displayFiat=Afficher les monnaies nationales -setting.preferences.noFiat=Il n'y a pas de devise nationale sélectionnée +setting.preferences.displayTraditional=Afficher les monnaies nationales +setting.preferences.noTraditional=Il n'y a pas de devise nationale sélectionnée setting.preferences.cannotRemovePrefCurrency=Vous ne pouvez pas enlever la devise choisie pour l'affichage. setting.preferences.displayCryptos=Afficher les cryptos setting.preferences.noCryptos=Il n'y a pas d'cryptos sélectionnés -setting.preferences.addFiat=Ajouter une devise nationale +setting.preferences.addTraditional=Ajouter une devise nationale setting.preferences.addCrypto=Ajouter un crypto setting.preferences.displayOptions=Afficher les options setting.preferences.showOwnOffers=Montrer mes ordres dans le livre des ordres diff --git a/core/src/main/resources/i18n/displayStrings_it.properties b/core/src/main/resources/i18n/displayStrings_it.properties index 74f801ee..7b9c871b 100644 --- a/core/src/main/resources/i18n/displayStrings_it.properties +++ b/core/src/main/resources/i18n/displayStrings_it.properties @@ -190,7 +190,7 @@ shared.makerTxFee=Maker: {0} shared.takerTxFee=Taker: {0} shared.iConfirm=Confermo shared.openURL=Aperti {0} -shared.traditional=Traditional +shared.fiat=Fiat shared.crypto=Crypto shared.all=Tutti shared.edit=Modifica @@ -995,12 +995,12 @@ setting.preferences.ignorePeers=Peer ignorati [indirizzo:porta onion] setting.preferences.ignoreDustThreshold=Valore minimo di output non-dust setting.preferences.currenciesInList=Valute nell'elenco dei feed dei prezzi di mercato setting.preferences.prefCurrency=Valuta preferita -setting.preferences.displayFiat=Mostra valute nazionali -setting.preferences.noFiat=Non ci sono valute nazionali selezionate +setting.preferences.displayTraditional=Mostra valute nazionali +setting.preferences.noTraditional=Non ci sono valute nazionali selezionate setting.preferences.cannotRemovePrefCurrency=Non è possibile rimuovere la valuta di visualizzazione preferita selezionata setting.preferences.displayCryptos=Visualizza crypto setting.preferences.noCryptos=Non ci sono crypto selezionate -setting.preferences.addFiat=Aggiungi valuta nazionale +setting.preferences.addTraditional=Aggiungi valuta nazionale setting.preferences.addCrypto=Aggiungi crypto setting.preferences.displayOptions=Mostra opzioni setting.preferences.showOwnOffers=Mostra le mie offerte nel libro delle offerte diff --git a/core/src/main/resources/i18n/displayStrings_ja.properties b/core/src/main/resources/i18n/displayStrings_ja.properties index 6067b842..2aa704ed 100644 --- a/core/src/main/resources/i18n/displayStrings_ja.properties +++ b/core/src/main/resources/i18n/displayStrings_ja.properties @@ -190,7 +190,7 @@ shared.makerTxFee=メイカー: {0} shared.takerTxFee=テイカー: {0} shared.iConfirm=確認します shared.openURL={0} をオープン -shared.traditional=法定通貨 +shared.fiat=法定通貨 shared.crypto=暗号通貨 shared.all=全て shared.edit=編集 @@ -995,12 +995,12 @@ setting.preferences.ignorePeers=無視されたピア [onion アドレス:ポー setting.preferences.ignoreDustThreshold=最小の非ダストアウトプット値 setting.preferences.currenciesInList=市場価格フィードリストの通貨 setting.preferences.prefCurrency=希望する通貨 -setting.preferences.displayFiat=各国通貨の表示 -setting.preferences.noFiat=各国通貨が選択されていません +setting.preferences.displayTraditional=各国通貨の表示 +setting.preferences.noTraditional=各国通貨が選択されていません setting.preferences.cannotRemovePrefCurrency=選択した希望の表示通貨は削除できません setting.preferences.displayCryptos=アルトコインの表示 setting.preferences.noCryptos=選択されたアルトコインがありません -setting.preferences.addFiat=各国通貨を追加する +setting.preferences.addTraditional=各国通貨を追加する setting.preferences.addCrypto=アルトコインを追加する setting.preferences.displayOptions=表示設定 setting.preferences.showOwnOffers=オファーブックに自分のオファーを表示 diff --git a/core/src/main/resources/i18n/displayStrings_pt-br.properties b/core/src/main/resources/i18n/displayStrings_pt-br.properties index 4ca81632..9e614732 100644 --- a/core/src/main/resources/i18n/displayStrings_pt-br.properties +++ b/core/src/main/resources/i18n/displayStrings_pt-br.properties @@ -190,7 +190,7 @@ shared.makerTxFee=Ofertante: {0} shared.takerTxFee=Aceitador: {0} shared.iConfirm=Eu confirmo shared.openURL=Aberto {0} -shared.traditional=Traditional +shared.fiat=Fiat shared.crypto=Cripto shared.all=Todos shared.edit=Editar @@ -998,12 +998,12 @@ setting.preferences.ignorePeers=Pares ignorados [endereço onion:porta] setting.preferences.ignoreDustThreshold=Mín. valor de output não-poeira setting.preferences.currenciesInList=Moedas na lista de preços de mercado setting.preferences.prefCurrency=Moeda de preferência -setting.preferences.displayFiat=Exibir moedas nacionais -setting.preferences.noFiat=Não há moedas nacionais selecionadas +setting.preferences.displayTraditional=Exibir moedas nacionais +setting.preferences.noTraditional=Não há moedas nacionais selecionadas setting.preferences.cannotRemovePrefCurrency=Você não pode remover a moeda preferencial de exibição selecionada setting.preferences.displayCryptos=Exibir cryptos setting.preferences.noCryptos=Não há cryptos selecionadas -setting.preferences.addFiat=Adicionar moeda nacional +setting.preferences.addTraditional=Adicionar moeda nacional setting.preferences.addCrypto=Adicionar crypto setting.preferences.displayOptions=Opções de exibição setting.preferences.showOwnOffers=Exibir minhas ofertas no livro de ofertas diff --git a/core/src/main/resources/i18n/displayStrings_pt.properties b/core/src/main/resources/i18n/displayStrings_pt.properties index 1bc42912..0eafd010 100644 --- a/core/src/main/resources/i18n/displayStrings_pt.properties +++ b/core/src/main/resources/i18n/displayStrings_pt.properties @@ -190,7 +190,7 @@ shared.makerTxFee=Ofertante: {0} shared.takerTxFee=Aceitador: {0} shared.iConfirm=Eu confirmo shared.openURL=Abrir {0} -shared.traditional=Moeda fiduciária +shared.fiat=Moeda fiduciária shared.crypto=Cripto shared.all=Tudo shared.edit=Editar @@ -995,12 +995,12 @@ setting.preferences.ignorePeers=Pares ignorados [endereço onion:porta] setting.preferences.ignoreDustThreshold=Mín. valor de output não-poeira setting.preferences.currenciesInList=Moedas na lista de feed de preço de mercado setting.preferences.prefCurrency=Moeda preferrida -setting.preferences.displayFiat=Mostrar moedas nacionais -setting.preferences.noFiat=Não há moedas nacionais selecionadas +setting.preferences.displayTraditional=Mostrar moedas nacionais +setting.preferences.noTraditional=Não há moedas nacionais selecionadas setting.preferences.cannotRemovePrefCurrency=Você não pode remover a moeda preferida de exibição selecionada setting.preferences.displayCryptos=Mostrar cryptos setting.preferences.noCryptos=Não há cryptos selecionadas -setting.preferences.addFiat=Adicionar moeda nacional +setting.preferences.addTraditional=Adicionar moeda nacional setting.preferences.addCrypto=Adicionar crypto setting.preferences.displayOptions=Mostrar opções setting.preferences.showOwnOffers=Mostrar as minhas próprias ofertas no livro de ofertas diff --git a/core/src/main/resources/i18n/displayStrings_ru.properties b/core/src/main/resources/i18n/displayStrings_ru.properties index aef70bbd..446c8917 100644 --- a/core/src/main/resources/i18n/displayStrings_ru.properties +++ b/core/src/main/resources/i18n/displayStrings_ru.properties @@ -190,7 +190,7 @@ shared.makerTxFee=Мейкер: {0} shared.takerTxFee=Тейкер: {0} shared.iConfirm=Подтверждаю shared.openURL=Открыть {0} -shared.traditional=Нац. валюта +shared.fiat=Нац. валюта shared.crypto=Криптовалюта shared.all=Все shared.edit=Редактировать @@ -995,12 +995,12 @@ setting.preferences.ignorePeers=Игнорируемые пиры [onion-адр setting.preferences.ignoreDustThreshold=Мин. значение, не являющееся «пылью» setting.preferences.currenciesInList=Валюты в перечне источника рыночного курса setting.preferences.prefCurrency=Предпочитаемая валюта -setting.preferences.displayFiat=Показать нац. валюты -setting.preferences.noFiat=Национальные валюты не выбраны +setting.preferences.displayTraditional=Показать нац. валюты +setting.preferences.noTraditional=Национальные валюты не выбраны setting.preferences.cannotRemovePrefCurrency=Нельзя удалить выбранную предпочитаемую валюту setting.preferences.displayCryptos=Показать альткойны setting.preferences.noCryptos=Альткойны не выбраны -setting.preferences.addFiat=Добавить национальную валюту +setting.preferences.addTraditional=Добавить национальную валюту setting.preferences.addCrypto=Добавить альткойн setting.preferences.displayOptions=Параметры отображения setting.preferences.showOwnOffers=Показать мои предложения в списке предложений diff --git a/core/src/main/resources/i18n/displayStrings_th.properties b/core/src/main/resources/i18n/displayStrings_th.properties index fe37eeab..8f49b80b 100644 --- a/core/src/main/resources/i18n/displayStrings_th.properties +++ b/core/src/main/resources/i18n/displayStrings_th.properties @@ -190,7 +190,7 @@ shared.makerTxFee=ผู้ทำ: {0} shared.takerTxFee=ผู้รับ: {0} shared.iConfirm=ฉันยืนยัน shared.openURL=เปิด {0} -shared.traditional=คำสั่ง +shared.fiat=คำสั่ง shared.crypto=คริปโต shared.all=ทั้งหมด shared.edit=แก้ไข @@ -995,12 +995,12 @@ setting.preferences.ignorePeers=Ignored peers [onion address:port] setting.preferences.ignoreDustThreshold=Min. non-dust output value setting.preferences.currenciesInList=สกุลเงินอยู่ในหน้ารายการราคาตลาด setting.preferences.prefCurrency=สกุลเงินที่ต้องการ -setting.preferences.displayFiat=แสดงสกุลเงินของประเทศ -setting.preferences.noFiat=ไม่มีสกุลเงินประจำชาติที่เลือกไว้ +setting.preferences.displayTraditional=แสดงสกุลเงินของประเทศ +setting.preferences.noTraditional=ไม่มีสกุลเงินประจำชาติที่เลือกไว้ setting.preferences.cannotRemovePrefCurrency=คุณไม่สามารถลบสกุลเงินในการแสดงผลที่เลือกไว้ได้ setting.preferences.displayCryptos=แสดง cryptos setting.preferences.noCryptos=ไม่มี cryptos ที่เลือก -setting.preferences.addFiat=เพิ่มสกุลเงินประจำชาติ +setting.preferences.addTraditional=เพิ่มสกุลเงินประจำชาติ setting.preferences.addCrypto=เพิ่ม crypto setting.preferences.displayOptions=แสดงตัวเลือกเพิ่มเติม setting.preferences.showOwnOffers=แสดงข้อเสนอของฉันเองในสมุดข้อเสนอ diff --git a/core/src/main/resources/i18n/displayStrings_vi.properties b/core/src/main/resources/i18n/displayStrings_vi.properties index ef23255c..ee222914 100644 --- a/core/src/main/resources/i18n/displayStrings_vi.properties +++ b/core/src/main/resources/i18n/displayStrings_vi.properties @@ -190,7 +190,7 @@ shared.makerTxFee=Người tạo: {0} shared.takerTxFee=Người nhận: {0} shared.iConfirm=Tôi xác nhận shared.openURL=Mở {0} -shared.traditional=Tiền pháp định +shared.fiat=Tiền pháp định shared.crypto=Tiền mã hóa shared.all=Tất cả shared.edit=Chỉnh sửa @@ -997,12 +997,12 @@ setting.preferences.ignorePeers=Bỏ qua đối tác[địa chỉ onion:cổng] setting.preferences.ignoreDustThreshold=Giá trị đầu ra tối thiểu không phải số dư nhỏ setting.preferences.currenciesInList=Tiền tệ trong danh sách cung cấp giá thị trường setting.preferences.prefCurrency=Tiền tệ ưu tiên -setting.preferences.displayFiat=Hiển thị tiền tệ các nước -setting.preferences.noFiat=Không có tiền tệ nước nào được chọn +setting.preferences.displayTraditional=Hiển thị tiền tệ các nước +setting.preferences.noTraditional=Không có tiền tệ nước nào được chọn setting.preferences.cannotRemovePrefCurrency=Bạn không thể gỡ bỏ tiền tệ ưu tiên được chọn setting.preferences.displayCryptos=Hiển thị crypto setting.preferences.noCryptos=Không có crypto nào được chọn -setting.preferences.addFiat=Bổ sung tiền tệ các nước +setting.preferences.addTraditional=Bổ sung tiền tệ các nước setting.preferences.addCrypto=Bổ sung crypto setting.preferences.displayOptions=Hiển thị các phương án setting.preferences.showOwnOffers=Hiển thị Báo giá của tôi trong danh mục Báo giá diff --git a/core/src/main/resources/i18n/displayStrings_zh-hans.properties b/core/src/main/resources/i18n/displayStrings_zh-hans.properties index 4638e35d..549342e9 100644 --- a/core/src/main/resources/i18n/displayStrings_zh-hans.properties +++ b/core/src/main/resources/i18n/displayStrings_zh-hans.properties @@ -190,7 +190,7 @@ shared.makerTxFee=卖家:{0} shared.takerTxFee=买家:{0} shared.iConfirm=我确认 shared.openURL=打开 {0} -shared.traditional=法定货币 +shared.fiat=法定货币 shared.crypto=加密 shared.all=全部 shared.edit=编辑 @@ -995,12 +995,12 @@ setting.preferences.ignorePeers=忽略节点 [洋葱地址:端口] setting.preferences.ignoreDustThreshold=最小无零头输出值 setting.preferences.currenciesInList=市场价的货币列表 setting.preferences.prefCurrency=首选货币 -setting.preferences.displayFiat=显示国家货币 -setting.preferences.noFiat=没有选定国家货币 +setting.preferences.displayTraditional=显示国家货币 +setting.preferences.noTraditional=没有选定国家货币 setting.preferences.cannotRemovePrefCurrency=您不能删除您选定的首选货币 setting.preferences.displayCryptos=显示数字货币 setting.preferences.noCryptos=没有选定数字货币 -setting.preferences.addFiat=添加法定货币 +setting.preferences.addTraditional=添加法定货币 setting.preferences.addCrypto=添加数字货币 setting.preferences.displayOptions=显示选项 setting.preferences.showOwnOffers=在报价列表中显示我的报价 diff --git a/core/src/main/resources/i18n/displayStrings_zh-hant.properties b/core/src/main/resources/i18n/displayStrings_zh-hant.properties index e6875b94..94298717 100644 --- a/core/src/main/resources/i18n/displayStrings_zh-hant.properties +++ b/core/src/main/resources/i18n/displayStrings_zh-hant.properties @@ -190,7 +190,7 @@ shared.makerTxFee=賣家:{0} shared.takerTxFee=買家:{0} shared.iConfirm=我確認 shared.openURL=打開 {0} -shared.traditional=法定貨幣 +shared.fiat=法定貨幣 shared.crypto=加密 shared.all=全部 shared.edit=編輯 @@ -995,12 +995,12 @@ setting.preferences.ignorePeers=忽略節點 [洋葱地址:端口] setting.preferences.ignoreDustThreshold=最小無零頭輸出值 setting.preferences.currenciesInList=市場價的貨幣列表 setting.preferences.prefCurrency=首選貨幣 -setting.preferences.displayFiat=顯示國家貨幣 -setting.preferences.noFiat=沒有選定國家貨幣 +setting.preferences.displayTraditional=顯示國家貨幣 +setting.preferences.noTraditional=沒有選定國家貨幣 setting.preferences.cannotRemovePrefCurrency=您不能刪除您選定的首選貨幣 setting.preferences.displayCryptos=顯示數字貨幣 setting.preferences.noCryptos=沒有選定數字貨幣 -setting.preferences.addFiat=添加法定貨幣 +setting.preferences.addTraditional=添加法定貨幣 setting.preferences.addCrypto=添加數字貨幣 setting.preferences.displayOptions=顯示選項 setting.preferences.showOwnOffers=在報價列表中顯示我的報價 diff --git a/desktop/src/main/java/haveno/desktop/main/offer/MutableOfferViewModel.java b/desktop/src/main/java/haveno/desktop/main/offer/MutableOfferViewModel.java index f01212cb..0dcd648c 100644 --- a/desktop/src/main/java/haveno/desktop/main/offer/MutableOfferViewModel.java +++ b/desktop/src/main/java/haveno/desktop/main/offer/MutableOfferViewModel.java @@ -574,9 +574,9 @@ public abstract class MutableOfferViewModel ext final boolean isBuy = dataModel.getDirection() == OfferDirection.BUY; - boolean isFiatCurrency = CurrencyUtil.isTraditionalCurrency(tradeCurrency.getCode()); + boolean isTraditionalCurrency = CurrencyUtil.isTraditionalCurrency(tradeCurrency.getCode()); - if (isFiatCurrency) { + if (isTraditionalCurrency) { amountDescription = Res.get("createOffer.amountPriceBox.amountDescription", isBuy ? Res.get("shared.buy") : Res.get("shared.sell")); } else { diff --git a/desktop/src/main/java/haveno/desktop/main/offer/OfferView.java b/desktop/src/main/java/haveno/desktop/main/offer/OfferView.java index a3a154e2..1e5b8a47 100644 --- a/desktop/src/main/java/haveno/desktop/main/offer/OfferView.java +++ b/desktop/src/main/java/haveno/desktop/main/offer/OfferView.java @@ -33,7 +33,7 @@ import haveno.desktop.common.view.View; import haveno.desktop.common.view.ViewLoader; import haveno.desktop.main.MainView; import haveno.desktop.main.offer.createoffer.CreateOfferView; -import haveno.desktop.main.offer.offerbook.BtcOfferBookView; +import haveno.desktop.main.offer.offerbook.XmrOfferBookView; import haveno.desktop.main.offer.offerbook.OfferBookView; import haveno.desktop.main.offer.offerbook.OtherOfferBookView; import haveno.desktop.main.offer.offerbook.TopCryptoOfferBookView; @@ -50,9 +50,9 @@ import java.util.Optional; public abstract class OfferView extends ActivatableView { - private OfferBookView btcOfferBookView, topCryptoOfferBookView, otherOfferBookView; + private OfferBookView xmrOfferBookView, topCryptoOfferBookView, otherOfferBookView; - private Tab btcOfferBookTab, topCryptoOfferBookTab, otherOfferBookTab; + private Tab xmrOfferBookTab, topCryptoOfferBookTab, otherOfferBookTab; private final ViewLoader viewLoader; private final Navigation navigation; @@ -95,11 +95,11 @@ public abstract class OfferView extends ActivatableView { tabChangeListener = (observableValue, oldValue, newValue) -> { UserThread.execute(() -> { if (newValue != null) { - if (newValue.equals(btcOfferBookTab)) { - if (btcOfferBookView != null) { - btcOfferBookView.onTabSelected(true); + if (newValue.equals(xmrOfferBookTab)) { + if (xmrOfferBookView != null) { + xmrOfferBookView.onTabSelected(true); } else { - loadView(BtcOfferBookView.class, null, null); + loadView(XmrOfferBookView.class, null, null); } } else if (newValue.equals(topCryptoOfferBookTab)) { if (topCryptoOfferBookView != null) { @@ -116,8 +116,8 @@ public abstract class OfferView extends ActivatableView { } } if (oldValue != null) { - if (oldValue.equals(btcOfferBookTab) && btcOfferBookView != null) { - btcOfferBookView.onTabSelected(false); + if (oldValue.equals(xmrOfferBookTab) && xmrOfferBookView != null) { + xmrOfferBookView.onTabSelected(false); } else if (oldValue.equals(topCryptoOfferBookTab) && topCryptoOfferBookView != null) { topCryptoOfferBookView.onTabSelected(false); } else if (oldValue.equals(otherOfferBookTab) && otherOfferBookView != null) { @@ -154,14 +154,14 @@ public abstract class OfferView extends ActivatableView { root.getSelectionModel().selectedItemProperty().addListener(tabChangeListener); navigation.addListener(navigationListener); - if (btcOfferBookView == null) { - navigation.navigateTo(MainView.class, this.getClass(), BtcOfferBookView.class); + if (xmrOfferBookView == null) { + navigation.navigateTo(MainView.class, this.getClass(), XmrOfferBookView.class); } GUIUtil.updateTopCrypto(preferences); if (topCryptoOfferBookTab != null) { - topCryptoOfferBookTab.setText(GUIUtil.TOP_CRYPTO.getCode()); + topCryptoOfferBookTab.setText(GUIUtil.TOP_CRYPTO.getName().toUpperCase()); } } @@ -179,15 +179,15 @@ public abstract class OfferView extends ActivatableView { if (OfferBookView.class.isAssignableFrom(viewClass)) { - if (viewClass == BtcOfferBookView.class && btcOfferBookTab != null && btcOfferBookView != null) { + if (viewClass == XmrOfferBookView.class && xmrOfferBookTab != null && xmrOfferBookView != null) { if (childViewClass == null) { - btcOfferBookTab.setContent(btcOfferBookView.getRoot()); + xmrOfferBookTab.setContent(xmrOfferBookView.getRoot()); } else if (childViewClass == TakeOfferView.class) { - loadTakeViewClass(viewClass, childViewClass, btcOfferBookTab); + loadTakeViewClass(viewClass, childViewClass, xmrOfferBookTab); } else { - loadCreateViewClass(btcOfferBookView, viewClass, childViewClass, btcOfferBookTab, (PaymentMethod) data); + loadCreateViewClass(xmrOfferBookView, viewClass, childViewClass, xmrOfferBookTab, (PaymentMethod) data); } - tabPane.getSelectionModel().select(btcOfferBookTab); + tabPane.getSelectionModel().select(xmrOfferBookTab); } else if (viewClass == TopCryptoOfferBookView.class && topCryptoOfferBookTab != null && topCryptoOfferBookView != null) { if (childViewClass == null) { topCryptoOfferBookTab.setContent(topCryptoOfferBookView.getRoot()); @@ -215,23 +215,23 @@ public abstract class OfferView extends ActivatableView { } tabPane.getSelectionModel().select(otherOfferBookTab); } else { - if (btcOfferBookTab == null) { - btcOfferBookTab = new Tab(Res.getBaseCurrencyName().toUpperCase()); - btcOfferBookTab.setClosable(false); - topCryptoOfferBookTab = new Tab(GUIUtil.TOP_CRYPTO.getCode()); + if (xmrOfferBookTab == null) { + xmrOfferBookTab = new Tab(Res.getBaseCurrencyName().toUpperCase()); + xmrOfferBookTab.setClosable(false); + topCryptoOfferBookTab = new Tab(GUIUtil.TOP_CRYPTO.getName().toUpperCase()); topCryptoOfferBookTab.setClosable(false); otherOfferBookTab = new Tab(Res.get("shared.other").toUpperCase()); otherOfferBookTab.setClosable(false); - tabPane.getTabs().addAll(btcOfferBookTab, topCryptoOfferBookTab, otherOfferBookTab); + tabPane.getTabs().addAll(xmrOfferBookTab, topCryptoOfferBookTab, otherOfferBookTab); } - if (viewClass == BtcOfferBookView.class) { - btcOfferBookView = (BtcOfferBookView) viewLoader.load(BtcOfferBookView.class); - btcOfferBookView.setOfferActionHandler(offerActionHandler); - btcOfferBookView.setDirection(direction); - btcOfferBookView.onTabSelected(true); - tabPane.getSelectionModel().select(btcOfferBookTab); - btcOfferBookTab.setContent(btcOfferBookView.getRoot()); + if (viewClass == XmrOfferBookView.class) { + xmrOfferBookView = (XmrOfferBookView) viewLoader.load(XmrOfferBookView.class); + xmrOfferBookView.setOfferActionHandler(offerActionHandler); + xmrOfferBookView.setDirection(direction); + xmrOfferBookView.onTabSelected(true); + tabPane.getSelectionModel().select(xmrOfferBookTab); + xmrOfferBookTab.setContent(xmrOfferBookView.getRoot()); } else if (viewClass == TopCryptoOfferBookView.class) { topCryptoOfferBookView = (TopCryptoOfferBookView) viewLoader.load(TopCryptoOfferBookView.class); topCryptoOfferBookView.setOfferActionHandler(offerActionHandler); @@ -323,8 +323,8 @@ public abstract class OfferView extends ActivatableView { @NotNull private Class> getOfferBookViewClassFor(String currencyCode) { Class> offerBookViewClass; - if (CurrencyUtil.isTraditionalCurrency(currencyCode)) { - offerBookViewClass = BtcOfferBookView.class; + if (CurrencyUtil.isFiatCurrency(currencyCode)) { + offerBookViewClass = XmrOfferBookView.class; } else if (currencyCode.equals(GUIUtil.TOP_CRYPTO.getCode())) { offerBookViewClass = TopCryptoOfferBookView.class; } else { diff --git a/desktop/src/main/java/haveno/desktop/main/offer/OfferViewUtil.java b/desktop/src/main/java/haveno/desktop/main/offer/OfferViewUtil.java index ef9d0cf0..f62f0013 100644 --- a/desktop/src/main/java/haveno/desktop/main/offer/OfferViewUtil.java +++ b/desktop/src/main/java/haveno/desktop/main/offer/OfferViewUtil.java @@ -30,7 +30,7 @@ import haveno.desktop.Navigation; import haveno.desktop.components.AutoTooltipButton; import haveno.desktop.components.AutoTooltipLabel; import haveno.desktop.components.HyperlinkWithIcon; -import haveno.desktop.main.offer.offerbook.BtcOfferBookView; +import haveno.desktop.main.offer.offerbook.XmrOfferBookView; import haveno.desktop.main.offer.offerbook.OfferBookView; import haveno.desktop.main.offer.offerbook.OtherOfferBookView; import haveno.desktop.main.offer.offerbook.TopCryptoOfferBookView; @@ -127,7 +127,7 @@ public class OfferViewUtil { public static Class> getOfferBookViewClass(String currencyCode) { Class> offerBookViewClazz; if (CurrencyUtil.isTraditionalCurrency(currencyCode)) { - offerBookViewClazz = BtcOfferBookView.class; + offerBookViewClazz = XmrOfferBookView.class; } else if (currencyCode.equals(GUIUtil.TOP_CRYPTO.getCode())) { offerBookViewClazz = TopCryptoOfferBookView.class; } else { diff --git a/desktop/src/main/java/haveno/desktop/main/offer/createoffer/CreateOfferView.java b/desktop/src/main/java/haveno/desktop/main/offer/createoffer/CreateOfferView.java index cffef240..6dace11d 100644 --- a/desktop/src/main/java/haveno/desktop/main/offer/createoffer/CreateOfferView.java +++ b/desktop/src/main/java/haveno/desktop/main/offer/createoffer/CreateOfferView.java @@ -55,7 +55,7 @@ public class CreateOfferView extends MutableOfferView { TradeCurrency tradeCurrency, OfferView.OfferActionHandler offerActionHandler) { // Invert direction for non-Fiat trade currencies -> BUY BSQ is to SELL Bitcoin - OfferDirection offerDirection = CurrencyUtil.isTraditionalCurrency(tradeCurrency.getCode()) ? direction : + OfferDirection offerDirection = CurrencyUtil.isFiatCurrency(tradeCurrency.getCode()) ? direction : direction == OfferDirection.BUY ? OfferDirection.SELL : OfferDirection.BUY; super.initWithData(offerDirection, tradeCurrency, offerActionHandler); } @@ -66,11 +66,10 @@ public class CreateOfferView extends MutableOfferView { paymentAccounts.stream().filter(paymentAccount -> { if (model.getTradeCurrency().equals(GUIUtil.TOP_CRYPTO)) { return Objects.equals(paymentAccount.getSingleTradeCurrency(), GUIUtil.TOP_CRYPTO); - } else if (CurrencyUtil.isTraditionalCurrency(model.getTradeCurrency().getCode())) { - return !paymentAccount.getPaymentMethod().isCrypto(); + } else if (CurrencyUtil.isFiatCurrency(model.getTradeCurrency().getCode())) { + return paymentAccount.isFiat(); } else { - return paymentAccount.getPaymentMethod().isCrypto() && - !Objects.equals(paymentAccount.getSingleTradeCurrency(), GUIUtil.TOP_CRYPTO); + return !paymentAccount.isFiat() && !Objects.equals(paymentAccount.getSingleTradeCurrency(), GUIUtil.TOP_CRYPTO); } }).collect(Collectors.toList())); } diff --git a/desktop/src/main/java/haveno/desktop/main/offer/offerbook/OtherOfferBookViewModel.java b/desktop/src/main/java/haveno/desktop/main/offer/offerbook/OtherOfferBookViewModel.java index 0c42a544..c6fc412a 100644 --- a/desktop/src/main/java/haveno/desktop/main/offer/offerbook/OtherOfferBookViewModel.java +++ b/desktop/src/main/java/haveno/desktop/main/offer/offerbook/OtherOfferBookViewModel.java @@ -24,6 +24,7 @@ import haveno.core.locale.CryptoCurrency; import haveno.core.locale.CurrencyUtil; import haveno.core.locale.GlobalSettings; import haveno.core.locale.TradeCurrency; +import haveno.core.locale.TraditionalCurrency; import haveno.core.offer.Offer; import haveno.core.offer.OfferDirection; import haveno.core.offer.OfferFilterService; @@ -82,7 +83,14 @@ public class OtherOfferBookViewModel extends OfferBookViewModel { @Override protected ObservableList filterPaymentMethods(ObservableList list, TradeCurrency selectedTradeCurrency) { - return FXCollections.observableArrayList(list.stream().filter(PaymentMethod::isBlockchain).collect(Collectors.toList())); + return FXCollections.observableArrayList(list.stream().filter(paymentMethod -> { + if (paymentMethod.isBlockchain()) return true; + if (paymentMethod.getSupportedAssetCodes() == null) return true; + for (String assetCode : paymentMethod.getSupportedAssetCodes()) { + if (!CurrencyUtil.isFiatCurrency(assetCode)) return true; + } + return false; + }).collect(Collectors.toList())); } @Override @@ -93,12 +101,18 @@ public class OtherOfferBookViewModel extends OfferBookViewModel { tradeCurrencies.addAll(preferences.getCryptoCurrenciesAsObservable().stream() .filter(withoutTopCrypto()) .collect(Collectors.toList())); + tradeCurrencies.addAll(CurrencyUtil.getMainTraditionalCurrencies().stream() + .filter(withoutFiatCurrency()) + .collect(Collectors.toList())); tradeCurrencies.add(new CryptoCurrency(GUIUtil.EDIT_FLAG, "")); allCurrencies.add(new CryptoCurrency(GUIUtil.SHOW_ALL_FLAG, "")); allCurrencies.addAll(CurrencyUtil.getAllSortedCryptoCurrencies().stream() .filter(withoutTopCrypto()) .collect(Collectors.toList())); + allCurrencies.addAll(CurrencyUtil.getMainTraditionalCurrencies().stream() + .filter(withoutFiatCurrency()) + .collect(Collectors.toList())); allCurrencies.add(new CryptoCurrency(GUIUtil.EDIT_FLAG, "")); } @@ -107,9 +121,9 @@ public class OtherOfferBookViewModel extends OfferBookViewModel { TradeCurrency selectedTradeCurrency) { return offerBookListItem -> { Offer offer = offerBookListItem.getOffer(); - // BUY Crypto is actually SELL Bitcoin + // BUY Crypto is actually SELL Monero boolean directionResult = offer.getDirection() == direction; - boolean currencyResult = CurrencyUtil.isCryptoCurrency(offer.getCurrencyCode()) && + boolean currencyResult = !CurrencyUtil.isFiatCurrency(offer.getCurrencyCode()) && ((showAllTradeCurrenciesProperty.get() && !offer.getCurrencyCode().equals(GUIUtil.TOP_CRYPTO.getCode())) || offer.getCurrencyCode().equals(selectedTradeCurrency.getCode())); @@ -156,4 +170,10 @@ public class OtherOfferBookViewModel extends OfferBookViewModel { return cryptoCurrency -> !cryptoCurrency.equals(GUIUtil.TOP_CRYPTO); } + + @NotNull + private Predicate withoutFiatCurrency() { + return fiatCurrency -> + !CurrencyUtil.isFiatCurrency(fiatCurrency.getCode()); + } } diff --git a/desktop/src/main/java/haveno/desktop/main/offer/offerbook/BtcOfferBookView.fxml b/desktop/src/main/java/haveno/desktop/main/offer/offerbook/XmrOfferBookView.fxml similarity index 97% rename from desktop/src/main/java/haveno/desktop/main/offer/offerbook/BtcOfferBookView.fxml rename to desktop/src/main/java/haveno/desktop/main/offer/offerbook/XmrOfferBookView.fxml index 0dc23fcb..e5bad7e7 100644 --- a/desktop/src/main/java/haveno/desktop/main/offer/offerbook/BtcOfferBookView.fxml +++ b/desktop/src/main/java/haveno/desktop/main/offer/offerbook/XmrOfferBookView.fxml @@ -19,7 +19,7 @@ - diff --git a/desktop/src/main/java/haveno/desktop/main/offer/offerbook/BtcOfferBookView.java b/desktop/src/main/java/haveno/desktop/main/offer/offerbook/XmrOfferBookView.java similarity index 90% rename from desktop/src/main/java/haveno/desktop/main/offer/offerbook/BtcOfferBookView.java rename to desktop/src/main/java/haveno/desktop/main/offer/offerbook/XmrOfferBookView.java index e7f26e91..697431d5 100644 --- a/desktop/src/main/java/haveno/desktop/main/offer/offerbook/BtcOfferBookView.java +++ b/desktop/src/main/java/haveno/desktop/main/offer/offerbook/XmrOfferBookView.java @@ -34,10 +34,10 @@ import javax.inject.Inject; import javax.inject.Named; @FxmlView -public class BtcOfferBookView extends OfferBookView { +public class XmrOfferBookView extends OfferBookView { @Inject - BtcOfferBookView(BtcOfferBookViewModel model, + XmrOfferBookView(XmrOfferBookViewModel model, Navigation navigation, OfferDetailsWindow offerDetailsWindow, @Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter formatter, @@ -51,8 +51,8 @@ public class BtcOfferBookView extends OfferBookView allCurrencies) { // Used for ignoring filter (show all) tradeCurrencies.add(new CryptoCurrency(GUIUtil.SHOW_ALL_FLAG, "")); - tradeCurrencies.addAll(preferences.getTraditionalCurrenciesAsObservable()); + tradeCurrencies.addAll(preferences.getTraditionalCurrenciesAsObservable().stream() + .filter(withFiatCurrency()) + .collect(Collectors.toList())); tradeCurrencies.add(new CryptoCurrency(GUIUtil.EDIT_FLAG, "")); allCurrencies.add(new CryptoCurrency(GUIUtil.SHOW_ALL_FLAG, "")); - allCurrencies.addAll(CurrencyUtil.getAllSortedTraditionalCurrencies()); + allCurrencies.addAll(CurrencyUtil.getAllSortedTraditionalCurrencies().stream() + .filter(withFiatCurrency()) + .collect(Collectors.toList())); allCurrencies.add(new CryptoCurrency(GUIUtil.EDIT_FLAG, "")); } @@ -111,7 +116,7 @@ public class BtcOfferBookViewModel extends OfferBookViewModel { return offerBookListItem -> { Offer offer = offerBookListItem.getOffer(); boolean directionResult = offer.getDirection() != direction; - boolean currencyResult = (showAllTradeCurrenciesProperty.get() && offer.isTraditionalOffer()) || + boolean currencyResult = (showAllTradeCurrenciesProperty.get() && offer.isFiatOffer()) || offer.getCurrencyCode().equals(selectedTradeCurrency.getCode()); boolean paymentMethodResult = showAllPaymentMethods || offer.getPaymentMethod().equals(selectedPaymentMethod); @@ -145,9 +150,14 @@ public class BtcOfferBookViewModel extends OfferBookViewModel { @Override String getCurrencyCodeFromPreferences(OfferDirection direction) { - // validate if previous stored currencies are Fiat ones + // validate if previous stored currencies are Traditional ones String currencyCode = direction == OfferDirection.BUY ? preferences.getBuyScreenCurrencyCode() : preferences.getSellScreenCurrencyCode(); return CurrencyUtil.isTraditionalCurrency(currencyCode) ? currencyCode : null; } + + private Predicate withFiatCurrency() { + return fiatCurrency -> + CurrencyUtil.isFiatCurrency(fiatCurrency.getCode()); + } } diff --git a/desktop/src/main/java/haveno/desktop/main/settings/preferences/PreferencesView.java b/desktop/src/main/java/haveno/desktop/main/settings/preferences/PreferencesView.java index 96736f4e..683dec35 100644 --- a/desktop/src/main/java/haveno/desktop/main/settings/preferences/PreferencesView.java +++ b/desktop/src/main/java/haveno/desktop/main/settings/preferences/PreferencesView.java @@ -332,7 +332,7 @@ public class PreferencesView extends ActivatableViewAndModel, VBox> traditionalTuple = addTopLabelListView(root, displayCurrenciesGridRowIndex, - Res.get("setting.preferences.displayFiat")); + Res.get("setting.preferences.displayTraditional")); int listRowSpan = 6; GridPane.setColumnIndex(traditionalTuple.third, 2); @@ -343,7 +343,7 @@ public class PreferencesView extends ActivatableViewAndModel() { @@ -445,7 +445,7 @@ public class PreferencesView extends ActivatableViewAndModel() { @Override protected void updateItem(final TraditionalCurrency item, boolean empty) { @@ -453,7 +453,7 @@ public class PreferencesView extends ActivatableViewAndModel