Rename OfferFilter to OfferFilterService

This commit is contained in:
chimp1984 2021-10-19 21:22:12 +02:00
parent 7197b316fc
commit 1b4c4871c0
No known key found for this signature in database
GPG Key ID: 9801B4EC591F90E3
4 changed files with 22 additions and 22 deletions

View File

@ -21,7 +21,7 @@ import bisq.core.monetary.Altcoin;
import bisq.core.monetary.Price;
import bisq.core.offer.Offer;
import bisq.core.offer.OfferBookService;
import bisq.core.offer.OfferFilter;
import bisq.core.offer.OfferFilterService;
import bisq.core.offer.OfferUtil;
import bisq.core.offer.OpenOffer;
import bisq.core.offer.OpenOfferManager;
@ -85,7 +85,7 @@ class CoreOffersService {
private final CoreWalletsService coreWalletsService;
private final CreateOfferService createOfferService;
private final OfferBookService offerBookService;
private final OfferFilter offerFilter;
private final OfferFilterService offerFilterService;
private final OpenOfferManager openOfferManager;
private final OfferUtil offerUtil;
private final PriceFeedService priceFeedService;
@ -97,7 +97,7 @@ class CoreOffersService {
CoreWalletsService coreWalletsService,
CreateOfferService createOfferService,
OfferBookService offerBookService,
OfferFilter offerFilter,
OfferFilterService offerFilterService,
OpenOfferManager openOfferManager,
OfferUtil offerUtil,
PriceFeedService priceFeedService,
@ -107,7 +107,7 @@ class CoreOffersService {
this.coreWalletsService = coreWalletsService;
this.createOfferService = createOfferService;
this.offerBookService = offerBookService;
this.offerFilter = offerFilter;
this.offerFilterService = offerFilterService;
this.openOfferManager = openOfferManager;
this.offerUtil = offerUtil;
this.priceFeedService = priceFeedService;
@ -118,7 +118,7 @@ class CoreOffersService {
return offerBookService.getOffers().stream()
.filter(o -> o.getId().equals(id))
.filter(o -> !o.isMyOffer(keyRing))
.filter(o -> offerFilter.canTakeOffer(o, coreContext.isApiUser()).isValid())
.filter(o -> offerFilterService.canTakeOffer(o, coreContext.isApiUser()).isValid())
.findAny().orElseThrow(() ->
new IllegalStateException(format("offer with id '%s' not found", id)));
}
@ -135,7 +135,7 @@ class CoreOffersService {
return offerBookService.getOffers().stream()
.filter(o -> !o.isMyOffer(keyRing))
.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))
.collect(Collectors.toList());
}

View File

@ -43,7 +43,7 @@ import lombok.extern.slf4j.Slf4j;
@Slf4j
@Singleton
public class OfferFilter {
public class OfferFilterService {
private final User user;
private final Preferences preferences;
private final FilterManager filterManager;
@ -52,10 +52,10 @@ public class OfferFilter {
private final Map<String, Boolean> myInsufficientTradeLimitCache = new HashMap<>();
@Inject
public OfferFilter(User user,
Preferences preferences,
FilterManager filterManager,
AccountAgeWitnessService accountAgeWitnessService) {
public OfferFilterService(User user,
Preferences preferences,
FilterManager filterManager,
AccountAgeWitnessService accountAgeWitnessService) {
this.user = user;
this.preferences = preferences;
this.filterManager = filterManager;

View File

@ -53,7 +53,7 @@ import bisq.core.locale.Res;
import bisq.core.locale.TradeCurrency;
import bisq.core.monetary.Price;
import bisq.core.offer.Offer;
import bisq.core.offer.OfferFilter;
import bisq.core.offer.OfferFilterService;
import bisq.core.offer.OfferRestrictions;
import bisq.core.offer.bisq_v1.OfferPayload;
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) {
case VALID:
break;
@ -1021,7 +1021,7 @@ public class OfferBookView extends ActivatableViewAndModel<GridPane, OfferBookVi
return new TableCell<>() {
final ImageView iconView = new ImageView();
final AutoTooltipButton button = new AutoTooltipButton();
OfferFilter.Result canTakeOfferResult = null;
OfferFilterService.Result canTakeOfferResult = null;
{
button.setGraphic(iconView);
@ -1040,7 +1040,7 @@ public class OfferBookView extends ActivatableViewAndModel<GridPane, OfferBookVi
boolean myOffer = model.isMyOffer(offer);
if (tableRow != null) {
canTakeOfferResult = model.offerFilter.canTakeOffer(offer, false);
canTakeOfferResult = model.offerFilterService.canTakeOffer(offer, false);
tableRow.setOpacity(canTakeOfferResult.isValid() || myOffer ? 1 : 0.4);
if (myOffer) {
@ -1089,7 +1089,7 @@ public class OfferBookView extends ActivatableViewAndModel<GridPane, OfferBookVi
if (!myOffer) {
if (canTakeOfferResult == null) {
canTakeOfferResult = model.offerFilter.canTakeOffer(offer, false);
canTakeOfferResult = model.offerFilterService.canTakeOffer(offer, false);
}
if (!canTakeOfferResult.isValid()) {

View File

@ -38,7 +38,7 @@ import bisq.core.locale.TradeCurrency;
import bisq.core.monetary.Price;
import bisq.core.monetary.Volume;
import bisq.core.offer.Offer;
import bisq.core.offer.OfferFilter;
import bisq.core.offer.OfferFilterService;
import bisq.core.offer.OpenOfferManager;
import bisq.core.offer.bisq_v1.OfferPayload;
import bisq.core.payment.PaymentAccount;
@ -106,7 +106,7 @@ class OfferBookViewModel extends ActivatableViewModel {
final AccountAgeWitnessService accountAgeWitnessService;
private final Navigation navigation;
private final PriceUtil priceUtil;
final OfferFilter offerFilter;
final OfferFilterService offerFilterService;
private final CoinFormatter btcFormatter;
private final BsqFormatter bsqFormatter;
@ -152,7 +152,7 @@ class OfferBookViewModel extends ActivatableViewModel {
AccountAgeWitnessService accountAgeWitnessService,
Navigation navigation,
PriceUtil priceUtil,
OfferFilter offerFilter,
OfferFilterService offerFilterService,
@Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter btcFormatter,
BsqFormatter bsqFormatter) {
super();
@ -168,7 +168,7 @@ class OfferBookViewModel extends ActivatableViewModel {
this.accountAgeWitnessService = accountAgeWitnessService;
this.navigation = navigation;
this.priceUtil = priceUtil;
this.offerFilter = offerFilter;
this.offerFilterService = offerFilterService;
this.btcFormatter = btcFormatter;
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
// display in popups so we cannot replace that with the predicate. Any change need to be applied in both
// places.
return offerBookListItem -> offerFilter.canTakeOffer(offerBookListItem.getOffer(), false).isValid();
return offerBookListItem -> offerFilterService.canTakeOffer(offerBookListItem.getOffer(), false).isValid();
}
boolean isOfferBanned(Offer offer) {
return offerFilter.isOfferBanned(offer);
return offerFilterService.isOfferBanned(offer);
}
private boolean isShowAllEntry(String id) {