Remove shutdown on connection failure

This commit is contained in:
Manfred Karrer 2015-05-06 18:23:12 +02:00
parent 20c2e2ab20
commit 44c8cf9c26
2 changed files with 9 additions and 18 deletions

View file

@ -111,7 +111,6 @@ public class BitsquareApp extends Application {
// load the main view and create the main scene // load the main view and create the main scene
CachingViewLoader viewLoader = injector.getInstance(CachingViewLoader.class); CachingViewLoader viewLoader = injector.getInstance(CachingViewLoader.class);
mainView = (MainView) viewLoader.load(MainView.class); mainView = (MainView) viewLoader.load(MainView.class);
mainView.setExitHandler(this::stop);
mainView.setPersistedFilesCorrupted(corruptedDatabaseFiles); mainView.setPersistedFilesCorrupted(corruptedDatabaseFiles);
scene = new Scene(mainView.getRoot(), 1000, 650); scene = new Scene(mainView.getRoot(), 1000, 650);

View file

@ -81,7 +81,6 @@ public class MainView extends InitializableView<StackPane, MainViewModel> {
private ProgressBar blockchainSyncIndicator; private ProgressBar blockchainSyncIndicator;
private Label blockchainSyncLabel; private Label blockchainSyncLabel;
private Label updateInfoLabel; private Label updateInfoLabel;
private Runnable exitHandler;
private List<String> persistedFilesCorrupted; private List<String> persistedFilesCorrupted;
@Inject @Inject
@ -190,10 +189,6 @@ public class MainView extends InitializableView<StackPane, MainViewModel> {
Platform.runLater(model::initBackend); Platform.runLater(model::initBackend);
} }
public void setExitHandler(Runnable exitHandler) {
this.exitHandler = exitHandler;
}
public void setPersistedFilesCorrupted(List<String> persistedFilesCorrupted) { public void setPersistedFilesCorrupted(List<String> persistedFilesCorrupted) {
this.persistedFilesCorrupted = persistedFilesCorrupted; this.persistedFilesCorrupted = persistedFilesCorrupted;
} }
@ -213,9 +208,7 @@ public class MainView extends InitializableView<StackPane, MainViewModel> {
blockchainSyncLabel.textProperty().bind(model.blockchainSyncInfo); blockchainSyncLabel.textProperty().bind(model.blockchainSyncInfo);
walletServiceErrorMsgListener = (ov, oldValue, newValue) -> { walletServiceErrorMsgListener = (ov, oldValue, newValue) -> {
blockchainSyncLabel.setId("splash-error-state-msg"); blockchainSyncLabel.setId("splash-error-state-msg");
Popups.openErrorPopup("Error", "Connecting to the bitcoin network failed. \n" + newValue openBTCConnectionErrorPopup(newValue);
+ "\nPlease check our internet connection and restart the application.");
exitHandler.run();
}; };
model.walletServiceErrorMsg.addListener(walletServiceErrorMsgListener); model.walletServiceErrorMsg.addListener(walletServiceErrorMsgListener);
@ -264,10 +257,7 @@ public class MainView extends InitializableView<StackPane, MainViewModel> {
bootstrapErrorMsgListener = (ov, oldValue, newValue) -> { bootstrapErrorMsgListener = (ov, oldValue, newValue) -> {
bootstrapStateLabel.setId("splash-error-state-msg"); bootstrapStateLabel.setId("splash-error-state-msg");
bootstrapIndicator.setVisible(false); bootstrapIndicator.setVisible(false);
openBTCConnectionErrorPopup(model.bootstrapErrorMsg.get());
Popups.openErrorPopup("Error", "Connecting to the Bitsquare network failed. \n" + model.bootstrapErrorMsg.get()
+ "\nPlease check our internet connection and restart the application.");
exitHandler.run();
}; };
model.bootstrapErrorMsg.addListener(bootstrapErrorMsgListener); model.bootstrapErrorMsg.addListener(bootstrapErrorMsgListener);
@ -373,9 +363,7 @@ public class MainView extends InitializableView<StackPane, MainViewModel> {
bitcoinNetworkLabel.setId("splash-error-state-msg"); bitcoinNetworkLabel.setId("splash-error-state-msg");
bitcoinNetworkLabel.textProperty().unbind(); bitcoinNetworkLabel.textProperty().unbind();
bitcoinNetworkLabel.setText("Not connected"); bitcoinNetworkLabel.setText("Not connected");
Popups.openErrorPopup("Error", "Connecting to the bitcoin network failed. \n" + newValue openBTCConnectionErrorPopup(newValue);
+ "\nPlease check our internet connection and restart the application.");
exitHandler.run();
}); });
model.blockchainSyncProgress.addListener((ov, oldValue, newValue) -> { model.blockchainSyncProgress.addListener((ov, oldValue, newValue) -> {
@ -428,8 +416,7 @@ public class MainView extends InitializableView<StackPane, MainViewModel> {
bootstrapLabel.textProperty().unbind(); bootstrapLabel.textProperty().unbind();
bootstrapLabel.setText("Not connected"); bootstrapLabel.setText("Not connected");
Popups.openErrorPopup("Error", "Connecting to the P2P network failed. \n" + newValue Popups.openErrorPopup("Error", "Connecting to the P2P network failed. \n" + newValue
+ "\nPlease check our internet connection and restart the application."); + "\nPlease check our internet connection.");
exitHandler.run();
}); });
AnchorPane footerContainer = new AnchorPane(separator, blockchainSyncBox, versionLabel, bootstrapLabel, bootstrapIcon, numPeersLabel) {{ AnchorPane footerContainer = new AnchorPane(separator, blockchainSyncBox, versionLabel, bootstrapLabel, bootstrapIcon, numPeersLabel) {{
@ -559,4 +546,9 @@ public class MainView extends InitializableView<StackPane, MainViewModel> {
throw new IllegalArgumentException("Cannot get ID for " + viewClass + ": class must end in " + suffix); throw new IllegalArgumentException("Cannot get ID for " + viewClass + ": class must end in " + suffix);
return viewName.substring(0, suffixIdx).toLowerCase(); return viewName.substring(0, suffixIdx).toLowerCase();
} }
private void openBTCConnectionErrorPopup(String errorMsg) {
Popups.openErrorPopup("Error", "Connecting to the bitcoin network failed. \n" + errorMsg
+ "\nPlease check our internet connection.");
}
} }