Skip to content

Commit

Permalink
Use BSQ Swap as default when BSQ offer is created
Browse files Browse the repository at this point in the history
  • Loading branch information
ripcurlx committed Apr 11, 2022
1 parent 5b67766 commit 1712f74
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions desktop/src/main/java/bisq/desktop/main/offer/OfferView.java
Original file line number Diff line number Diff line change
Expand Up @@ -291,12 +291,15 @@ private void loadCreateViewClass(OfferBookView<?, ?> offerBookView,
return;
}

View view = viewLoader.load(paymentMethod != null && paymentMethod.isBsqSwap() ? BsqSwapCreateOfferView.class : childViewClass);
View view;
// CreateOffer and TakeOffer must not be cached by ViewLoader as we cannot use a view multiple times
// in different graphs
if (paymentMethod != null && paymentMethod.isBsqSwap()) {
if ((paymentMethod != null && paymentMethod.isBsqSwap()) ||
(paymentMethod == null && viewClass.isAssignableFrom(BsqOfferBookView.class))) {
view = viewLoader.load(BsqSwapCreateOfferView.class);
((BsqSwapCreateOfferView) view).initWithData(direction, offerActionHandler, payload);
} else {
view = viewLoader.load(childViewClass);
((CreateOfferView) view).initWithData(direction, tradeCurrency, offerActionHandler);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ else if (!showAllEntry) {

abstract void saveSelectedCurrencyCodeInPreferences(OfferDirection direction, String code);

void onSetPaymentMethod(PaymentMethod paymentMethod) {
protected void onSetPaymentMethod(PaymentMethod paymentMethod) {
if (paymentMethod == null)
return;

Expand Down Expand Up @@ -613,7 +613,7 @@ private boolean isEditEntry(String id) {
return id.equals(GUIUtil.EDIT_FLAG);
}

int getNumTrades(Offer offer) {
public int getNumTrades(Offer offer) {
return Stream.concat(closedTradableManager.getTradableList().stream(), bsqSwapTradeManager.getTradableList().stream())
.filter(e -> e instanceof Trade || e instanceof BsqSwapTrade) // weed out canceled offers
.filter(e -> {
Expand Down

0 comments on commit 1712f74

Please sign in to comment.