Remove useStickyMarketPrice (not used anymore)

This commit is contained in:
Manfred Karrer 2017-04-12 21:54:16 -05:00
parent 1809393b69
commit ac7714078c
7 changed files with 21 additions and 39 deletions

View File

@ -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();

View File

@ -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<PriceFeedComboBoxItem> 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<PriceFeedComboBoxItem> 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())

View File

@ -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());
}

View File

@ -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());
}

View File

@ -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<TradeCurrency> tradeCurrencyOptional = preferences.getTradeCurrenciesAsObservable().stream().filter(e -> e.getCode().equals(code)).findAny();
if (!tradeCurrencyOptional.isPresent()) {

View File

@ -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

View File

@ -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());
}