Revert "Added UI error messages"

This reverts commit eb8f5f523d.
This commit is contained in:
JaniruTEC
2020-10-28 15:21:59 +01:00
parent d0d39a1c72
commit d331c30224
2 changed files with 2 additions and 21 deletions

View File

@@ -1,6 +1,5 @@
package org.cryptomator.ui.preferences; package org.cryptomator.ui.preferences;
import dagger.Lazy;
import javafx.application.Application; import javafx.application.Application;
import javafx.application.Platform; import javafx.application.Platform;
import javafx.beans.property.ObjectProperty; import javafx.beans.property.ObjectProperty;
@@ -8,22 +7,17 @@ import javafx.beans.value.ObservableValue;
import javafx.concurrent.Task; import javafx.concurrent.Task;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.geometry.NodeOrientation; import javafx.geometry.NodeOrientation;
import javafx.scene.Scene;
import javafx.scene.control.CheckBox; import javafx.scene.control.CheckBox;
import javafx.scene.control.ChoiceBox; import javafx.scene.control.ChoiceBox;
import javafx.scene.control.RadioButton; import javafx.scene.control.RadioButton;
import javafx.scene.control.Toggle; import javafx.scene.control.Toggle;
import javafx.scene.control.ToggleGroup; import javafx.scene.control.ToggleGroup;
import javafx.stage.Stage;
import javafx.util.StringConverter; import javafx.util.StringConverter;
import org.cryptomator.common.Environment; import org.cryptomator.common.Environment;
import org.cryptomator.common.LicenseHolder; import org.cryptomator.common.LicenseHolder;
import org.cryptomator.common.settings.Settings; import org.cryptomator.common.settings.Settings;
import org.cryptomator.common.settings.UiTheme; import org.cryptomator.common.settings.UiTheme;
import org.cryptomator.ui.common.ErrorComponent;
import org.cryptomator.ui.common.FxController; import org.cryptomator.ui.common.FxController;
import org.cryptomator.ui.common.FxmlFile;
import org.cryptomator.ui.common.FxmlScene;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -38,7 +32,6 @@ public class GeneralPreferencesController implements FxController {
private static final Logger LOG = LoggerFactory.getLogger(GeneralPreferencesController.class); private static final Logger LOG = LoggerFactory.getLogger(GeneralPreferencesController.class);
private final Stage window;
private final Settings settings; private final Settings settings;
private final boolean trayMenuSupported; private final boolean trayMenuSupported;
private final Optional<AutoStartStrategy> autoStartStrategy; private final Optional<AutoStartStrategy> autoStartStrategy;
@@ -48,8 +41,6 @@ public class GeneralPreferencesController implements FxController {
private final ResourceBundle resourceBundle; private final ResourceBundle resourceBundle;
private final Application application; private final Application application;
private final Environment environment; private final Environment environment;
private final Lazy<Scene> preferencesScene;
private final ErrorComponent.Builder errorComponent;
public ChoiceBox<UiTheme> themeChoiceBox; public ChoiceBox<UiTheme> themeChoiceBox;
public CheckBox startHiddenCheckbox; public CheckBox startHiddenCheckbox;
public CheckBox debugModeCheckbox; public CheckBox debugModeCheckbox;
@@ -59,8 +50,7 @@ public class GeneralPreferencesController implements FxController {
public RadioButton nodeOrientationRtl; public RadioButton nodeOrientationRtl;
@Inject @Inject
GeneralPreferencesController(@PreferencesWindow Stage window, Settings settings, @Named("trayMenuSupported") boolean trayMenuSupported, Optional<AutoStartStrategy> autoStartStrategy, ObjectProperty<SelectedPreferencesTab> selectedTabProperty, LicenseHolder licenseHolder, ExecutorService executor, ResourceBundle resourceBundle, Application application, Environment environment, @FxmlScene(FxmlFile.PREFERENCES) Lazy<Scene> preferencesScene, ErrorComponent.Builder errorComponent) { GeneralPreferencesController(Settings settings, @Named("trayMenuSupported") boolean trayMenuSupported, Optional<AutoStartStrategy> autoStartStrategy, ObjectProperty<SelectedPreferencesTab> selectedTabProperty, LicenseHolder licenseHolder, ExecutorService executor, ResourceBundle resourceBundle, Application application, Environment environment) {
this.window = window;
this.settings = settings; this.settings = settings;
this.trayMenuSupported = trayMenuSupported; this.trayMenuSupported = trayMenuSupported;
this.autoStartStrategy = autoStartStrategy; this.autoStartStrategy = autoStartStrategy;
@@ -70,8 +60,6 @@ public class GeneralPreferencesController implements FxController {
this.resourceBundle = resourceBundle; this.resourceBundle = resourceBundle;
this.application = application; this.application = application;
this.environment = environment; this.environment = environment;
this.preferencesScene = preferencesScene;
this.errorComponent = errorComponent;
} }
@FXML @FXML
@@ -124,7 +112,6 @@ public class GeneralPreferencesController implements FxController {
toggleTask.setOnFailed(event -> { toggleTask.setOnFailed(event -> {
autoStartCheckbox.setSelected(!enableAutoStart); // restore previous state autoStartCheckbox.setSelected(!enableAutoStart); // restore previous state
LOG.error("Failed to toggle autostart.", event.getSource().getException()); LOG.error("Failed to toggle autostart.", event.getSource().getException());
errorComponent.cause(event.getSource().getException()).window(window).returnToScene(preferencesScene.get()).build().showErrorScene();
}); });
executor.execute(toggleTask); executor.execute(toggleTask);
}); });

View File

@@ -9,7 +9,6 @@ import javafx.stage.Stage;
import org.cryptomator.common.vaults.Vault; import org.cryptomator.common.vaults.Vault;
import org.cryptomator.cryptolib.api.InvalidPassphraseException; import org.cryptomator.cryptolib.api.InvalidPassphraseException;
import org.cryptomator.ui.common.Animations; import org.cryptomator.ui.common.Animations;
import org.cryptomator.ui.common.ErrorComponent;
import org.cryptomator.ui.common.FxController; import org.cryptomator.ui.common.FxController;
import org.cryptomator.ui.common.FxmlFile; import org.cryptomator.ui.common.FxmlFile;
import org.cryptomator.ui.common.FxmlScene; import org.cryptomator.ui.common.FxmlScene;
@@ -32,20 +31,16 @@ public class RecoveryKeyCreationController implements FxController {
private final ExecutorService executor; private final ExecutorService executor;
private final RecoveryKeyFactory recoveryKeyFactory; private final RecoveryKeyFactory recoveryKeyFactory;
private final StringProperty recoveryKeyProperty; private final StringProperty recoveryKeyProperty;
private final Lazy<Scene> createScene;
private final ErrorComponent.Builder errorComponent;
public NiceSecurePasswordField passwordField; public NiceSecurePasswordField passwordField;
@Inject @Inject
public RecoveryKeyCreationController(@RecoveryKeyWindow Stage window, @FxmlScene(FxmlFile.RECOVERYKEY_SUCCESS) Lazy<Scene> successScene, @RecoveryKeyWindow Vault vault, RecoveryKeyFactory recoveryKeyFactory, ExecutorService executor, @RecoveryKeyWindow StringProperty recoveryKey, @FxmlScene(FxmlFile.RECOVERYKEY_CREATE) Lazy<Scene> createScene, ErrorComponent.Builder errorComponent) { public RecoveryKeyCreationController(@RecoveryKeyWindow Stage window, @FxmlScene(FxmlFile.RECOVERYKEY_SUCCESS) Lazy<Scene> successScene, @RecoveryKeyWindow Vault vault, RecoveryKeyFactory recoveryKeyFactory, ExecutorService executor, @RecoveryKeyWindow StringProperty recoveryKey) {
this.window = window; this.window = window;
this.successScene = successScene; this.successScene = successScene;
this.vault = vault; this.vault = vault;
this.executor = executor; this.executor = executor;
this.recoveryKeyFactory = recoveryKeyFactory; this.recoveryKeyFactory = recoveryKeyFactory;
this.recoveryKeyProperty = recoveryKey; this.recoveryKeyProperty = recoveryKey;
this.createScene = createScene;
this.errorComponent = errorComponent;
} }
@FXML @FXML
@@ -64,7 +59,6 @@ public class RecoveryKeyCreationController implements FxController {
Animations.createShakeWindowAnimation(window).play(); Animations.createShakeWindowAnimation(window).play();
} else { } else {
LOG.error("Creation of recovery key failed.", task.getException()); LOG.error("Creation of recovery key failed.", task.getException());
errorComponent.cause(task.getException()).window(window).returnToScene(createScene.get()).build().showErrorScene();
} }
}); });
executor.submit(task); executor.submit(task);