mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-23 23:06:39 +01:00
Misc fixes and cleanups
- Fix bug with ignored taker check (use peer instead of offer.getMakerNodeAddress()). - Remove redundant tradeStatisticsSet in TradeStatisticsManager - Remove handling for old TradeStatistics objects (since v 0.6.0 not supported anymore) - Use marketPricePresentation.priceFeedComboBoxItems instead of - MainVievModel.priceFeedComboBoxItems. - Replace Authorisation # with Authorisation number. - Remove https://bisq.network/survey and https://bisq.community links in tradeFeedbackWindow text. - Add null checks. - Improve logging. - Cleanup
This commit is contained in:
parent
c8cfc89c13
commit
0e15f3c537
4 changed files with 14 additions and 19 deletions
|
@ -230,7 +230,7 @@ public class MainView extends InitializableView<StackPane, MainViewModel> {
|
|||
|
||||
};
|
||||
model.getSelectedPriceFeedComboBoxItemProperty().addListener(selectedPriceFeedItemListener);
|
||||
priceComboBox.setItems(model.priceFeedComboBoxItems);
|
||||
priceComboBox.setItems(model.getPriceFeedComboBoxItems());
|
||||
|
||||
HBox.setMargin(marketPriceBox.second, new Insets(0, 0, 0, 0));
|
||||
|
||||
|
|
|
@ -72,7 +72,6 @@ import javafx.beans.property.ObjectProperty;
|
|||
import javafx.beans.property.SimpleBooleanProperty;
|
||||
import javafx.beans.property.StringProperty;
|
||||
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
|
||||
import java.util.Date;
|
||||
|
@ -108,9 +107,6 @@ public class MainViewModel implements ViewModel {
|
|||
|
||||
@Getter
|
||||
private BooleanProperty showAppScreen = new SimpleBooleanProperty();
|
||||
|
||||
|
||||
final ObservableList<PriceFeedComboBoxItem> priceFeedComboBoxItems = FXCollections.observableArrayList();
|
||||
private final BooleanProperty isSplashScreenRemoved = new SimpleBooleanProperty();
|
||||
private Timer checkNumberOfBtcPeersTimer;
|
||||
private Timer checkNumberOfP2pNetworkPeersTimer;
|
||||
|
@ -558,4 +554,8 @@ public class MainViewModel implements ViewModel {
|
|||
IntegerProperty getMarketPriceUpdated() {
|
||||
return marketPricePresentation.getMarketPriceUpdated();
|
||||
}
|
||||
|
||||
public ObservableList<PriceFeedComboBoxItem> getPriceFeedComboBoxItems() {
|
||||
return marketPricePresentation.getPriceFeedComboBoxItems();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,10 +57,13 @@ import java.util.Optional;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
public class MarketPricePresentation {
|
||||
private final Preferences preferences;
|
||||
private final BSFormatter formatter;
|
||||
private final PriceFeedService priceFeedService;
|
||||
@Getter
|
||||
private final ObservableList<PriceFeedComboBoxItem> priceFeedComboBoxItems = FXCollections.observableArrayList();
|
||||
@SuppressWarnings("FieldCanBeLocal")
|
||||
private MonadicBinding<String> marketPriceBinding;
|
||||
|
|
|
@ -24,7 +24,6 @@ import bisq.desktop.main.settings.SettingsView;
|
|||
import bisq.desktop.main.settings.preferences.PreferencesView;
|
||||
import bisq.desktop.util.GUIUtil;
|
||||
|
||||
import bisq.core.btc.wallet.WalletsSetup;
|
||||
import bisq.core.filter.FilterManager;
|
||||
import bisq.core.locale.BankUtil;
|
||||
import bisq.core.locale.CountryUtil;
|
||||
|
@ -99,7 +98,6 @@ class OfferBookViewModel extends ActivatableViewModel {
|
|||
final PriceFeedService priceFeedService;
|
||||
private final ClosedTradableManager closedTradableManager;
|
||||
private final FilterManager filterManager;
|
||||
private final WalletsSetup walletsSetup;
|
||||
final AccountAgeWitnessService accountAgeWitnessService;
|
||||
private final Navigation navigation;
|
||||
final BSFormatter formatter;
|
||||
|
@ -143,7 +141,6 @@ class OfferBookViewModel extends ActivatableViewModel {
|
|||
PriceFeedService priceFeedService,
|
||||
ClosedTradableManager closedTradableManager,
|
||||
FilterManager filterManager,
|
||||
WalletsSetup walletsSetup,
|
||||
AccountAgeWitnessService accountAgeWitnessService,
|
||||
Navigation navigation,
|
||||
BSFormatter formatter) {
|
||||
|
@ -157,7 +154,6 @@ class OfferBookViewModel extends ActivatableViewModel {
|
|||
this.priceFeedService = priceFeedService;
|
||||
this.closedTradableManager = closedTradableManager;
|
||||
this.filterManager = filterManager;
|
||||
this.walletsSetup = walletsSetup;
|
||||
this.accountAgeWitnessService = accountAgeWitnessService;
|
||||
this.navigation = navigation;
|
||||
this.formatter = formatter;
|
||||
|
@ -191,19 +187,15 @@ class OfferBookViewModel extends ActivatableViewModel {
|
|||
|
||||
final Optional<OfferBookListItem> highestPriceOffer = filteredItems.stream()
|
||||
.filter(o -> o.getOffer().getPrice() != null)
|
||||
.max(Comparator.comparingLong(o -> o.getOffer().getPrice().getValue()));
|
||||
.max(Comparator.comparingLong(o -> o.getOffer().getPrice() != null ? o.getOffer().getPrice().getValue() : 0));
|
||||
|
||||
if (highestPriceOffer.isPresent()) {
|
||||
maxPlacesForPrice.set(formatPrice(highestPriceOffer.get().getOffer(), false).length());
|
||||
}
|
||||
highestPriceOffer.ifPresent(offerBookListItem -> maxPlacesForPrice.set(formatPrice(offerBookListItem.getOffer(), false).length()));
|
||||
|
||||
final Optional<OfferBookListItem> highestMarketPriceMarginOffer = filteredItems.stream()
|
||||
.filter(o -> o.getOffer().isUseMarketBasedPrice())
|
||||
.max(Comparator.comparing(o -> new DecimalFormat("#0.00").format(o.getOffer().getMarketPriceMargin() * 100).length()));
|
||||
|
||||
if (highestMarketPriceMarginOffer.isPresent()) {
|
||||
maxPlacesForMarketPriceMargin.set(formatMarketPriceMargin(highestMarketPriceMarginOffer.get().getOffer(), false).length());
|
||||
}
|
||||
highestMarketPriceMarginOffer.ifPresent(offerBookListItem -> maxPlacesForMarketPriceMargin.set(formatMarketPriceMargin(offerBookListItem.getOffer(), false).length()));
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -497,7 +489,7 @@ class OfferBookViewModel extends ActivatableViewModel {
|
|||
}
|
||||
|
||||
boolean isAnyPaymentAccountValidForOffer(Offer offer) {
|
||||
return PaymentAccountUtil.isAnyPaymentAccountValidForOffer(offer, user.getPaymentAccounts());
|
||||
return user.getPaymentAccounts() != null && PaymentAccountUtil.isAnyPaymentAccountValidForOffer(offer, user.getPaymentAccounts());
|
||||
}
|
||||
|
||||
boolean hasPaymentAccountForCurrency() {
|
||||
|
@ -542,7 +534,7 @@ class OfferBookViewModel extends ActivatableViewModel {
|
|||
}
|
||||
|
||||
boolean isIgnored(Offer offer) {
|
||||
return preferences.getIgnoreTradersList().stream().filter(i -> i.equals(offer.getMakerNodeAddress().getHostNameWithoutPostFix())).findAny().isPresent();
|
||||
return preferences.getIgnoreTradersList().stream().anyMatch(i -> i.equals(offer.getMakerNodeAddress().getHostNameWithoutPostFix()));
|
||||
}
|
||||
|
||||
boolean isOfferBanned(Offer offer) {
|
||||
|
@ -563,7 +555,7 @@ class OfferBookViewModel extends ActivatableViewModel {
|
|||
|
||||
boolean isInsufficientTradeLimit(Offer offer) {
|
||||
Optional<PaymentAccount> accountOptional = getMostMaturePaymentAccountForOffer(offer);
|
||||
final long myTradeLimit = accountOptional.isPresent() ? accountAgeWitnessService.getMyTradeLimit(accountOptional.get(), offer.getCurrencyCode()) : 0L;
|
||||
final long myTradeLimit = accountOptional.map(paymentAccount -> accountAgeWitnessService.getMyTradeLimit(paymentAccount, offer.getCurrencyCode())).orElse(0L);
|
||||
final long offerMinAmount = offer.getMinAmount().value;
|
||||
log.debug("isInsufficientTradeLimit accountOptional={}, myTradeLimit={}, offerMinAmount={}, ",
|
||||
accountOptional.isPresent() ? accountOptional.get().getAccountName() : "null",
|
||||
|
|
Loading…
Add table
Reference in a new issue