diff --git a/core/src/main/java/io/bisq/core/user/Preferences.java b/core/src/main/java/io/bisq/core/user/Preferences.java index bfe6e6e619..cecbfb9a2e 100644 --- a/core/src/main/java/io/bisq/core/user/Preferences.java +++ b/core/src/main/java/io/bisq/core/user/Preferences.java @@ -475,11 +475,6 @@ public final class Preferences implements Persistable { persist(); } - // not used anymore - public boolean isUseStickyMarketPrice() { - return false; - } - public void setSortMarketCurrenciesNumerically(boolean sortMarketCurrenciesNumerically) { this.sortMarketCurrenciesNumerically = sortMarketCurrenciesNumerically; persist(); diff --git a/gui/src/main/java/io/bisq/gui/main/MainViewModel.java b/gui/src/main/java/io/bisq/gui/main/MainViewModel.java index fda53eb19e..564cae75cb 100644 --- a/gui/src/main/java/io/bisq/gui/main/MainViewModel.java +++ b/gui/src/main/java/io/bisq/gui/main/MainViewModel.java @@ -816,15 +816,11 @@ public class MainViewModel implements ViewModel { if (newValue != null && !newValue.equals(oldValue)) { setMarketPriceInItems(); - String code = preferences.isUseStickyMarketPrice() ? - preferences.getPreferredTradeCurrency().getCode() : - priceFeedService.currencyCodeProperty().get(); + String code = priceFeedService.currencyCodeProperty().get(); Optional itemOptional = findPriceFeedComboBoxItem(code); if (itemOptional.isPresent()) { - if (selectedPriceFeedComboBoxItemProperty.get() == null || !preferences.isUseStickyMarketPrice()) { - itemOptional.get().setDisplayString(newValue); - selectedPriceFeedComboBoxItemProperty.set(itemOptional.get()); - } + itemOptional.get().setDisplayString(newValue); + selectedPriceFeedComboBoxItemProperty.set(itemOptional.get()); } else { if (CurrencyUtil.isCryptoCurrency(code)) { CurrencyUtil.getCryptoCurrency(code).ifPresent(cryptoCurrency -> { @@ -871,7 +867,7 @@ public class MainViewModel implements ViewModel { } public void setPriceFeedComboBoxItem(PriceFeedComboBoxItem item) { - if (!preferences.isUseStickyMarketPrice() && item != null) { + if (item != null) { Optional itemOptional = findPriceFeedComboBoxItem(priceFeedService.currencyCodeProperty().get()); if (itemOptional.isPresent()) selectedPriceFeedComboBoxItemProperty.set(itemOptional.get()); @@ -879,9 +875,6 @@ public class MainViewModel implements ViewModel { findPriceFeedComboBoxItem(preferences.getPreferredTradeCurrency().getCode()) .ifPresent(selectedPriceFeedComboBoxItemProperty::set); - priceFeedService.setCurrencyCode(item.currencyCode); - } else if (item != null) { - selectedPriceFeedComboBoxItemProperty.set(item); priceFeedService.setCurrencyCode(item.currencyCode); } else { findPriceFeedComboBoxItem(preferences.getPreferredTradeCurrency().getCode()) diff --git a/gui/src/main/java/io/bisq/gui/main/market/offerbook/OfferBookChartViewModel.java b/gui/src/main/java/io/bisq/gui/main/market/offerbook/OfferBookChartViewModel.java index 8e9e6a258f..965c21fad2 100644 --- a/gui/src/main/java/io/bisq/gui/main/market/offerbook/OfferBookChartViewModel.java +++ b/gui/src/main/java/io/bisq/gui/main/market/offerbook/OfferBookChartViewModel.java @@ -175,8 +175,7 @@ class OfferBookChartViewModel extends ActivatableViewModel { updateChartData(); - if (!preferences.isUseStickyMarketPrice()) - priceFeedService.setCurrencyCode(code); + priceFeedService.setCurrencyCode(code); } } } @@ -229,7 +228,7 @@ class OfferBookChartViewModel extends ActivatableViewModel { /////////////////////////////////////////////////////////////////////////////////////////// private void syncPriceFeedCurrency() { - if (!preferences.isUseStickyMarketPrice() && selectedTabIndex == TAB_INDEX) + if (selectedTabIndex == TAB_INDEX) priceFeedService.setCurrencyCode(selectedTradeCurrencyProperty.get().getCode()); } diff --git a/gui/src/main/java/io/bisq/gui/main/market/trades/TradesChartsViewModel.java b/gui/src/main/java/io/bisq/gui/main/market/trades/TradesChartsViewModel.java index 83282b3704..5e38bbd9ba 100644 --- a/gui/src/main/java/io/bisq/gui/main/market/trades/TradesChartsViewModel.java +++ b/gui/src/main/java/io/bisq/gui/main/market/trades/TradesChartsViewModel.java @@ -182,12 +182,10 @@ class TradesChartsViewModel extends ActivatableViewModel { updateChartData(); - if (!preferences.isUseStickyMarketPrice()) { - if (showAllEntry) - priceFeedService.setCurrencyCode(GlobalSettings.getDefaultTradeCurrency().getCode()); - else - priceFeedService.setCurrencyCode(code); - } + if (showAllEntry) + priceFeedService.setCurrencyCode(GlobalSettings.getDefaultTradeCurrency().getCode()); + else + priceFeedService.setCurrencyCode(code); } } } @@ -227,7 +225,7 @@ class TradesChartsViewModel extends ActivatableViewModel { /////////////////////////////////////////////////////////////////////////////////////////// private void setMarketPriceFeedCurrency() { - if (!preferences.isUseStickyMarketPrice() && selectedTabIndex == TAB_INDEX) { + if (selectedTabIndex == TAB_INDEX) { if (showAllTradeCurrenciesProperty.get()) priceFeedService.setCurrencyCode(GlobalSettings.getDefaultTradeCurrency().getCode()); else @@ -236,7 +234,7 @@ class TradesChartsViewModel extends ActivatableViewModel { } private void syncPriceFeedCurrency() { - if (!preferences.isUseStickyMarketPrice() && selectedTabIndex == TAB_INDEX) + if (selectedTabIndex == TAB_INDEX) priceFeedService.setCurrencyCode(selectedTradeCurrencyProperty.get().getCode()); } diff --git a/gui/src/main/java/io/bisq/gui/main/offer/createoffer/CreateOfferDataModel.java b/gui/src/main/java/io/bisq/gui/main/offer/createoffer/CreateOfferDataModel.java index d51be69525..d346a157c9 100644 --- a/gui/src/main/java/io/bisq/gui/main/offer/createoffer/CreateOfferDataModel.java +++ b/gui/src/main/java/io/bisq/gui/main/offer/createoffer/CreateOfferDataModel.java @@ -184,7 +184,7 @@ class CreateOfferDataModel extends ActivatableDataModel { addBindings(); addListeners(); - if (!preferences.isUseStickyMarketPrice() && isTabSelected) + if (isTabSelected) priceFeedService.setCurrencyCode(tradeCurrencyCode.get()); updateBalance(); @@ -250,8 +250,7 @@ class CreateOfferDataModel extends ActivatableDataModel { if (this.tradeCurrency != null) tradeCurrencyCode.set(this.tradeCurrency.getCode()); - if (!preferences.isUseStickyMarketPrice()) - priceFeedService.setCurrencyCode(tradeCurrencyCode.get()); + priceFeedService.setCurrencyCode(tradeCurrencyCode.get()); // We request to get the actual estimated fee requestTxFee(); @@ -279,7 +278,7 @@ class CreateOfferDataModel extends ActivatableDataModel { void onTabSelected(boolean isSelected) { this.isTabSelected = isSelected; - if (!preferences.isUseStickyMarketPrice() && isTabSelected) + if (isTabSelected) priceFeedService.setCurrencyCode(tradeCurrencyCode.get()); } @@ -426,8 +425,7 @@ class CreateOfferDataModel extends ActivatableDataModel { if (paymentAccount != null) paymentAccount.setSelectedTradeCurrency(tradeCurrency); - if (!preferences.isUseStickyMarketPrice()) - priceFeedService.setCurrencyCode(code); + priceFeedService.setCurrencyCode(code); Optional tradeCurrencyOptional = preferences.getTradeCurrenciesAsObservable().stream().filter(e -> e.getCode().equals(code)).findAny(); if (!tradeCurrencyOptional.isPresent()) { diff --git a/gui/src/main/java/io/bisq/gui/main/offer/offerbook/OfferBookViewModel.java b/gui/src/main/java/io/bisq/gui/main/offer/offerbook/OfferBookViewModel.java index 1e26451ff5..f0d378fff7 100644 --- a/gui/src/main/java/io/bisq/gui/main/offer/offerbook/OfferBookViewModel.java +++ b/gui/src/main/java/io/bisq/gui/main/offer/offerbook/OfferBookViewModel.java @@ -375,7 +375,7 @@ class OfferBookViewModel extends ActivatableViewModel { /////////////////////////////////////////////////////////////////////////////////////////// private void setMarketPriceFeedCurrency() { - if (!preferences.isUseStickyMarketPrice() && isTabSelected) { + if (isTabSelected) { if (showAllTradeCurrenciesProperty.get()) priceFeedService.setCurrencyCode(GlobalSettings.getDefaultTradeCurrency().getCode()); else diff --git a/gui/src/main/java/io/bisq/gui/main/offer/takeoffer/TakeOfferDataModel.java b/gui/src/main/java/io/bisq/gui/main/offer/takeoffer/TakeOfferDataModel.java index cfce1f0847..a51259ca5a 100644 --- a/gui/src/main/java/io/bisq/gui/main/offer/takeoffer/TakeOfferDataModel.java +++ b/gui/src/main/java/io/bisq/gui/main/offer/takeoffer/TakeOfferDataModel.java @@ -129,7 +129,7 @@ class TakeOfferDataModel extends ActivatableDataModel { // if (isWalletFunded.get()) // feeFromFundingTxProperty.set(FeePolicy.getMinRequiredFeeForFundingTx()); - if (!preferences.isUseStickyMarketPrice() && isTabSelected) + if (isTabSelected) priceFeedService.setCurrencyCode(offer.getCurrencyCode()); tradeManager.checkOfferAvailability(offer, @@ -236,8 +236,7 @@ class TakeOfferDataModel extends ActivatableDataModel { offer.resetState(); - if (!preferences.isUseStickyMarketPrice()) - priceFeedService.setCurrencyCode(offer.getCurrencyCode()); + priceFeedService.setCurrencyCode(offer.getCurrencyCode()); } void requestTxFee() { @@ -249,7 +248,7 @@ class TakeOfferDataModel extends ActivatableDataModel { void onTabSelected(boolean isSelected) { this.isTabSelected = isSelected; - if (!preferences.isUseStickyMarketPrice() && isTabSelected) + if (isTabSelected) priceFeedService.setCurrencyCode(offer.getCurrencyCode()); } @@ -383,7 +382,7 @@ class TakeOfferDataModel extends ActivatableDataModel { totalToPayAsCoin.set(feeAndSecDeposit.add(amount.get())); else totalToPayAsCoin.set(feeAndSecDeposit); - + updateBalance(); log.debug("totalToPayAsCoin " + totalToPayAsCoin.get().toFriendlyString()); }