Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor OfferView constructor #3655

Merged
merged 1 commit into from
Nov 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}
}