Refactor duplicate XMR subaddress popup code

This commit is contained in:
Alva Swanson 2025-02-05 19:53:09 +00:00
parent 5e04336c4d
commit 861f655ae7
No known key found for this signature in database
GPG key ID: 004760E77F753090
2 changed files with 12 additions and 14 deletions

View file

@ -204,12 +204,7 @@ public class XmrForm extends AssetsForm {
addLimitations(false);
addAccountNameTextFieldWithAutoFillToggleButton();
new Popup()
.headLine(Res.get("account.altcoin.popup.xmr.dataDirWarningHeadline"))
.backgroundInfo(Res.get("account.altcoin.popup.xmr.dataDirWarning"))
.dontShowAgainId("accountSubAddressInfo")
.width(700)
.show();
showXmrSubAddressPopup();
}
void setFieldManagement(boolean useSubAddresses) {
@ -369,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)) {

View file

@ -18,11 +18,10 @@
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;
@ -85,12 +84,7 @@ class AltCoinAccountsDataModel extends ActivatableDataModel {
.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();
XmrForm.showXmrSubAddressPopup();
}
});
}