fix price disappearing when first payment account created
This commit is contained in:
parent
f9d700074a
commit
6fbfef029e
@ -169,7 +169,7 @@ public class MarketPricePresentation {
|
|||||||
|
|
||||||
marketPriceCurrencyCode.bind(priceFeedService.currencyCodeProperty());
|
marketPriceCurrencyCode.bind(priceFeedService.currencyCodeProperty());
|
||||||
|
|
||||||
priceFeedAllLoadedSubscription = EasyBind.subscribe(priceFeedService.updateCounterProperty(), updateCounter -> setMarketPriceInItems());
|
priceFeedAllLoadedSubscription = EasyBind.subscribe(priceFeedService.updateCounterProperty(), updateCounter -> UserThread.execute(() -> setMarketPriceInItems()));
|
||||||
|
|
||||||
preferences.getTradeCurrenciesAsObservable().addListener((ListChangeListener<TradeCurrency>) c -> UserThread.runAfter(() -> {
|
preferences.getTradeCurrenciesAsObservable().addListener((ListChangeListener<TradeCurrency>) c -> UserThread.runAfter(() -> {
|
||||||
fillPriceFeedComboBoxItems();
|
fillPriceFeedComboBoxItems();
|
||||||
@ -184,31 +184,29 @@ public class MarketPricePresentation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setMarketPriceInItems() {
|
private void setMarketPriceInItems() {
|
||||||
UserThread.execute(() -> {
|
priceFeedComboBoxItems.forEach(item -> {
|
||||||
priceFeedComboBoxItems.forEach(item -> {
|
String currencyCode = item.currencyCode;
|
||||||
String currencyCode = item.currencyCode;
|
MarketPrice marketPrice = priceFeedService.getMarketPrice(currencyCode);
|
||||||
MarketPrice marketPrice = priceFeedService.getMarketPrice(currencyCode);
|
String priceString;
|
||||||
String priceString;
|
if (marketPrice != null && marketPrice.isPriceAvailable()) {
|
||||||
if (marketPrice != null && marketPrice.isPriceAvailable()) {
|
priceString = FormattingUtils.formatMarketPrice(marketPrice.getPrice(), currencyCode);
|
||||||
priceString = FormattingUtils.formatMarketPrice(marketPrice.getPrice(), currencyCode);
|
item.setPriceAvailable(true);
|
||||||
item.setPriceAvailable(true);
|
item.setExternallyProvidedPrice(marketPrice.isExternallyProvidedPrice());
|
||||||
item.setExternallyProvidedPrice(marketPrice.isExternallyProvidedPrice());
|
} else {
|
||||||
} else {
|
priceString = Res.get("shared.na");
|
||||||
priceString = Res.get("shared.na");
|
item.setPriceAvailable(false);
|
||||||
item.setPriceAvailable(false);
|
}
|
||||||
}
|
item.setDisplayString(CurrencyUtil.getCurrencyPair(currencyCode) + ": " + priceString);
|
||||||
item.setDisplayString(CurrencyUtil.getCurrencyPair(currencyCode) + ": " + priceString);
|
|
||||||
|
|
||||||
final String code = item.currencyCode;
|
final String code = item.currencyCode;
|
||||||
if (selectedPriceFeedComboBoxItemProperty.get() != null &&
|
if (selectedPriceFeedComboBoxItemProperty.get() != null &&
|
||||||
selectedPriceFeedComboBoxItemProperty.get().currencyCode.equals(code)) {
|
selectedPriceFeedComboBoxItemProperty.get().currencyCode.equals(code)) {
|
||||||
isFiatCurrencyPriceFeedSelected.set(CurrencyUtil.isFiatCurrency(code) && CurrencyUtil.getFiatCurrency(code).isPresent() && item.isPriceAvailable() && item.isExternallyProvidedPrice());
|
isFiatCurrencyPriceFeedSelected.set(CurrencyUtil.isFiatCurrency(code) && CurrencyUtil.getFiatCurrency(code).isPresent() && item.isPriceAvailable() && item.isExternallyProvidedPrice());
|
||||||
isCryptoCurrencyPriceFeedSelected.set(CurrencyUtil.isCryptoCurrency(code) && CurrencyUtil.getCryptoCurrency(code).isPresent() && item.isPriceAvailable() && item.isExternallyProvidedPrice());
|
isCryptoCurrencyPriceFeedSelected.set(CurrencyUtil.isCryptoCurrency(code) && CurrencyUtil.getCryptoCurrency(code).isPresent() && item.isPriceAvailable() && item.isExternallyProvidedPrice());
|
||||||
isExternallyProvidedPrice.set(item.isExternallyProvidedPrice());
|
isExternallyProvidedPrice.set(item.isExternallyProvidedPrice());
|
||||||
isPriceAvailable.set(item.isPriceAvailable());
|
isPriceAvailable.set(item.isPriceAvailable());
|
||||||
marketPriceUpdated.set(marketPriceUpdated.get() + 1);
|
marketPriceUpdated.set(marketPriceUpdated.get() + 1);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user