From b47382811fd8d820a7aa5d3a10f1e93590848860 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Tue, 25 May 2021 12:37:29 +0200 Subject: [PATCH] apply ugly workaround for new vault config loading --- .../org/cryptomator/ui/health/StartController.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/main/ui/src/main/java/org/cryptomator/ui/health/StartController.java b/main/ui/src/main/java/org/cryptomator/ui/health/StartController.java index bdd364336..3e9cc5b07 100644 --- a/main/ui/src/main/java/org/cryptomator/ui/health/StartController.java +++ b/main/ui/src/main/java/org/cryptomator/ui/health/StartController.java @@ -21,6 +21,7 @@ import javafx.application.Platform; import javafx.fxml.FXML; import javafx.scene.Scene; import javafx.stage.Stage; +import java.io.IOException; import java.util.Optional; import java.util.concurrent.ExecutorService; import java.util.concurrent.atomic.AtomicReference; @@ -44,13 +45,24 @@ public class StartController implements FxController { @Inject public StartController(@HealthCheckWindow Vault vault, @HealthCheckWindow Stage window, @HealthCheckWindow KeyLoadingStrategy keyLoadingStrategy, ExecutorService executor, AtomicReference masterkeyRef, AtomicReference vaultConfigRef, @FxmlScene(FxmlFile.HEALTH_CHECK_LIST) Lazy checkScene, Lazy errorComponent) { this.window = window; - this.unverifiedVaultConfig = vault.getUnverifiedVaultConfig(); //TODO: prevent workflow at all, if the vault config is emtpy this.keyLoadingStrategy = keyLoadingStrategy; this.executor = executor; this.masterkeyRef = masterkeyRef; this.vaultConfigRef = vaultConfigRef; this.checkScene = checkScene; this.errorComponent = errorComponent; + + //TODO: this is ugly + //idea: delay the loading of the vault config and show a spinner (something like "check/load config") and react to the result of the loading + //or: load vault config in a previous step to see if it is loadable. + VaultConfig.UnverifiedVaultConfig tmp; + try { + tmp = vault.getUnverifiedVaultConfig(); + } catch (IOException e) { + e.printStackTrace(); + tmp = null; + } + this.unverifiedVaultConfig = Optional.ofNullable(tmp); } @FXML