mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 01:41:11 +01:00
Merge pull request #3655 from lusarz/refactor-offer-view
Refactor OfferView constructor
This commit is contained in:
commit
c0108b83af
@ -21,6 +21,7 @@ import bisq.desktop.Navigation;
|
||||
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;
|
||||
@ -44,7 +45,7 @@ public class BuyOfferView extends OfferView {
|
||||
preferences,
|
||||
arbitratorManager,
|
||||
user,
|
||||
p2PService);
|
||||
p2PService,
|
||||
OfferPayload.Direction.BUY);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -83,13 +83,14 @@ public abstract class OfferView extends ActivatableView<TabPane, Void> {
|
||||
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;
|
||||
}
|
||||
|
||||
@ -133,7 +134,7 @@ public abstract class OfferView extends ActivatableView<TabPane, Void> {
|
||||
|
||||
@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);
|
||||
|
@ -21,6 +21,7 @@ import bisq.desktop.Navigation;
|
||||
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;
|
||||
@ -44,7 +45,7 @@ public class SellOfferView extends OfferView {
|
||||
preferences,
|
||||
arbitratorManager,
|
||||
user,
|
||||
p2PService);
|
||||
p2PService,
|
||||
OfferPayload.Direction.SELL);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user