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

Fix select currency issues after edit offer #1578

Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
public abstract class EditableOfferDataModel extends OfferDataModel implements BsqBalanceListener {
protected final OpenOfferManager openOfferManager;
private final BsqWalletService bsqWalletService;
private final Preferences preferences;
protected final Preferences preferences;
protected final User user;
private final KeyRing keyRing;
private final P2PService p2PService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,21 @@ class EditOpenOfferDataModel extends EditableOfferDataModel {
private OpenOffer.State initialState;

@Inject
EditOpenOfferDataModel(OpenOfferManager openOfferManager, BtcWalletService btcWalletService, BsqWalletService bsqWalletService, Preferences preferences, User user, KeyRing keyRing, P2PService p2PService, PriceFeedService priceFeedService, FilterManager filterManager, AccountAgeWitnessService accountAgeWitnessService, TradeWalletService tradeWalletService, FeeService feeService, BSFormatter formatter) {
super(openOfferManager, btcWalletService, bsqWalletService, preferences, user, keyRing, p2PService, priceFeedService, filterManager, accountAgeWitnessService, tradeWalletService, feeService, formatter);
EditOpenOfferDataModel(OpenOfferManager openOfferManager, BtcWalletService btcWalletService,
BsqWalletService bsqWalletService, Preferences preferences, User user, KeyRing keyRing,
P2PService p2PService, PriceFeedService priceFeedService, FilterManager filterManager,
AccountAgeWitnessService accountAgeWitnessService, TradeWalletService tradeWalletService,
FeeService feeService, BSFormatter formatter) {
super(openOfferManager, btcWalletService, bsqWalletService, preferences, user, keyRing, p2PService,
priceFeedService, filterManager, accountAgeWitnessService, tradeWalletService, feeService, formatter);
}

public void initWithData(OpenOffer openOffer) {
this.openOffer = openOffer;
this.initialState = openOffer.getState();
this.paymentAccount = user.getPaymentAccount(openOffer.getOffer().getMakerPaymentAccountId());
// select the current offer payment account as default payment account
preferences.setSelectedPaymentAccountForCreateOffer(paymentAccount);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that needed in the base class or should that be only called in the createOffer sub class? If so, maybe better to overwrite initWithData there.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually this is already the edit offer sub class. The naming of the method is misleading, I'll rename it to a generic one.


this.allowAmountUpdate = false;
}
Expand Down