mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 09:52:23 +01:00
Filter out the BSQ swap payment method from dropdown on edit/duplicate offer view
This commit is contained in:
parent
ae2a12110a
commit
d4bbb4f5fc
@ -627,19 +627,11 @@ public abstract class MutableOfferDataModel extends OfferDataModel implements Bs
|
||||
}
|
||||
|
||||
private void fillPaymentAccounts() {
|
||||
paymentAccounts.setAll(new HashSet<>(getUserPaymentAccounts()));
|
||||
paymentAccounts.setAll(getUserPaymentAccounts());
|
||||
paymentAccounts.sort(comparing(PaymentAccount::getAccountName));
|
||||
}
|
||||
|
||||
private Set<PaymentAccount> getUserPaymentAccounts() {
|
||||
return Objects.requireNonNull(user.getPaymentAccounts()).stream()
|
||||
.filter(this::isNotBsqSwapOrDaoActivated)
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
private boolean isNotBsqSwapOrDaoActivated(PaymentAccount paymentAccount) {
|
||||
return !paymentAccount.getPaymentMethod().isBsqSwap() || DevEnv.isDaoActivated();
|
||||
}
|
||||
protected abstract Set<PaymentAccount> getUserPaymentAccounts();
|
||||
|
||||
protected void setAmount(Coin amount) {
|
||||
this.amount.set(amount);
|
||||
|
@ -30,6 +30,7 @@ import bisq.core.btc.wallet.BtcWalletService;
|
||||
import bisq.core.offer.OfferUtil;
|
||||
import bisq.core.offer.OpenOfferManager;
|
||||
import bisq.core.offer.bisq_v1.CreateOfferService;
|
||||
import bisq.core.payment.PaymentAccount;
|
||||
import bisq.core.provider.fee.FeeService;
|
||||
import bisq.core.provider.price.PriceFeedService;
|
||||
import bisq.core.trade.statistics.TradeStatisticsManager;
|
||||
@ -40,10 +41,16 @@ import bisq.core.util.coin.CoinFormatter;
|
||||
|
||||
import bisq.network.p2p.P2PService;
|
||||
|
||||
import bisq.common.app.DevEnv;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
||||
import javax.inject.Named;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Domain for that UI element.
|
||||
* Note that the create offer domain has a deeper scope in the application domain (TradeManager).
|
||||
@ -81,4 +88,11 @@ class CreateOfferDataModel extends MutableOfferDataModel {
|
||||
tradeStatisticsManager,
|
||||
navigation);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Set<PaymentAccount> getUserPaymentAccounts() {
|
||||
return Objects.requireNonNull(user.getPaymentAccounts()).stream()
|
||||
.filter(account -> !account.getPaymentMethod().isBsqSwap() || DevEnv.isDaoActivated())
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
}
|
||||
|
@ -50,7 +50,10 @@ import com.google.inject.Inject;
|
||||
|
||||
import javax.inject.Named;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
class DuplicateOfferDataModel extends MutableOfferDataModel {
|
||||
|
||||
@ -111,6 +114,13 @@ class DuplicateOfferDataModel extends MutableOfferDataModel {
|
||||
Restrictions.getMaxBuyerSecurityDepositAsPercent());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Set<PaymentAccount> getUserPaymentAccounts() {
|
||||
return Objects.requireNonNull(user.getPaymentAccounts()).stream()
|
||||
.filter(account -> !account.getPaymentMethod().isBsqSwap())
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PaymentAccount getPreselectedPaymentAccount() {
|
||||
// If trade currency is BSQ don't use the BSQ swap payment account as it will automatically
|
||||
|
@ -55,7 +55,10 @@ import com.google.inject.Inject;
|
||||
|
||||
import javax.inject.Named;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
class EditOfferDataModel extends MutableOfferDataModel {
|
||||
|
||||
@ -159,6 +162,13 @@ class EditOfferDataModel extends MutableOfferDataModel {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Set<PaymentAccount> getUserPaymentAccounts() {
|
||||
return Objects.requireNonNull(user.getPaymentAccounts()).stream()
|
||||
.filter(account -> !account.getPaymentMethod().isBsqSwap())
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PaymentAccount getPreselectedPaymentAccount() {
|
||||
return paymentAccount;
|
||||
|
Loading…
Reference in New Issue
Block a user