mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-06-27 08:10:45 -04:00
Use dev seed nodes, move code to data model
This commit is contained in:
parent
dcd1f8636a
commit
bb625ad036
3 changed files with 27 additions and 25 deletions
|
@ -19,28 +19,35 @@ package io.bitsquare.gui.main.account.content.altcoinaccounts;
|
||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import io.bitsquare.gui.common.model.ActivatableDataModel;
|
import io.bitsquare.gui.common.model.ActivatableDataModel;
|
||||||
|
import io.bitsquare.locale.CryptoCurrency;
|
||||||
|
import io.bitsquare.locale.FiatCurrency;
|
||||||
|
import io.bitsquare.locale.TradeCurrency;
|
||||||
import io.bitsquare.payment.PaymentAccount;
|
import io.bitsquare.payment.PaymentAccount;
|
||||||
import io.bitsquare.payment.PaymentMethod;
|
import io.bitsquare.payment.PaymentMethod;
|
||||||
import io.bitsquare.trade.TradeManager;
|
import io.bitsquare.trade.TradeManager;
|
||||||
import io.bitsquare.trade.offer.OpenOfferManager;
|
import io.bitsquare.trade.offer.OpenOfferManager;
|
||||||
|
import io.bitsquare.user.Preferences;
|
||||||
import io.bitsquare.user.User;
|
import io.bitsquare.user.User;
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
import javafx.collections.SetChangeListener;
|
import javafx.collections.SetChangeListener;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
class AltCoinAccountsDataModel extends ActivatableDataModel {
|
class AltCoinAccountsDataModel extends ActivatableDataModel {
|
||||||
|
|
||||||
private final User user;
|
private final User user;
|
||||||
|
private Preferences preferences;
|
||||||
private final OpenOfferManager openOfferManager;
|
private final OpenOfferManager openOfferManager;
|
||||||
private final TradeManager tradeManager;
|
private final TradeManager tradeManager;
|
||||||
final ObservableList<PaymentAccount> paymentAccounts = FXCollections.observableArrayList();
|
final ObservableList<PaymentAccount> paymentAccounts = FXCollections.observableArrayList();
|
||||||
private final SetChangeListener<PaymentAccount> setChangeListener;
|
private final SetChangeListener<PaymentAccount> setChangeListener;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public AltCoinAccountsDataModel(User user, OpenOfferManager openOfferManager, TradeManager tradeManager) {
|
public AltCoinAccountsDataModel(User user, Preferences preferences, OpenOfferManager openOfferManager, TradeManager tradeManager) {
|
||||||
this.user = user;
|
this.user = user;
|
||||||
|
this.preferences = preferences;
|
||||||
this.openOfferManager = openOfferManager;
|
this.openOfferManager = openOfferManager;
|
||||||
this.tradeManager = tradeManager;
|
this.tradeManager = tradeManager;
|
||||||
setChangeListener = change -> fillAndSortPaymentAccounts();
|
setChangeListener = change -> fillAndSortPaymentAccounts();
|
||||||
|
@ -71,6 +78,21 @@ class AltCoinAccountsDataModel extends ActivatableDataModel {
|
||||||
|
|
||||||
public void onSaveNewAccount(PaymentAccount paymentAccount) {
|
public void onSaveNewAccount(PaymentAccount paymentAccount) {
|
||||||
user.addPaymentAccount(paymentAccount);
|
user.addPaymentAccount(paymentAccount);
|
||||||
|
TradeCurrency singleTradeCurrency = paymentAccount.getSingleTradeCurrency();
|
||||||
|
List<TradeCurrency> tradeCurrencies = paymentAccount.getTradeCurrencies();
|
||||||
|
if (singleTradeCurrency != null) {
|
||||||
|
if (singleTradeCurrency instanceof FiatCurrency)
|
||||||
|
preferences.addFiatCurrency((FiatCurrency) singleTradeCurrency);
|
||||||
|
else
|
||||||
|
preferences.addCryptoCurrency((CryptoCurrency) singleTradeCurrency);
|
||||||
|
} else if (tradeCurrencies != null && !tradeCurrencies.isEmpty()) {
|
||||||
|
tradeCurrencies.stream().forEach(tradeCurrency -> {
|
||||||
|
if (tradeCurrency instanceof FiatCurrency)
|
||||||
|
preferences.addFiatCurrency((FiatCurrency) tradeCurrency);
|
||||||
|
else
|
||||||
|
preferences.addCryptoCurrency((CryptoCurrency) tradeCurrency);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -20,15 +20,10 @@ package io.bitsquare.gui.main.account.content.altcoinaccounts;
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import io.bitsquare.gui.common.model.ActivatableWithDataModel;
|
import io.bitsquare.gui.common.model.ActivatableWithDataModel;
|
||||||
import io.bitsquare.gui.common.model.ViewModel;
|
import io.bitsquare.gui.common.model.ViewModel;
|
||||||
import io.bitsquare.locale.CryptoCurrency;
|
|
||||||
import io.bitsquare.locale.FiatCurrency;
|
|
||||||
import io.bitsquare.locale.TradeCurrency;
|
|
||||||
import io.bitsquare.payment.PaymentAccount;
|
import io.bitsquare.payment.PaymentAccount;
|
||||||
import io.bitsquare.user.Preferences;
|
import io.bitsquare.user.Preferences;
|
||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
class AltCoinAccountsViewModel extends ActivatableWithDataModel<AltCoinAccountsDataModel> implements ViewModel {
|
class AltCoinAccountsViewModel extends ActivatableWithDataModel<AltCoinAccountsDataModel> implements ViewModel {
|
||||||
|
|
||||||
|
|
||||||
|
@ -55,21 +50,6 @@ class AltCoinAccountsViewModel extends ActivatableWithDataModel<AltCoinAccountsD
|
||||||
|
|
||||||
public void onSaveNewAccount(PaymentAccount paymentAccount) {
|
public void onSaveNewAccount(PaymentAccount paymentAccount) {
|
||||||
dataModel.onSaveNewAccount(paymentAccount);
|
dataModel.onSaveNewAccount(paymentAccount);
|
||||||
TradeCurrency singleTradeCurrency = paymentAccount.getSingleTradeCurrency();
|
|
||||||
List<TradeCurrency> tradeCurrencies = paymentAccount.getTradeCurrencies();
|
|
||||||
if (singleTradeCurrency != null) {
|
|
||||||
if (singleTradeCurrency instanceof FiatCurrency)
|
|
||||||
preferences.addFiatCurrency((FiatCurrency) singleTradeCurrency);
|
|
||||||
else
|
|
||||||
preferences.addCryptoCurrency((CryptoCurrency) singleTradeCurrency);
|
|
||||||
} else if (tradeCurrencies != null && !tradeCurrencies.isEmpty()) {
|
|
||||||
tradeCurrencies.stream().forEach(tradeCurrency -> {
|
|
||||||
if (tradeCurrency instanceof FiatCurrency)
|
|
||||||
preferences.addFiatCurrency((FiatCurrency) tradeCurrency);
|
|
||||||
else
|
|
||||||
preferences.addCryptoCurrency((CryptoCurrency) tradeCurrency);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onDeleteAccount(PaymentAccount paymentAccount) {
|
public boolean onDeleteAccount(PaymentAccount paymentAccount) {
|
||||||
|
|
|
@ -32,15 +32,15 @@ public class SeedNodesRepository {
|
||||||
new NodeAddress("izs5oz7i5ta7c2ir.onion:8000"),*/
|
new NodeAddress("izs5oz7i5ta7c2ir.onion:8000"),*/
|
||||||
|
|
||||||
// v0.3.5
|
// v0.3.5
|
||||||
new NodeAddress("hulvbm5xjn7b7ku4.onion:8000"),
|
/* new NodeAddress("hulvbm5xjn7b7ku4.onion:8000"),
|
||||||
new NodeAddress("3efgjjbdvhbvck3x.onion:8000"),
|
new NodeAddress("3efgjjbdvhbvck3x.onion:8000"),
|
||||||
new NodeAddress("3unfcshgwipxhxfm.onion:8000"),
|
new NodeAddress("3unfcshgwipxhxfm.onion:8000"),*/
|
||||||
|
|
||||||
|
|
||||||
// v0.3.6
|
// v0.3.6
|
||||||
/* new NodeAddress("ybmi4iaesugslxrw.onion:8000"),
|
new NodeAddress("ybmi4iaesugslxrw.onion:8000"),
|
||||||
new NodeAddress("ufwnvo775jfnjeux.onion:8000"),
|
new NodeAddress("ufwnvo775jfnjeux.onion:8000"),
|
||||||
new NodeAddress("b66vnevaljo6xt5a.onion:8000"),*/
|
new NodeAddress("b66vnevaljo6xt5a.onion:8000"),
|
||||||
|
|
||||||
// testnet
|
// testnet
|
||||||
new NodeAddress("znmy44wcstn2rkva.onion:8001"),
|
new NodeAddress("znmy44wcstn2rkva.onion:8001"),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue