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