mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-04-18 14:55:53 -04:00
Remove registration for alpha version #303
This commit is contained in:
parent
daea94c178
commit
f903491abb
@ -83,17 +83,19 @@ public class MainView extends InitializableView<StackPane, MainViewModel> {
|
||||
@Override
|
||||
protected void initialize() {
|
||||
ToggleButton homeButton = new NavButton(HomeView.class, "Overview") {{
|
||||
setDisable(true); // during irc demo
|
||||
setDisable(true); // alpha
|
||||
}};
|
||||
ToggleButton buyButton = new NavButton(BuyView.class, "Buy BTC");
|
||||
ToggleButton sellButton = new NavButton(SellView.class, "Sell BTC");
|
||||
ToggleButton portfolioButton = new NavButton(PortfolioView.class, "Portfolio");
|
||||
ToggleButton fundsButton = new NavButton(FundsView.class, "Funds");
|
||||
ToggleButton msgButton = new NavButton(MsgView.class, "Messages") {{
|
||||
setDisable(true); // during irc demo
|
||||
setDisable(true); // alpha
|
||||
}};
|
||||
ToggleButton settingsButton = new NavButton(SettingsView.class, "Settings");
|
||||
ToggleButton accountButton = new NavButton(AccountView.class, "Account");
|
||||
ToggleButton accountButton = new NavButton(AccountView.class, "Account") {{
|
||||
setDisable(true); // alpha
|
||||
}};
|
||||
Pane portfolioButtonHolder = new Pane(portfolioButton);
|
||||
Pane bankAccountComboBoxHolder = new Pane();
|
||||
|
||||
@ -312,6 +314,9 @@ public class MainView extends InitializableView<StackPane, MainViewModel> {
|
||||
vBox.setAlignment(Pos.CENTER);
|
||||
vBox.getChildren().setAll(comboBox, titleLabel);
|
||||
|
||||
// For alpha
|
||||
vBox.setDisable(true);
|
||||
|
||||
return vBox;
|
||||
}
|
||||
|
||||
|
@ -17,20 +17,36 @@
|
||||
|
||||
package io.bitsquare.gui.main;
|
||||
|
||||
import io.bitsquare.account.AccountSettings;
|
||||
import io.bitsquare.arbitrator.Arbitrator;
|
||||
import io.bitsquare.arbitrator.Reputation;
|
||||
import io.bitsquare.bank.BankAccount;
|
||||
import io.bitsquare.bank.BankAccountType;
|
||||
import io.bitsquare.btc.BitcoinNetwork;
|
||||
import io.bitsquare.btc.WalletService;
|
||||
import io.bitsquare.gui.components.Popups;
|
||||
import io.bitsquare.gui.util.BSFormatter;
|
||||
import io.bitsquare.locale.CountryUtil;
|
||||
import io.bitsquare.locale.LanguageUtil;
|
||||
import io.bitsquare.msg.MessageService;
|
||||
import io.bitsquare.network.BootstrapState;
|
||||
import io.bitsquare.persistence.Persistence;
|
||||
import io.bitsquare.trade.Trade;
|
||||
import io.bitsquare.trade.TradeManager;
|
||||
import io.bitsquare.user.User;
|
||||
import io.bitsquare.util.DSAKeyUtil;
|
||||
|
||||
import org.bitcoinj.core.Coin;
|
||||
import org.bitcoinj.core.ECKey;
|
||||
import org.bitcoinj.core.Utils;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Currency;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import viewfx.model.ViewModel;
|
||||
|
||||
import javafx.application.Platform;
|
||||
@ -88,17 +104,20 @@ class MainViewModel implements ViewModel {
|
||||
private final MessageService messageService;
|
||||
private final TradeManager tradeManager;
|
||||
private final BSFormatter formatter;
|
||||
|
||||
private Persistence persistence;
|
||||
private AccountSettings accountSettings;
|
||||
|
||||
@Inject
|
||||
public MainViewModel(User user, WalletService walletService, MessageService messageService,
|
||||
TradeManager tradeManager, BitcoinNetwork bitcoinNetwork, BSFormatter formatter,
|
||||
Persistence persistence) {
|
||||
Persistence persistence, AccountSettings accountSettings) {
|
||||
this.user = user;
|
||||
this.walletService = walletService;
|
||||
this.messageService = messageService;
|
||||
this.tradeManager = tradeManager;
|
||||
this.formatter = formatter;
|
||||
this.persistence = persistence;
|
||||
this.accountSettings = accountSettings;
|
||||
|
||||
bitcoinNetworkAsString = bitcoinNetwork.toString();
|
||||
|
||||
@ -204,6 +223,27 @@ class MainViewModel implements ViewModel {
|
||||
(MapChangeListener<String, Trade>) change -> updateNumPendingTrades());
|
||||
updateNumPendingTrades();
|
||||
isReadyForMainScreen.set(true);
|
||||
|
||||
// For alpha version
|
||||
// uses messageService, so don't call it before backend is ready
|
||||
if (accountSettings.getAcceptedArbitrators().isEmpty())
|
||||
addMockArbitrator();
|
||||
|
||||
// For alpha version
|
||||
if (!user.isRegistered()) {
|
||||
BankAccount bankAccount = new BankAccount(BankAccountType.IRC,
|
||||
Currency.getInstance("EUR"),
|
||||
CountryUtil.getDefaultCountry(),
|
||||
"Demo",
|
||||
"Demo",
|
||||
"Demo",
|
||||
"Demo");
|
||||
user.setBankAccount(bankAccount);
|
||||
persistence.write(user);
|
||||
|
||||
user.setAccountID(walletService.getRegistrationAddressEntry().toString());
|
||||
persistence.write(user.getClass().getName(), user);
|
||||
}
|
||||
}
|
||||
|
||||
public StringConverter<BankAccount> getBankAccountsConverter() {
|
||||
@ -245,4 +285,35 @@ class MainViewModel implements ViewModel {
|
||||
|
||||
blockchainSyncIndicatorVisible.set(value < 1);
|
||||
}
|
||||
|
||||
private void addMockArbitrator() {
|
||||
if (accountSettings.getAcceptedArbitrators().isEmpty() && user.getMessageKeyPair() != null) {
|
||||
String pubKeyAsHex = Utils.HEX.encode(new ECKey().getPubKey());
|
||||
String messagePubKeyAsHex = DSAKeyUtil.getHexStringFromPublicKey(user.getMessagePublicKey());
|
||||
List<Locale> languages = new ArrayList<>();
|
||||
languages.add(LanguageUtil.getDefaultLanguageLocale());
|
||||
List<Arbitrator.METHOD> arbitrationMethods = new ArrayList<>();
|
||||
arbitrationMethods.add(Arbitrator.METHOD.TLS_NOTARY);
|
||||
List<Arbitrator.ID_VERIFICATION> idVerifications = new ArrayList<>();
|
||||
idVerifications.add(Arbitrator.ID_VERIFICATION.PASSPORT);
|
||||
idVerifications.add(Arbitrator.ID_VERIFICATION.GOV_ID);
|
||||
|
||||
Arbitrator arbitrator = new Arbitrator(pubKeyAsHex,
|
||||
messagePubKeyAsHex,
|
||||
"Manfred Karrer",
|
||||
Arbitrator.ID_TYPE.REAL_LIFE_ID,
|
||||
languages,
|
||||
new Reputation(),
|
||||
Coin.parseCoin("0.001"),
|
||||
arbitrationMethods,
|
||||
idVerifications,
|
||||
"https://bitsquare.io/",
|
||||
"Bla bla...");
|
||||
|
||||
accountSettings.addAcceptedArbitrator(arbitrator);
|
||||
persistence.write(accountSettings);
|
||||
|
||||
messageService.addArbitrator(arbitrator);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,11 +22,9 @@ import io.bitsquare.arbitrator.Arbitrator;
|
||||
import io.bitsquare.arbitrator.Reputation;
|
||||
import io.bitsquare.bank.BankAccount;
|
||||
import io.bitsquare.bank.BankAccountType;
|
||||
import io.bitsquare.locale.Country;
|
||||
import io.bitsquare.locale.CountryUtil;
|
||||
import io.bitsquare.locale.CurrencyUtil;
|
||||
import io.bitsquare.locale.LanguageUtil;
|
||||
import io.bitsquare.locale.Region;
|
||||
import io.bitsquare.msg.MessageService;
|
||||
import io.bitsquare.persistence.Persistence;
|
||||
import io.bitsquare.user.User;
|
||||
@ -106,12 +104,6 @@ class IrcAccountDataModel implements Activatable, DataModel {
|
||||
reset();
|
||||
}
|
||||
|
||||
|
||||
ObservableList<Country> getAllCountriesFor(Region selectedRegion) {
|
||||
return FXCollections.observableArrayList(CountryUtil.getAllCountriesFor(selectedRegion));
|
||||
}
|
||||
|
||||
|
||||
void setType(BankAccountType type) {
|
||||
this.type.set(type);
|
||||
}
|
||||
@ -120,7 +112,6 @@ class IrcAccountDataModel implements Activatable, DataModel {
|
||||
this.currency.set(currency);
|
||||
}
|
||||
|
||||
|
||||
private void reset() {
|
||||
nickName.set(null);
|
||||
|
||||
@ -132,10 +123,6 @@ class IrcAccountDataModel implements Activatable, DataModel {
|
||||
persistence.write(user);
|
||||
}
|
||||
|
||||
private void saveSettings() {
|
||||
persistence.write(accountSettings);
|
||||
}
|
||||
|
||||
private void addMockArbitrator() {
|
||||
if (accountSettings.getAcceptedArbitrators().isEmpty() && user.getMessageKeyPair() != null) {
|
||||
String pubKeyAsHex = Utils.HEX.encode(new ECKey().getPubKey());
|
||||
@ -157,7 +144,7 @@ class IrcAccountDataModel implements Activatable, DataModel {
|
||||
Coin.parseCoin("0.001"),
|
||||
arbitrationMethods,
|
||||
idVerifications,
|
||||
"http://bitsquare.io/",
|
||||
"https://bitsquare.io/",
|
||||
"Bla bla...");
|
||||
|
||||
accountSettings.addAcceptedArbitrator(arbitrator);
|
||||
|
@ -17,7 +17,6 @@
|
||||
|
||||
package io.bitsquare.gui.main.account.content.irc;
|
||||
|
||||
import io.bitsquare.bank.BankAccount;
|
||||
import io.bitsquare.bank.BankAccountType;
|
||||
import io.bitsquare.gui.util.validation.BankAccountNumberValidator;
|
||||
import io.bitsquare.gui.util.validation.InputValidator;
|
||||
@ -71,10 +70,6 @@ class IrcAccountViewModel extends ActivatableWithDelegate<IrcAccountDataModel> i
|
||||
return result;
|
||||
}
|
||||
|
||||
ObservableList<BankAccount> getAllBankAccounts() {
|
||||
return delegate.allBankAccounts;
|
||||
}
|
||||
|
||||
StringConverter<BankAccountType> getTypesConverter() {
|
||||
return new StringConverter<BankAccountType>() {
|
||||
@Override
|
||||
|
@ -42,6 +42,9 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
|
||||
btcDenominationComboBox.setItems(model.getBtcDenominationItems());
|
||||
btcDenominationComboBox.getSelectionModel().select(model.btcDenomination().get());
|
||||
|
||||
// For alpha
|
||||
btcDenominationComboBox.setDisable(true);
|
||||
|
||||
useAnimationsCheckBox.selectedProperty().bindBidirectional(model.useAnimations());
|
||||
useEffectsCheckBox.selectedProperty().bindBidirectional(model.useEffects());
|
||||
|
||||
|
@ -210,7 +210,7 @@ class OfferBookDataModel implements Activatable, DataModel {
|
||||
}
|
||||
|
||||
boolean isRegistered() {
|
||||
return user.getAccountId() != null;
|
||||
return user.isRegistered();
|
||||
}
|
||||
|
||||
boolean isMyOffer(Offer offer) {
|
||||
|
@ -140,6 +140,10 @@ public class User implements Serializable {
|
||||
return accountID;
|
||||
}
|
||||
|
||||
public boolean isRegistered() {
|
||||
return getAccountId() != null;
|
||||
}
|
||||
|
||||
public ObservableList<BankAccount> getBankAccounts() {
|
||||
return bankAccounts;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user