mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 18:03:12 +01:00
Rename OfferFilter to OfferFilterService
This commit is contained in:
parent
7197b316fc
commit
1b4c4871c0
@ -21,7 +21,7 @@ import bisq.core.monetary.Altcoin;
|
|||||||
import bisq.core.monetary.Price;
|
import bisq.core.monetary.Price;
|
||||||
import bisq.core.offer.Offer;
|
import bisq.core.offer.Offer;
|
||||||
import bisq.core.offer.OfferBookService;
|
import bisq.core.offer.OfferBookService;
|
||||||
import bisq.core.offer.OfferFilter;
|
import bisq.core.offer.OfferFilterService;
|
||||||
import bisq.core.offer.OfferUtil;
|
import bisq.core.offer.OfferUtil;
|
||||||
import bisq.core.offer.OpenOffer;
|
import bisq.core.offer.OpenOffer;
|
||||||
import bisq.core.offer.OpenOfferManager;
|
import bisq.core.offer.OpenOfferManager;
|
||||||
@ -85,7 +85,7 @@ class CoreOffersService {
|
|||||||
private final CoreWalletsService coreWalletsService;
|
private final CoreWalletsService coreWalletsService;
|
||||||
private final CreateOfferService createOfferService;
|
private final CreateOfferService createOfferService;
|
||||||
private final OfferBookService offerBookService;
|
private final OfferBookService offerBookService;
|
||||||
private final OfferFilter offerFilter;
|
private final OfferFilterService offerFilterService;
|
||||||
private final OpenOfferManager openOfferManager;
|
private final OpenOfferManager openOfferManager;
|
||||||
private final OfferUtil offerUtil;
|
private final OfferUtil offerUtil;
|
||||||
private final PriceFeedService priceFeedService;
|
private final PriceFeedService priceFeedService;
|
||||||
@ -97,7 +97,7 @@ class CoreOffersService {
|
|||||||
CoreWalletsService coreWalletsService,
|
CoreWalletsService coreWalletsService,
|
||||||
CreateOfferService createOfferService,
|
CreateOfferService createOfferService,
|
||||||
OfferBookService offerBookService,
|
OfferBookService offerBookService,
|
||||||
OfferFilter offerFilter,
|
OfferFilterService offerFilterService,
|
||||||
OpenOfferManager openOfferManager,
|
OpenOfferManager openOfferManager,
|
||||||
OfferUtil offerUtil,
|
OfferUtil offerUtil,
|
||||||
PriceFeedService priceFeedService,
|
PriceFeedService priceFeedService,
|
||||||
@ -107,7 +107,7 @@ class CoreOffersService {
|
|||||||
this.coreWalletsService = coreWalletsService;
|
this.coreWalletsService = coreWalletsService;
|
||||||
this.createOfferService = createOfferService;
|
this.createOfferService = createOfferService;
|
||||||
this.offerBookService = offerBookService;
|
this.offerBookService = offerBookService;
|
||||||
this.offerFilter = offerFilter;
|
this.offerFilterService = offerFilterService;
|
||||||
this.openOfferManager = openOfferManager;
|
this.openOfferManager = openOfferManager;
|
||||||
this.offerUtil = offerUtil;
|
this.offerUtil = offerUtil;
|
||||||
this.priceFeedService = priceFeedService;
|
this.priceFeedService = priceFeedService;
|
||||||
@ -118,7 +118,7 @@ class CoreOffersService {
|
|||||||
return offerBookService.getOffers().stream()
|
return offerBookService.getOffers().stream()
|
||||||
.filter(o -> o.getId().equals(id))
|
.filter(o -> o.getId().equals(id))
|
||||||
.filter(o -> !o.isMyOffer(keyRing))
|
.filter(o -> !o.isMyOffer(keyRing))
|
||||||
.filter(o -> offerFilter.canTakeOffer(o, coreContext.isApiUser()).isValid())
|
.filter(o -> offerFilterService.canTakeOffer(o, coreContext.isApiUser()).isValid())
|
||||||
.findAny().orElseThrow(() ->
|
.findAny().orElseThrow(() ->
|
||||||
new IllegalStateException(format("offer with id '%s' not found", id)));
|
new IllegalStateException(format("offer with id '%s' not found", id)));
|
||||||
}
|
}
|
||||||
@ -135,7 +135,7 @@ class CoreOffersService {
|
|||||||
return offerBookService.getOffers().stream()
|
return offerBookService.getOffers().stream()
|
||||||
.filter(o -> !o.isMyOffer(keyRing))
|
.filter(o -> !o.isMyOffer(keyRing))
|
||||||
.filter(o -> offerMatchesDirectionAndCurrency(o, direction, currencyCode))
|
.filter(o -> offerMatchesDirectionAndCurrency(o, direction, currencyCode))
|
||||||
.filter(o -> offerFilter.canTakeOffer(o, coreContext.isApiUser()).isValid())
|
.filter(o -> offerFilterService.canTakeOffer(o, coreContext.isApiUser()).isValid())
|
||||||
.sorted(priceComparator(direction))
|
.sorted(priceComparator(direction))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Singleton
|
@Singleton
|
||||||
public class OfferFilter {
|
public class OfferFilterService {
|
||||||
private final User user;
|
private final User user;
|
||||||
private final Preferences preferences;
|
private final Preferences preferences;
|
||||||
private final FilterManager filterManager;
|
private final FilterManager filterManager;
|
||||||
@ -52,10 +52,10 @@ public class OfferFilter {
|
|||||||
private final Map<String, Boolean> myInsufficientTradeLimitCache = new HashMap<>();
|
private final Map<String, Boolean> myInsufficientTradeLimitCache = new HashMap<>();
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public OfferFilter(User user,
|
public OfferFilterService(User user,
|
||||||
Preferences preferences,
|
Preferences preferences,
|
||||||
FilterManager filterManager,
|
FilterManager filterManager,
|
||||||
AccountAgeWitnessService accountAgeWitnessService) {
|
AccountAgeWitnessService accountAgeWitnessService) {
|
||||||
this.user = user;
|
this.user = user;
|
||||||
this.preferences = preferences;
|
this.preferences = preferences;
|
||||||
this.filterManager = filterManager;
|
this.filterManager = filterManager;
|
@ -53,7 +53,7 @@ import bisq.core.locale.Res;
|
|||||||
import bisq.core.locale.TradeCurrency;
|
import bisq.core.locale.TradeCurrency;
|
||||||
import bisq.core.monetary.Price;
|
import bisq.core.monetary.Price;
|
||||||
import bisq.core.offer.Offer;
|
import bisq.core.offer.Offer;
|
||||||
import bisq.core.offer.OfferFilter;
|
import bisq.core.offer.OfferFilterService;
|
||||||
import bisq.core.offer.OfferRestrictions;
|
import bisq.core.offer.OfferRestrictions;
|
||||||
import bisq.core.offer.bisq_v1.OfferPayload;
|
import bisq.core.offer.bisq_v1.OfferPayload;
|
||||||
import bisq.core.payment.PaymentAccount;
|
import bisq.core.payment.PaymentAccount;
|
||||||
@ -613,7 +613,7 @@ public class OfferBookView extends ActivatableViewAndModel<GridPane, OfferBookVi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onShowInfo(Offer offer, OfferFilter.Result result) {
|
private void onShowInfo(Offer offer, OfferFilterService.Result result) {
|
||||||
switch (result) {
|
switch (result) {
|
||||||
case VALID:
|
case VALID:
|
||||||
break;
|
break;
|
||||||
@ -1021,7 +1021,7 @@ public class OfferBookView extends ActivatableViewAndModel<GridPane, OfferBookVi
|
|||||||
return new TableCell<>() {
|
return new TableCell<>() {
|
||||||
final ImageView iconView = new ImageView();
|
final ImageView iconView = new ImageView();
|
||||||
final AutoTooltipButton button = new AutoTooltipButton();
|
final AutoTooltipButton button = new AutoTooltipButton();
|
||||||
OfferFilter.Result canTakeOfferResult = null;
|
OfferFilterService.Result canTakeOfferResult = null;
|
||||||
|
|
||||||
{
|
{
|
||||||
button.setGraphic(iconView);
|
button.setGraphic(iconView);
|
||||||
@ -1040,7 +1040,7 @@ public class OfferBookView extends ActivatableViewAndModel<GridPane, OfferBookVi
|
|||||||
boolean myOffer = model.isMyOffer(offer);
|
boolean myOffer = model.isMyOffer(offer);
|
||||||
|
|
||||||
if (tableRow != null) {
|
if (tableRow != null) {
|
||||||
canTakeOfferResult = model.offerFilter.canTakeOffer(offer, false);
|
canTakeOfferResult = model.offerFilterService.canTakeOffer(offer, false);
|
||||||
tableRow.setOpacity(canTakeOfferResult.isValid() || myOffer ? 1 : 0.4);
|
tableRow.setOpacity(canTakeOfferResult.isValid() || myOffer ? 1 : 0.4);
|
||||||
|
|
||||||
if (myOffer) {
|
if (myOffer) {
|
||||||
@ -1089,7 +1089,7 @@ public class OfferBookView extends ActivatableViewAndModel<GridPane, OfferBookVi
|
|||||||
|
|
||||||
if (!myOffer) {
|
if (!myOffer) {
|
||||||
if (canTakeOfferResult == null) {
|
if (canTakeOfferResult == null) {
|
||||||
canTakeOfferResult = model.offerFilter.canTakeOffer(offer, false);
|
canTakeOfferResult = model.offerFilterService.canTakeOffer(offer, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!canTakeOfferResult.isValid()) {
|
if (!canTakeOfferResult.isValid()) {
|
||||||
|
@ -38,7 +38,7 @@ import bisq.core.locale.TradeCurrency;
|
|||||||
import bisq.core.monetary.Price;
|
import bisq.core.monetary.Price;
|
||||||
import bisq.core.monetary.Volume;
|
import bisq.core.monetary.Volume;
|
||||||
import bisq.core.offer.Offer;
|
import bisq.core.offer.Offer;
|
||||||
import bisq.core.offer.OfferFilter;
|
import bisq.core.offer.OfferFilterService;
|
||||||
import bisq.core.offer.OpenOfferManager;
|
import bisq.core.offer.OpenOfferManager;
|
||||||
import bisq.core.offer.bisq_v1.OfferPayload;
|
import bisq.core.offer.bisq_v1.OfferPayload;
|
||||||
import bisq.core.payment.PaymentAccount;
|
import bisq.core.payment.PaymentAccount;
|
||||||
@ -106,7 +106,7 @@ class OfferBookViewModel extends ActivatableViewModel {
|
|||||||
final AccountAgeWitnessService accountAgeWitnessService;
|
final AccountAgeWitnessService accountAgeWitnessService;
|
||||||
private final Navigation navigation;
|
private final Navigation navigation;
|
||||||
private final PriceUtil priceUtil;
|
private final PriceUtil priceUtil;
|
||||||
final OfferFilter offerFilter;
|
final OfferFilterService offerFilterService;
|
||||||
private final CoinFormatter btcFormatter;
|
private final CoinFormatter btcFormatter;
|
||||||
private final BsqFormatter bsqFormatter;
|
private final BsqFormatter bsqFormatter;
|
||||||
|
|
||||||
@ -152,7 +152,7 @@ class OfferBookViewModel extends ActivatableViewModel {
|
|||||||
AccountAgeWitnessService accountAgeWitnessService,
|
AccountAgeWitnessService accountAgeWitnessService,
|
||||||
Navigation navigation,
|
Navigation navigation,
|
||||||
PriceUtil priceUtil,
|
PriceUtil priceUtil,
|
||||||
OfferFilter offerFilter,
|
OfferFilterService offerFilterService,
|
||||||
@Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter btcFormatter,
|
@Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter btcFormatter,
|
||||||
BsqFormatter bsqFormatter) {
|
BsqFormatter bsqFormatter) {
|
||||||
super();
|
super();
|
||||||
@ -168,7 +168,7 @@ class OfferBookViewModel extends ActivatableViewModel {
|
|||||||
this.accountAgeWitnessService = accountAgeWitnessService;
|
this.accountAgeWitnessService = accountAgeWitnessService;
|
||||||
this.navigation = navigation;
|
this.navigation = navigation;
|
||||||
this.priceUtil = priceUtil;
|
this.priceUtil = priceUtil;
|
||||||
this.offerFilter = offerFilter;
|
this.offerFilterService = offerFilterService;
|
||||||
this.btcFormatter = btcFormatter;
|
this.btcFormatter = btcFormatter;
|
||||||
this.bsqFormatter = bsqFormatter;
|
this.bsqFormatter = bsqFormatter;
|
||||||
|
|
||||||
@ -600,11 +600,11 @@ class OfferBookViewModel extends ActivatableViewModel {
|
|||||||
// This code duplicates code in the view at the button column. We need there the different results for
|
// This code duplicates code in the view at the button column. We need there the different results for
|
||||||
// display in popups so we cannot replace that with the predicate. Any change need to be applied in both
|
// display in popups so we cannot replace that with the predicate. Any change need to be applied in both
|
||||||
// places.
|
// places.
|
||||||
return offerBookListItem -> offerFilter.canTakeOffer(offerBookListItem.getOffer(), false).isValid();
|
return offerBookListItem -> offerFilterService.canTakeOffer(offerBookListItem.getOffer(), false).isValid();
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isOfferBanned(Offer offer) {
|
boolean isOfferBanned(Offer offer) {
|
||||||
return offerFilter.isOfferBanned(offer);
|
return offerFilterService.isOfferBanned(offer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isShowAllEntry(String id) {
|
private boolean isShowAllEntry(String id) {
|
||||||
|
Loading…
Reference in New Issue
Block a user