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

Set default payment account for an edited offer to null #1583

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 @@ -89,6 +89,8 @@
import java.util.Optional;
import java.util.UUID;

import javax.annotation.Nullable;

import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;

Expand Down Expand Up @@ -245,7 +247,9 @@ public boolean initWithData(OfferPayload.Direction direction, TradeCurrency trad
fillPaymentAccounts();

PaymentAccount account;
PaymentAccount lastSelectedPaymentAccount = preferences.getSelectedPaymentAccountForCreateOffer();

@Nullable
PaymentAccount lastSelectedPaymentAccount = getPreselectedPaymentAccount();
if (lastSelectedPaymentAccount != null &&
user.getPaymentAccounts() != null &&
user.getPaymentAccounts().contains(lastSelectedPaymentAccount)) {
Expand Down Expand Up @@ -286,6 +290,10 @@ public boolean initWithData(OfferPayload.Direction direction, TradeCurrency trad
return true;
}

protected PaymentAccount getPreselectedPaymentAccount() {
return preferences.getSelectedPaymentAccountForCreateOffer();
}

void onTabSelected(boolean isSelected) {
this.isTabSelected = isSelected;
if (isTabSelected)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import bisq.core.offer.OpenOffer;
import bisq.core.offer.OpenOfferManager;
import bisq.core.payment.AccountAgeWitnessService;
import bisq.core.payment.PaymentAccount;
import bisq.core.provider.fee.FeeService;
import bisq.core.provider.price.PriceFeedService;
import bisq.core.user.Preferences;
Expand Down Expand Up @@ -61,6 +62,11 @@ public void initWithData(OpenOffer openOffer) {
this.allowAmountUpdate = false;
}

@Override
protected PaymentAccount getPreselectedPaymentAccount() {
return null;
}

public void populateData() {
Offer offer = openOffer.getOffer();

Expand Down