Set mainnet as default

This commit is contained in:
Manfred Karrer 2016-01-27 22:28:09 +01:00
parent 495616edea
commit d8086ffba9
12 changed files with 42 additions and 39 deletions

View file

@ -354,8 +354,8 @@ public class MainView extends InitializableView<StackPane, MainViewModel> {
btcNetworkWarnMsgPopup = new Popup().warning(newValue).show();
} else {
btcInfoLabel.setId("footer-pane");
if (p2PNetworkWarnMsgPopup != null)
p2PNetworkWarnMsgPopup.hide();
if (btcNetworkWarnMsgPopup != null)
btcNetworkWarnMsgPopup.hide();
}
});

View file

@ -27,6 +27,7 @@ import io.bitsquare.arbitration.ArbitratorManager;
import io.bitsquare.arbitration.Dispute;
import io.bitsquare.arbitration.DisputeManager;
import io.bitsquare.btc.AddressEntry;
import io.bitsquare.btc.BitcoinNetwork;
import io.bitsquare.btc.TradeWalletService;
import io.bitsquare.btc.WalletService;
import io.bitsquare.btc.listeners.BalanceListener;
@ -66,6 +67,7 @@ import java.time.Duration;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@ -100,7 +102,7 @@ public class MainViewModel implements ViewModel {
final StringProperty p2PNetworkWarnMsg = new SimpleStringProperty();
final StringProperty p2PNetworkIconId = new SimpleStringProperty();
final BooleanProperty bootstrapComplete = new SimpleBooleanProperty();
// software update
final String version = "v." + Version.VERSION;
@ -381,14 +383,32 @@ public class MainViewModel implements ViewModel {
"3. The user confirms that he has read and agreed to the rules defined in our " +
"Wiki regrading the dispute process\n" +
"(https://github.com/bitsquare/bitsquare/wiki/Arbitration-system).";
if (!preferences.getTacAccepted() && !BitsquareApp.DEV_MODE)
if (!preferences.getTacAccepted() && !BitsquareApp.DEV_MODE) {
new Popup().headLine("USER AGREEMENT")
.message(text)
.actionButtonText("I agree")
.closeButtonText("I disagree and quit")
.onAction(() -> preferences.setTacAccepted(true))
.onClose(() -> BitsquareApp.shutDownHandler.run())
.onAction(() -> {
preferences.setTacAccepted(true);
if (preferences.getBitcoinNetwork() == BitcoinNetwork.MAINNET)
UserThread.runAfter(() -> new Popup()
.warning("The application is still in alpha version.\n" +
"Please be aware that using Mainnet comes with the risk to lose funds in case of software bugs.\n" +
"To limit the possible losses the maximum allowed trading amount and the security deposit are " +
"reduced to 0.01 BTC for the alpha version on Mainnet.")
.headLine("Important information!")
.actionButtonText("I understand and want to stick with Mainnet")
.closeButtonText("Restart and use Testnet")
.onClose(() -> {
UserThread.execute(() -> preferences.setBitcoinNetwork(BitcoinNetwork.TESTNET));
UserThread.runAfter(BitsquareApp.shutDownHandler::run, 300, TimeUnit.MILLISECONDS);
})
.width(600)
.show(), 300, TimeUnit.MILLISECONDS);
})
.onClose(BitsquareApp.shutDownHandler::run)
.show();
}
// update nr of peers in footer
numConnectedPeersListener = (observable, oldValue, newValue) -> {

View file

@ -20,7 +20,6 @@ package io.bitsquare.gui.main.settings.network;
import io.bitsquare.app.BitsquareApp;
import io.bitsquare.btc.BitcoinNetwork;
import io.bitsquare.btc.WalletService;
import io.bitsquare.common.UserThread;
import io.bitsquare.gui.common.model.Activatable;
import io.bitsquare.gui.common.view.ActivatableViewAndModel;
import io.bitsquare.gui.common.view.FxmlView;
@ -193,22 +192,8 @@ public class NetworkSettingsView extends ActivatableViewAndModel<GridPane, Activ
}
private void onSelectNetwork() {
if (netWorkComboBox.getSelectionModel().getSelectedItem() != preferences.getBitcoinNetwork()) {
if (netWorkComboBox.getSelectionModel().getSelectedItem() == BitcoinNetwork.MAINNET) {
new Popup().warning("The application is not sufficiently tested yet. " +
"Please be aware that using Mainnet comes with the risk to lose funds in case of software bugs.\n" +
"To limit the possible losses the maximum allowed trading amount and the security deposit are " +
"reduced to 0.01 BTC on Mainnet.")
.actionButtonText("I will stick with Testnet for now")
.onAction(() -> UserThread.execute(() -> netWorkComboBox.getSelectionModel().select(preferences.getBitcoinNetwork())))
.closeButtonText("I understand the risk and want to use Mainnet")
.onClose(() -> selectNetwork())
.width(800)
.show();
} else {
selectNetwork();
}
}
if (netWorkComboBox.getSelectionModel().getSelectedItem() != preferences.getBitcoinNetwork())
selectNetwork();
}
private void selectNetwork() {

View file

@ -329,7 +329,7 @@ public class Popup {
closeHandlerOptional.ifPresent(closeHandler -> closeHandler.run());
});
if (actionHandlerOptional.isPresent()) {
if (actionHandlerOptional.isPresent() || actionButtonText != null) {
actionButton = new Button(actionButtonText == null ? "Ok" : actionButtonText);
actionButton.setDefaultButton(true);
actionButton.requestFocus();