Use isAsset flag for warning

This commit is contained in:
Manfred Karrer 2016-06-04 12:33:13 +02:00
parent 0eb7e859bd
commit e5ff7606a2
2 changed files with 12 additions and 2 deletions

View File

@ -22,13 +22,22 @@ import io.bitsquare.app.Version;
public final class CryptoCurrency extends TradeCurrency {
// That object is saved to disc. We need to take care of changes to not break deserialization.
private static final long serialVersionUID = Version.LOCAL_DB_VERSION;
private boolean isAsset;
public CryptoCurrency(String currencyCode, String name) {
this(currencyCode, name, false);
}
public CryptoCurrency(String currencyCode, String name, boolean isAsset) {
super(currencyCode, name);
this.isAsset = isAsset;
}
public CryptoCurrency(String currencyCode, String name, String symbol) {
super(currencyCode, name, symbol);
}
public boolean isAsset() {
return isAsset;
}
}

View File

@ -30,6 +30,7 @@ import io.bitsquare.gui.util.FormBuilder;
import io.bitsquare.gui.util.ImageUtil;
import io.bitsquare.gui.util.Layout;
import io.bitsquare.gui.util.validation.*;
import io.bitsquare.locale.CryptoCurrency;
import io.bitsquare.locale.TradeCurrency;
import io.bitsquare.payment.PaymentAccount;
import io.bitsquare.payment.PaymentAccountFactory;
@ -126,7 +127,7 @@ public class AltCoinAccountsView extends ActivatableViewAndModel<GridPane, AltCo
private void onSaveNewAccount(PaymentAccount paymentAccount) {
TradeCurrency selectedTradeCurrency = paymentAccount.getSelectedTradeCurrency();
String code = selectedTradeCurrency.getCode();
if (code.equals("MKR") || code.equals("DAO")) {
if (selectedTradeCurrency instanceof CryptoCurrency && ((CryptoCurrency) selectedTradeCurrency).isAsset()) {
new Popup().information("Please be sure that you follow the requirements for the usage of " +
selectedTradeCurrency.getCodeAndName() + " wallets as described on the " +
selectedTradeCurrency.getName() + " web page.\n" +
@ -158,7 +159,7 @@ public class AltCoinAccountsView extends ActivatableViewAndModel<GridPane, AltCo
.closeButtonText("I understand")
.show();
}
if (!model.getPaymentAccounts().stream().filter(e -> {
if (e.getAccountName() != null)
return e.getAccountName().equals(paymentAccount.getAccountName());