Skip to content

Commit

Permalink
Merge pull request #3655 from lusarz/refactor-offer-view
Browse files Browse the repository at this point in the history
Refactor OfferView constructor
  • Loading branch information
ripcurlx authored Nov 22, 2019
2 parents cb2093a + 8917df9 commit c0108b8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import bisq.desktop.common.view.FxmlView;
import bisq.desktop.common.view.ViewLoader;

import bisq.core.offer.OfferPayload;
import bisq.core.support.dispute.arbitration.arbitrator.ArbitratorManager;
import bisq.core.user.Preferences;
import bisq.core.user.User;
Expand All @@ -44,7 +45,7 @@ public BuyOfferView(ViewLoader viewLoader,
preferences,
arbitratorManager,
user,
p2PService);
p2PService,
OfferPayload.Direction.BUY);
}
}

7 changes: 4 additions & 3 deletions desktop/src/main/java/bisq/desktop/main/offer/OfferView.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,14 @@ protected OfferView(ViewLoader viewLoader,
Preferences preferences,
ArbitratorManager arbitratorManager,
User user,
P2PService p2PService) {
P2PService p2PService,
OfferPayload.Direction direction) {
this.viewLoader = viewLoader;
this.navigation = navigation;
this.preferences = preferences;
this.user = user;
this.p2PService = p2PService;
this.direction = (this instanceof BuyOfferView) ? OfferPayload.Direction.BUY : OfferPayload.Direction.SELL;
this.direction = direction;
this.arbitratorManager = arbitratorManager;
}

Expand Down Expand Up @@ -133,7 +134,7 @@ else if (removedTabs.get(0).getContent().equals(takeOfferPane))

@Override
protected void activate() {
Optional<TradeCurrency> tradeCurrencyOptional = (this instanceof SellOfferView) ?
Optional<TradeCurrency> tradeCurrencyOptional = (this.direction == OfferPayload.Direction.SELL) ?
CurrencyUtil.getTradeCurrency(preferences.getSellScreenCurrencyCode()) :
CurrencyUtil.getTradeCurrency(preferences.getBuyScreenCurrencyCode());
tradeCurrency = tradeCurrencyOptional.orElseGet(GlobalSettings::getDefaultTradeCurrency);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import bisq.desktop.common.view.FxmlView;
import bisq.desktop.common.view.ViewLoader;

import bisq.core.offer.OfferPayload;
import bisq.core.support.dispute.arbitration.arbitrator.ArbitratorManager;
import bisq.core.user.Preferences;
import bisq.core.user.User;
Expand All @@ -44,7 +45,7 @@ public SellOfferView(ViewLoader viewLoader,
preferences,
arbitratorManager,
user,
p2PService);
p2PService,
OfferPayload.Direction.SELL);
}
}

0 comments on commit c0108b8

Please sign in to comment.