mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-28 17:15:14 +01:00
Merge pull request #7378 from alvasw/Improve_XMR_subaddress_popup_behaviour
Improve XMR subaddress popup behaviour
This commit is contained in:
commit
b8fcb90e8c
2 changed files with 35 additions and 10 deletions
|
@ -203,6 +203,8 @@ public class XmrForm extends AssetsForm {
|
|||
setFieldManagement(xmrAccountDelegate.isUsingSubAddresses());
|
||||
addLimitations(false);
|
||||
addAccountNameTextFieldWithAutoFillToggleButton();
|
||||
|
||||
showXmrSubAddressPopup();
|
||||
}
|
||||
|
||||
void setFieldManagement(boolean useSubAddresses) {
|
||||
|
@ -362,6 +364,15 @@ public class XmrForm extends AssetsForm {
|
|||
}
|
||||
}
|
||||
|
||||
public static void showXmrSubAddressPopup() {
|
||||
new Popup()
|
||||
.headLine(Res.get("account.altcoin.popup.xmr.dataDirWarningHeadline"))
|
||||
.backgroundInfo(Res.get("account.altcoin.popup.xmr.dataDirWarning"))
|
||||
.dontShowAgainId("accountSubAddressInfo")
|
||||
.width(700)
|
||||
.show();
|
||||
}
|
||||
|
||||
private void maybeShowXmrSubAddressInfo() {
|
||||
String key = "xmrSubAddressInfo";
|
||||
if (DontShowAgainLookup.showAgain(key)) {
|
||||
|
|
|
@ -18,14 +18,14 @@
|
|||
package bisq.desktop.main.account.content.altcoinaccounts;
|
||||
|
||||
import bisq.desktop.common.model.ActivatableDataModel;
|
||||
import bisq.desktop.main.overlays.popups.Popup;
|
||||
import bisq.desktop.components.paymentmethods.XmrForm;
|
||||
import bisq.desktop.util.GUIUtil;
|
||||
|
||||
import bisq.core.locale.CryptoCurrency;
|
||||
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 +44,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 +80,12 @@ 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)) {
|
||||
XmrForm.showXmrSubAddressPopup();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -99,6 +98,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