mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-28 17:15:14 +01:00
Show XMR subaddress popup if user has non-subaddress account
Before PR #7123, we showed the XMR subaddress popup whenever the user naviated to the account tab. After PR #7123, we show the XMR subaddress popup if the user has an XMR account. However, it's better show the popup if the user has a non-subaddress XMR account.
This commit is contained in:
parent
9f3e216fe1
commit
958661f25b
1 changed files with 28 additions and 8 deletions
|
@ -26,6 +26,7 @@ import bisq.core.locale.Res;
|
|||
import bisq.core.locale.TradeCurrency;
|
||||
import bisq.core.offer.OpenOfferManager;
|
||||
import bisq.core.payment.AssetAccount;
|
||||
import bisq.core.payment.CryptoCurrencyAccount;
|
||||
import bisq.core.payment.PaymentAccount;
|
||||
import bisq.core.trade.TradeManager;
|
||||
import bisq.core.user.Preferences;
|
||||
|
@ -44,6 +45,7 @@ import javafx.collections.SetChangeListener;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
class AltCoinAccountsDataModel extends ActivatableDataModel {
|
||||
|
@ -79,14 +81,17 @@ class AltCoinAccountsDataModel extends ActivatableDataModel {
|
|||
user.getPaymentAccountsAsObservable().addListener(setChangeListener);
|
||||
fillAndSortPaymentAccounts();
|
||||
|
||||
paymentAccounts.stream().filter(e -> e.getSingleTradeCurrency().getCode().equals("XMR"))
|
||||
.findAny().ifPresent(e -> {
|
||||
new Popup()
|
||||
.headLine(Res.get("account.altcoin.popup.xmr.dataDirWarningHeadline"))
|
||||
.backgroundInfo(Res.get("account.altcoin.popup.xmr.dataDirWarning"))
|
||||
.dontShowAgainId("accountSubAddressInfo")
|
||||
.width(700)
|
||||
.show();
|
||||
paymentAccounts.stream()
|
||||
.filter(e -> e.getSingleTradeCurrency().getCode().equals("XMR"))
|
||||
.forEach(e -> {
|
||||
if (!xmrAccountUsesSubAddresses(e)) {
|
||||
new Popup()
|
||||
.headLine(Res.get("account.altcoin.popup.xmr.dataDirWarningHeadline"))
|
||||
.backgroundInfo(Res.get("account.altcoin.popup.xmr.dataDirWarning"))
|
||||
.dontShowAgainId("accountSubAddressInfo")
|
||||
.width(700)
|
||||
.show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -99,6 +104,21 @@ class AltCoinAccountsDataModel extends ActivatableDataModel {
|
|||
}
|
||||
}
|
||||
|
||||
private boolean xmrAccountUsesSubAddresses(PaymentAccount paymentAccount) {
|
||||
if (paymentAccount instanceof CryptoCurrencyAccount) {
|
||||
CryptoCurrencyAccount account = (CryptoCurrencyAccount) paymentAccount;
|
||||
Map<String, String> extraData = account.getExtraData();
|
||||
if (extraData == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String useXMmrSubAddresses = extraData.get("UseXMmrSubAddresses");
|
||||
return useXMmrSubAddresses != null && useXMmrSubAddresses.equals("1");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void deactivate() {
|
||||
user.getPaymentAccountsAsObservable().removeListener(setChangeListener);
|
||||
|
|
Loading…
Add table
Reference in a new issue