diff --git a/gui/src/main/java/io/bitsquare/app/BitsquareAppModule.java b/gui/src/main/java/io/bitsquare/app/BitsquareAppModule.java
index efe3b6f229..5a97b19170 100644
--- a/gui/src/main/java/io/bitsquare/app/BitsquareAppModule.java
+++ b/gui/src/main/java/io/bitsquare/app/BitsquareAppModule.java
@@ -66,7 +66,6 @@ class BitsquareAppModule extends AppModule {
bind(File.class).annotatedWith(named(KeyStorage.DIR_KEY)).toInstance(keyStorageDir);
bind(BitsquareEnvironment.class).toInstance((BitsquareEnvironment) env);
- bind(UpdateProcess.class).in(Singleton.class);
// ordering is used for shut down sequence
install(tradeModule());
diff --git a/gui/src/main/java/io/bitsquare/app/UpdateProcess.java b/gui/src/main/java/io/bitsquare/app/UpdateProcess.java
deleted file mode 100644
index 287a69417e..0000000000
--- a/gui/src/main/java/io/bitsquare/app/UpdateProcess.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * This file is part of Bitsquare.
- *
- * Bitsquare is free software: you can redistribute it and/or modify it
- * under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or (at
- * your option) any later version.
- *
- * Bitsquare is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with Bitsquare. If not, see .
- */
-
-package io.bitsquare.app;
-
-import com.google.inject.Inject;
-import io.bitsquare.common.handlers.ResultHandler;
-import javafx.beans.property.ObjectProperty;
-import javafx.beans.property.SimpleObjectProperty;
-import org.reactfx.util.Timer;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-// TODO
-// Deactivated for the moment.
-// UpdateFX use https for getting the version nr./jars, which we want to avoid with the Tor P2p network
-// We need to wait until tor is setup and then request from a hidden service the version and jars
-public class UpdateProcess {
- private static final Logger log = LoggerFactory.getLogger(UpdateProcess.class);
-
- // private static final List UPDATE_SIGNING_KEYS = Crypto.decode("029EF2D0D33A2546CB15FB10D969B7D65CAFB811CB3AC902E8D9A46BE847B1DA21");
- // private static final String UPDATES_BASE_URL = "https://bitsquare.io/updateFX/v03";
- private static final int UPDATE_SIGNING_THRESHOLD = 1;
- // private static final Path ROOT_CLASS_PATH = UpdateFX.findCodePath(BitsquareAppMain.class);
-
- private final BitsquareEnvironment environment;
- private ResultHandler resultHandler;
-
- public enum State {
- INIT,
- CHECK_FOR_UPDATES,
- UPDATE_AVAILABLE,
- UP_TO_DATE,
- NEW_RELEASE, // if a new minor release is out we inform the user to download the new binary
- FAILURE
- }
-
- public final ObjectProperty state = new SimpleObjectProperty<>(State.INIT);
-
- private String releaseUrl;
- private Timer timeoutTimer;
-
- @Inject
- public UpdateProcess(BitsquareEnvironment environment) {
- this.environment = environment;
- }
-
- public void restart() {
- // UpdateFX.restartApp();
- }
-
- public void setResultHandler(ResultHandler resultHandler) {
- this.resultHandler = resultHandler;
-
- resultHandler.handleResult();
- }
-
- public void init() {
-
-
- //log.info("UpdateFX checking for patch version " + Version.PATCH_VERSION);
-
- // process.timeout() will cause an error state back but we don't want to break startup in case of an timeout
- /* timeoutTimer = FxTimer.runLater(Duration.ofMillis(10000), () -> {
- log.error("Timeout reached for UpdateFX");
- resultHandler.handleResult();
- });
- String userAgent = environment.getProperty(BitsquareEnvironment.APP_NAME_KEY) + Version.VERSION;
-*/
- // Check if there is a new minor version release out. The release_url should be empty if no release is available, otherwise the download url.
- /* try {
- releaseUrl = Utilities.readTextFileFromServer(UPDATES_BASE_URL + "/release_url", userAgent);
- if (releaseUrl != null && releaseUrl.length() > 0) {
- log.info("New release available at: " + releaseUrl);
- state.set(State.NEW_RELEASE);
- timeoutTimer.stop();
- return;
- }
- else {
- // All ok. Empty file if we have no new release.
- }
- } catch (IOException e) {
- // ignore. File might be missing
- }*/
-
- /* Updater updater = new Updater(UPDATES_BASE_URL, userAgent, Version.PATCH_VERSION,
- Paths.get(environment.getProperty(BitsquareEnvironment.APP_DATA_DIR_KEY)),
- ROOT_CLASS_PATH, UPDATE_SIGNING_KEYS, UPDATE_SIGNING_THRESHOLD) {
- @Override
- protected void updateProgress(long workDone, long max) {
- //log.trace("updateProgress " + workDone + "/" + max);
- super.updateProgress(workDone, max);
- }
- };*/
-
- /* updater.progressProperty().addListener((observableValue, oldValue, newValue) -> {
- log.trace("progressProperty newValue = " + newValue);
- });*/
-
- /* updater.setOnSucceeded(event -> {
- try {
- UpdateSummary summary = updater.get();
- //log.info("summary " + summary.toString());
- if (summary.descriptions != null && summary.descriptions.size() > 0) {
- log.info("One liner: {}", summary.descriptions.get(0).getOneLiner());
- log.info("{}", summary.descriptions.get(0).getDescription());
- }
- if (summary.highestVersion > Version.PATCH_VERSION) {
- log.info("UPDATE_AVAILABLE");
- state.set(State.UPDATE_AVAILABLE);
- // We stop the timeout and treat it not completed.
- // The user should click the restart button manually if there are updates available.
- timeoutTimer.stop();
- }
- else if (summary.highestVersion == Version.PATCH_VERSION) {
- log.info("UP_TO_DATE");
- state.set(State.UP_TO_DATE);
- timeoutTimer.stop();
- resultHandler.handleResult();
- }
- } catch (Throwable e) {
- log.error("Exception at processing UpdateSummary: " + e.getMessage());
-
- // we treat errors as update not as critical errors to prevent startup,
- // so we use state.onCompleted() instead of state.onError()
- state.set(State.FAILURE);
- timeoutTimer.stop();
- resultHandler.handleResult();
- }
- });
- updater.setOnFailed(event -> {
- log.error("Update failed: " + updater.getException());
- updater.getException().printStackTrace();
-
- // we treat errors as update not as critical errors to prevent startup,
- // so we use state.onCompleted() instead of state.onError()
- state.set(State.FAILURE);
- timeoutTimer.stop();
- resultHandler.handleResult();
- });
-
- Thread thread = new Thread(updater, "Online update check");
- thread.setDaemon(true);
- thread.start();*/
- }
-
- public String getReleaseUrl() {
- return releaseUrl;
- }
-}
\ No newline at end of file
diff --git a/gui/src/main/java/io/bitsquare/gui/images.css b/gui/src/main/java/io/bitsquare/gui/images.css
index e9f332285d..6ececd48b8 100644
--- a/gui/src/main/java/io/bitsquare/gui/images.css
+++ b/gui/src/main/java/io/bitsquare/gui/images.css
@@ -129,6 +129,10 @@
}
/* connection state*/
+#image-connection-tor {
+ -fx-image: url("../../../images/connection/tor.png");
+}
+
#image-connection-direct {
-fx-image: url("../../../images/connection/direct.png");
}
diff --git a/gui/src/main/java/io/bitsquare/gui/main/MainView.java b/gui/src/main/java/io/bitsquare/gui/main/MainView.java
index 631f8da771..c43d3b7e3d 100644
--- a/gui/src/main/java/io/bitsquare/gui/main/MainView.java
+++ b/gui/src/main/java/io/bitsquare/gui/main/MainView.java
@@ -20,7 +20,6 @@ package io.bitsquare.gui.main;
import io.bitsquare.BitsquareException;
import io.bitsquare.common.UserThread;
import io.bitsquare.common.util.Tuple2;
-import io.bitsquare.common.util.Utilities;
import io.bitsquare.gui.Navigation;
import io.bitsquare.gui.common.view.*;
import io.bitsquare.gui.components.SystemNotification;
@@ -79,19 +78,14 @@ public class MainView extends InitializableView {
private final String title;
private ChangeListener walletServiceErrorMsgListener;
private ChangeListener blockchainSyncIconIdListener;
- private ChangeListener bootstrapErrorMsgListener;
- private ChangeListener bootstrapIconIdListener;
- private ChangeListener bootstrapProgressListener;
- private ChangeListener updateIconIdListener;
- private Button restartButton;
- private Button downloadButton;
- private ProgressIndicator bootstrapIndicator;
- private Label bootstrapStateLabel;
+ private ChangeListener splashP2PNetworkErrorMsgListener;
+ private ChangeListener splashP2PNetworkIconIdListener;
+ private ChangeListener splashP2PNetworkProgressListener;
+ private ProgressIndicator splashP2PNetworkIndicator;
+ private Label splashP2PNetworkLabel;
private ProgressBar blockchainSyncIndicator;
private Label blockchainSyncLabel;
- private Label updateInfoLabel;
private List persistedFilesCorrupted;
- private Tooltip downloadButtonTooltip;
private static BorderPane baseApplicationContainer;
@Inject
@@ -269,116 +263,68 @@ public class MainView extends InitializableView {
blockchainSyncIcon, bitcoinNetworkLabel);
- // createP2PNetworkBox
- bootstrapStateLabel = new Label();
- bootstrapStateLabel.setWrapText(true);
- bootstrapStateLabel.setMaxWidth(500);
- bootstrapStateLabel.setTextAlignment(TextAlignment.CENTER);
- bootstrapStateLabel.textProperty().bind(model.bootstrapInfo);
+ // create P2PNetworkBox
+ splashP2PNetworkLabel = new Label();
+ splashP2PNetworkLabel.setWrapText(true);
+ splashP2PNetworkLabel.setMaxWidth(500);
+ splashP2PNetworkLabel.setTextAlignment(TextAlignment.CENTER);
+ splashP2PNetworkLabel.textProperty().bind(model.splashP2PNetworkInfo);
- bootstrapIndicator = new ProgressIndicator();
- bootstrapIndicator.setMaxSize(24, 24);
- bootstrapIndicator.progressProperty().bind(model.bootstrapProgress);
+ splashP2PNetworkIndicator = new ProgressIndicator();
+ splashP2PNetworkIndicator.setMaxSize(24, 24);
+ splashP2PNetworkIndicator.progressProperty().bind(model.splashP2PNetworkProgress);
- bootstrapErrorMsgListener = (ov, oldValue, newValue) -> {
- bootstrapStateLabel.setId("splash-error-state-msg");
- bootstrapIndicator.setVisible(false);
+ splashP2PNetworkErrorMsgListener = (ov, oldValue, newValue) -> {
+ splashP2PNetworkLabel.setId("splash-error-state-msg");
+ splashP2PNetworkIndicator.setVisible(false);
};
- model.bootstrapErrorMsg.addListener(bootstrapErrorMsgListener);
+ model.p2PNetworkErrorMsg.addListener(splashP2PNetworkErrorMsgListener);
- ImageView bootstrapIcon = new ImageView();
- bootstrapIcon.setVisible(false);
- bootstrapIcon.setManaged(false);
- bootstrapIconIdListener = (ov, oldValue, newValue) -> {
- bootstrapIcon.setId(newValue);
- bootstrapIcon.setVisible(true);
- bootstrapIcon.setManaged(true);
+ ImageView splashP2PNetworkIcon = new ImageView();
+ splashP2PNetworkIcon.setId("image-connection-tor");
+ splashP2PNetworkIcon.setVisible(false);
+ splashP2PNetworkIcon.setManaged(false);
+ HBox.setMargin(splashP2PNetworkIcon, new Insets(0, 0, 5, 0));
+
+ splashP2PNetworkIconIdListener = (ov, oldValue, newValue) -> {
+ splashP2PNetworkIcon.setId(newValue);
+ splashP2PNetworkIcon.setVisible(true);
+ splashP2PNetworkIcon.setManaged(true);
};
- model.bootstrapIconId.addListener(bootstrapIconIdListener);
+ model.p2PNetworkIconId.addListener(splashP2PNetworkIconIdListener);
- bootstrapProgressListener = (ov, oldValue, newValue) -> {
+ splashP2PNetworkProgressListener = (ov, oldValue, newValue) -> {
if ((double) newValue >= 1) {
- bootstrapIndicator.setVisible(false);
- bootstrapIndicator.setManaged(false);
+ splashP2PNetworkIndicator.setVisible(false);
+ splashP2PNetworkIndicator.setManaged(false);
}
};
- model.bootstrapProgress.addListener(bootstrapProgressListener);
+ model.splashP2PNetworkProgress.addListener(splashP2PNetworkProgressListener);
- HBox bootstrapBox = new HBox();
- bootstrapBox.setSpacing(10);
- bootstrapBox.setAlignment(Pos.CENTER);
- bootstrapBox.setPrefHeight(50);
- bootstrapBox.getChildren().addAll(bootstrapStateLabel, bootstrapIndicator, bootstrapIcon);
+ HBox splashP2PNetworkBox = new HBox();
+ splashP2PNetworkBox.setSpacing(10);
+ splashP2PNetworkBox.setAlignment(Pos.CENTER);
+ splashP2PNetworkBox.setPrefHeight(50);
+ splashP2PNetworkBox.getChildren().addAll(splashP2PNetworkLabel, splashP2PNetworkIndicator, splashP2PNetworkIcon);
-
- // createUpdateBox
- updateInfoLabel = new Label();
- updateInfoLabel.setTextAlignment(TextAlignment.RIGHT);
- updateInfoLabel.textProperty().bind(model.updateInfo);
-
- restartButton = new Button("Restart");
- restartButton.setDefaultButton(true);
- restartButton.visibleProperty().bind(model.showRestartButton);
- restartButton.managedProperty().bind(model.showRestartButton);
- restartButton.setOnAction(e -> model.restart());
-
- downloadButton = new Button("Download");
- downloadButton.setDefaultButton(true);
- downloadButton.visibleProperty().bind(model.showDownloadButton);
- downloadButton.managedProperty().bind(model.showDownloadButton);
- downloadButtonTooltip = new Tooltip();
- downloadButtonTooltip.textProperty().bind(model.newReleaseUrl);
- downloadButton.setTooltip(downloadButtonTooltip);
- downloadButton.setOnAction(e -> {
- try {
- Utilities.openWebPage(model.newReleaseUrl.get());
- } catch (Exception e1) {
- e1.printStackTrace();
- log.error(e1.getMessage());
- }
- });
-
- ImageView updateIcon = new ImageView();
- String id = model.updateIconId.get();
- if (id != null && !id.equals(""))
- updateIcon.setId(id);
-
- updateIconIdListener = (ov, oldValue, newValue) -> {
- updateIcon.setId(newValue);
- updateIcon.setVisible(true);
- updateIcon.setManaged(true);
- };
- model.updateIconId.addListener(updateIconIdListener);
-
- HBox updateBox = new HBox();
- updateBox.setSpacing(10);
- updateBox.setAlignment(Pos.CENTER);
- updateBox.setPrefHeight(20);
- updateBox.getChildren().addAll(updateInfoLabel, restartButton, downloadButton, updateIcon);
-
- vBox.getChildren().addAll(logo, blockchainSyncBox, bootstrapBox, updateBox);
+ vBox.getChildren().addAll(logo, blockchainSyncBox, splashP2PNetworkBox);
return vBox;
}
private void disposeSplashScreen() {
model.walletServiceErrorMsg.removeListener(walletServiceErrorMsgListener);
model.blockchainSyncIconId.removeListener(blockchainSyncIconIdListener);
- model.bootstrapErrorMsg.removeListener(bootstrapErrorMsgListener);
- model.bootstrapIconId.removeListener(bootstrapIconIdListener);
- model.bootstrapProgress.removeListener(bootstrapProgressListener);
- model.updateIconId.removeListener(updateIconIdListener);
+
+ model.p2PNetworkErrorMsg.removeListener(splashP2PNetworkErrorMsgListener);
+ model.p2PNetworkIconId.removeListener(splashP2PNetworkIconIdListener);
+ model.splashP2PNetworkProgress.removeListener(splashP2PNetworkProgressListener);
blockchainSyncLabel.textProperty().unbind();
blockchainSyncIndicator.progressProperty().unbind();
- bootstrapStateLabel.textProperty().unbind();
- bootstrapIndicator.progressProperty().unbind();
- updateInfoLabel.textProperty().unbind();
- restartButton.visibleProperty().unbind();
- restartButton.managedProperty().unbind();
- downloadButton.visibleProperty().unbind();
- downloadButton.managedProperty().unbind();
- downloadButtonTooltip.textProperty().unbind();
+
+ splashP2PNetworkLabel.textProperty().unbind();
+ splashP2PNetworkIndicator.progressProperty().unbind();
model.onSplashScreenRemoved();
}
@@ -446,37 +392,31 @@ public class MainView extends InitializableView {
setBottomAnchor(versionLabel, 7d);
- // P2P
- Label bootstrapLabel = new Label();
- bootstrapLabel.setId("footer-pane");
- setRightAnchor(bootstrapLabel, 100d);
- setBottomAnchor(bootstrapLabel, 7d);
- bootstrapLabel.textProperty().bind(model.p2pNetworkInfoFooter);
+ // P2P Network
+ Label p2PNetworkLabel = new Label();
+ p2PNetworkLabel.setId("footer-pane");
+ setRightAnchor(p2PNetworkLabel, 33d);
+ setBottomAnchor(p2PNetworkLabel, 7d);
+ p2PNetworkLabel.textProperty().bind(model.p2PNetworkInfo);
- ImageView bootstrapIcon = new ImageView();
- setRightAnchor(bootstrapIcon, 60d);
- setBottomAnchor(bootstrapIcon, 9d);
- bootstrapIcon.idProperty().bind(model.bootstrapIconId);
+ ImageView p2PNetworkIcon = new ImageView();
+ setRightAnchor(p2PNetworkIcon, 10d);
+ setBottomAnchor(p2PNetworkIcon, 7d);
+ p2PNetworkIcon.idProperty().bind(model.p2PNetworkIconId);
- Label numPeersLabel = new Label();
- numPeersLabel.setId("footer-num-peers");
- setRightAnchor(numPeersLabel, 10d);
- setBottomAnchor(numPeersLabel, 7d);
- numPeersLabel.textProperty().bind(model.numP2PNetworkPeers);
- model.bootstrapErrorMsg.addListener((ov, oldValue, newValue) -> {
+ model.p2PNetworkErrorMsg.addListener((ov, oldValue, newValue) -> {
if (newValue != null) {
- bootstrapLabel.setId("splash-error-state-msg");
- bootstrapLabel.textProperty().unbind();
- bootstrapLabel.setText("Not connected");
+ p2PNetworkLabel.setId("splash-error-state-msg");
+ p2PNetworkLabel.textProperty().unbind();
new Popup().error("Connecting to the P2P network failed. \n" + newValue
+ "\nPlease check your internet connection.").show();
} else {
- bootstrapLabel.setId("footer-pane");
- bootstrapLabel.textProperty().bind(model.p2pNetworkInfoFooter);
+ p2PNetworkLabel.setId("footer-pane");
+ p2PNetworkLabel.textProperty().bind(model.p2PNetworkInfo);
}
});
- AnchorPane footerContainer = new AnchorPane(separator, blockchainSyncBox, versionLabel, bootstrapLabel, bootstrapIcon, numPeersLabel) {{
+ AnchorPane footerContainer = new AnchorPane(separator, blockchainSyncBox, versionLabel, p2PNetworkLabel, p2PNetworkIcon) {{
setId("footer-pane");
setMinHeight(30);
setMaxHeight(30);
diff --git a/gui/src/main/java/io/bitsquare/gui/main/MainViewModel.java b/gui/src/main/java/io/bitsquare/gui/main/MainViewModel.java
index 217cbca539..33679a5224 100644
--- a/gui/src/main/java/io/bitsquare/gui/main/MainViewModel.java
+++ b/gui/src/main/java/io/bitsquare/gui/main/MainViewModel.java
@@ -21,7 +21,6 @@ import com.google.inject.Inject;
import io.bitsquare.alert.Alert;
import io.bitsquare.alert.AlertManager;
import io.bitsquare.app.BitsquareApp;
-import io.bitsquare.app.UpdateProcess;
import io.bitsquare.app.Version;
import io.bitsquare.arbitration.ArbitratorManager;
import io.bitsquare.arbitration.Dispute;
@@ -51,7 +50,6 @@ import org.bitcoinj.core.*;
import org.bitcoinj.store.BlockStoreException;
import org.fxmisc.easybind.EasyBind;
import org.fxmisc.easybind.monadic.MonadicBinding;
-import org.jetbrains.annotations.NotNull;
import org.reactfx.util.FxTimer;
import org.reactfx.util.Timer;
import org.slf4j.Logger;
@@ -80,10 +78,8 @@ class MainViewModel implements ViewModel {
private final OpenOfferManager openOfferManager;
private final DisputeManager disputeManager;
private final Preferences preferences;
- private final KeyRing keyRing;
private final AlertManager alertManager;
private final WalletPasswordPopup walletPasswordPopup;
- private final UpdateProcess updateProcess;
private final BSFormatter formatter;
// BTC network
@@ -97,22 +93,15 @@ class MainViewModel implements ViewModel {
private final StringProperty numBTCPeers = new SimpleStringProperty();
// P2P network
- final StringProperty bootstrapInfo = new SimpleStringProperty("Connecting to P2P network...");
- final StringProperty p2pNetworkInfoFooter = new SimpleStringProperty("Setting up Tor hidden service...");
- final DoubleProperty bootstrapProgress = new SimpleDoubleProperty(-1);
- final StringProperty bootstrapErrorMsg = new SimpleStringProperty();
- final StringProperty bootstrapIconId = new SimpleStringProperty();
- final StringProperty numP2PNetworkPeers = new SimpleStringProperty();
+ final StringProperty splashP2PNetworkInfo = new SimpleStringProperty();
+ final StringProperty p2PNetworkInfo = new SimpleStringProperty();
+ final DoubleProperty splashP2PNetworkProgress = new SimpleDoubleProperty(-1);
+ final StringProperty p2PNetworkErrorMsg = new SimpleStringProperty();
+ final StringProperty p2PNetworkIconId = new SimpleStringProperty();
// software update
- final StringProperty updateInfo = new SimpleStringProperty();
final String version = "v." + Version.VERSION;
- final BooleanProperty showRestartButton = new SimpleBooleanProperty(false);
- final BooleanProperty showDownloadButton = new SimpleBooleanProperty(false);
- final StringProperty newReleaseUrl = new SimpleStringProperty();
- final StringProperty updateIconId = new SimpleStringProperty();
-
final BooleanProperty showAppScreen = new SimpleBooleanProperty();
final StringProperty numPendingTradesAsString = new SimpleStringProperty();
final BooleanProperty showPendingTradesNotification = new SimpleBooleanProperty();
@@ -139,7 +128,7 @@ class MainViewModel implements ViewModel {
OpenOfferManager openOfferManager, DisputeManager disputeManager, Preferences preferences,
KeyRing keyRing, User user,
AlertManager alertManager,
- WalletPasswordPopup walletPasswordPopup, UpdateProcess updateProcess, BSFormatter formatter) {
+ WalletPasswordPopup walletPasswordPopup, BSFormatter formatter) {
this.user = user;
log.debug("in");
this.walletService = walletService;
@@ -150,16 +139,12 @@ class MainViewModel implements ViewModel {
this.openOfferManager = openOfferManager;
this.disputeManager = disputeManager;
this.preferences = preferences;
- this.keyRing = keyRing;
this.alertManager = alertManager;
this.walletPasswordPopup = walletPasswordPopup;
- this.updateProcess = updateProcess;
this.formatter = formatter;
bitcoinNetworkAsString = formatter.formatBitcoinNetwork(preferences.getBitcoinNetwork());
- updateProcess.state.addListener((observableValue, oldValue, newValue) -> applyUpdateState(newValue));
- applyUpdateState(updateProcess.state.get());
TxIdTextField.setPreferences(preferences);
TxIdTextField.setWalletService(walletService);
BalanceTextField.setWalletService(walletService);
@@ -178,22 +163,14 @@ class MainViewModel implements ViewModel {
// API
///////////////////////////////////////////////////////////////////////////////////////////
- public void restart() {
- updateProcess.restart();
- }
-
public void initializeAllServices() {
log.trace("initializeAllServices");
- p2pNetworkInfoFooter.set("Connecting to tor network...");
-
- BooleanProperty updateProcessDone = initUpdateFx();
BooleanProperty walletInitialized = initBitcoinWallet();
BooleanProperty bootstrapDone = initP2PNetwork();
// need to store it to not get garbage collected
- allServicesDone = EasyBind.combine(updateProcessDone, walletInitialized, bootstrapDone,
- (a, b, c) -> a.booleanValue() && b.booleanValue() && c.booleanValue());
+ allServicesDone = EasyBind.combine(walletInitialized, bootstrapDone, (a, b) -> a && b);
allServicesDone.subscribe((observable, oldValue, newValue) -> {
if (newValue)
onAllServicesInitialized();
@@ -206,37 +183,41 @@ class MainViewModel implements ViewModel {
///////////////////////////////////////////////////////////////////////////////////////////
private BooleanProperty initP2PNetwork() {
- final BooleanProperty p2pNetworkReady = new SimpleBooleanProperty();
+ final BooleanProperty initialDataReady = new SimpleBooleanProperty();
+ splashP2PNetworkInfo.set("Connecting to Tor network...");
p2PService.start(new P2PServiceListener() {
@Override
public void onTorNodeReady() {
- p2pNetworkInfoFooter.set("Tor node created.");
- }
-
- @Override
- public void onRequestingDataCompleted() {
- p2pNetworkInfoFooter.set("Data received from peer.");
- p2pNetworkReady.set(true);
- }
-
- @Override
- public void onFirstPeerAuthenticated() {
- p2pNetworkInfoFooter.set("Authenticated in P2P network.");
+ splashP2PNetworkInfo.set("Publishing Tor Hidden Service...");
+ p2PNetworkIconId.set("image-connection-tor");
}
@Override
public void onHiddenServicePublished() {
- p2pNetworkInfoFooter.set("Tor hidden service available.");
+ splashP2PNetworkInfo.set("Authenticating to a seed node...");
}
+ @Override
+ public void onRequestingDataCompleted() {
+ p2PNetworkInfo.set("Publishing Tor Hidden Service...");
+ initialDataReady.set(true);
+ }
+
+ @Override
+ public void onFirstPeerAuthenticated() {
+ updateP2pNetworkInfo();
+ splashP2PNetworkProgress.set(1);
+ }
+
+
@Override
public void onSetupFailed(Throwable throwable) {
- bootstrapErrorMsg.set("Error at starting P2P network. " + throwable.getMessage());
- bootstrapInfo.set("Connecting to the P2P network failed.");
- bootstrapProgress.set(0);
+ p2PNetworkErrorMsg.set("Connecting to the P2P network failed. " + throwable.getMessage());
+ splashP2PNetworkProgress.set(0);
}
});
- return p2pNetworkReady;
+
+ return initialDataReady;
}
private BooleanProperty initBitcoinWallet() {
@@ -281,17 +262,6 @@ class MainViewModel implements ViewModel {
return walletInitialized;
}
- @NotNull
- private BooleanProperty initUpdateFx() {
- updateProcess.init();
- final BooleanProperty updateProcessDone = new SimpleBooleanProperty();
- updateProcess.setResultHandler(() -> {
- log.trace("updateProcess completed");
- updateProcessDone.set(true);
- });
- return updateProcessDone;
- }
-
private void onAllServicesInitialized() {
log.trace("onAllServicesInitialized");
@@ -371,10 +341,17 @@ class MainViewModel implements ViewModel {
new TacPopup().url(WebViewPopup.getLocalUrl("tac.html")).onAgree(() -> preferences.setTacAccepted(true)).show();
+ // update nr of peers in footer
+ p2PService.numAuthenticatedPeers.addListener((observable, oldValue, newValue) -> updateP2pNetworkInfo());
+
// now show app
showAppScreen.set(true);
}
+ private void updateP2pNetworkInfo() {
+ p2PNetworkInfo.set("Nr. of authenticated connections: " + p2PService.numAuthenticatedPeers.get());
+ }
+
private void displayAlertIfPresent(Alert alert) {
boolean alreadyDisplayed = alert != null && alert.equals(user.getDisplayedAlert());
user.setDisplayedAlert(alert);
@@ -436,74 +413,6 @@ class MainViewModel implements ViewModel {
// Apply states
///////////////////////////////////////////////////////////////////////////////////////////
- private void applyUpdateState(UpdateProcess.State state) {
- switch (state) {
- case INIT:
- updateInfo.set("");
- updateIconId.set(null);
- break;
- case CHECK_FOR_UPDATES:
- updateInfo.set("Check for updates...");
- updateIconId.set("image-update-in-progress");
- break;
- case UPDATE_AVAILABLE:
- updateInfo.set("New update available. Please restart!");
- updateIconId.set("image-update-available");
- showRestartButton.set(true);
- break;
- case UP_TO_DATE:
- updateInfo.set("Software is up to date. Version: " + Version.VERSION);
- updateIconId.set("image-update-up-to-date");
- break;
- case NEW_RELEASE:
- updateInfo.set("A new release is available.");
- updateIconId.set("image-update-available");
- newReleaseUrl.set(updateProcess.getReleaseUrl());
- showDownloadButton.setValue(true);
- break;
- case FAILURE:
- updateInfo.set("Check for updates failed.");
- updateIconId.set("image-update-failed");
- break;
- }
- }
-
- /* private void setBootstrapState(TomP2PNetworkInfo.State state) {
- switch (state) {
- case DISCOVERY_DIRECT_SUCCEEDED:
- bootstrapIconId.set("image-connection-direct");
- bootstrapInfoFooter.set("Direct connection");
- break;
- case DISCOVERY_MANUAL_PORT_FORWARDING_SUCCEEDED:
- case DISCOVERY_AUTO_PORT_FORWARDING_SUCCEEDED:
- bootstrapIconId.set("image-connection-nat");
- bootstrapInfoFooter.set("Connected with port forwarding");
- break;
- case RELAY_SUCCEEDED:
- bootstrapIconId.set("image-connection-relay");
- bootstrapInfoFooter.set("Connected with relay node");
- break;
- default:
- break;
- }
-
- switch (state) {
- case DISCOVERY_DIRECT_SUCCEEDED:
- case DISCOVERY_MANUAL_PORT_FORWARDING_SUCCEEDED:
- case DISCOVERY_AUTO_PORT_FORWARDING_SUCCEEDED:
- case RELAY_SUCCEEDED:
- bootstrapInfo.set(state.getMessage());
- bootstrapProgress.set(-1);
- break;
- case BOOT_STRAP_SUCCEEDED:
- bootstrapProgress.set(1);
- break;
- default:
- bootstrapProgress.set(-1);
- break;
- }
- }*/
-
private void applyTradePeriodState() {
updateTradePeriodState();
tradeWalletService.addBlockChainListener(new BlockChainListener() {
diff --git a/gui/src/main/java/io/bitsquare/gui/main/settings/network/NetworkSettingsView.fxml b/gui/src/main/java/io/bitsquare/gui/main/settings/network/NetworkSettingsView.fxml
index 2a80429516..4621f8888a 100644
--- a/gui/src/main/java/io/bitsquare/gui/main/settings/network/NetworkSettingsView.fxml
+++ b/gui/src/main/java/io/bitsquare/gui/main/settings/network/NetworkSettingsView.fxml
@@ -62,31 +62,20 @@
-