mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-05-18 10:41:26 +00:00
introduced FuseRestartRequiredException and UnlockFuseRestartRequired window
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
package org.cryptomator.common.mount;
|
||||
|
||||
import org.cryptomator.integrations.mount.MountFailedException;
|
||||
|
||||
public class FuseRestartRequiredException extends MountFailedException {
|
||||
public FuseRestartRequiredException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ import org.apache.commons.lang3.SystemUtils;
|
||||
import org.cryptomator.common.Constants;
|
||||
import org.cryptomator.common.ObservableUtil;
|
||||
import org.cryptomator.common.mount.ActualMountService;
|
||||
import org.cryptomator.common.mount.FuseRestartRequiredException;
|
||||
import org.cryptomator.common.mount.Mounter;
|
||||
import org.cryptomator.common.mount.WindowsDriveLetters;
|
||||
import org.cryptomator.common.settings.VaultSettings;
|
||||
@@ -163,7 +164,7 @@ public class Vault {
|
||||
&& VaultModule.isProblematicFuseService(s) //
|
||||
&& !firstUsedProblematicFuseMountService.get().equals(s)).getValue();
|
||||
if(fuseRestartRequired){
|
||||
throw new MountFailedException("fuseRestartRequired");
|
||||
throw new FuseRestartRequiredException("fuseRestartRequired");
|
||||
}
|
||||
|
||||
CryptoFileSystem fs = createCryptoFileSystem(keyLoader);
|
||||
|
||||
@@ -44,6 +44,7 @@ public enum FxmlFile {
|
||||
REMOVE_VAULT("/fxml/remove_vault.fxml"), //
|
||||
UPDATE_REMINDER("/fxml/update_reminder.fxml"), //
|
||||
UNLOCK_ENTER_PASSWORD("/fxml/unlock_enter_password.fxml"),
|
||||
UNLOCK_FUSE_RESTART_REQUIRED("/fxml/unlock_fuse_restart_required.fxml"), //
|
||||
UNLOCK_INVALID_MOUNT_POINT("/fxml/unlock_invalid_mount_point.fxml"), //
|
||||
UNLOCK_SELECT_MASTERKEYFILE("/fxml/unlock_select_masterkeyfile.fxml"), //
|
||||
UNLOCK_SUCCESS("/fxml/unlock_success.fxml"), //
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package org.cryptomator.ui.unlock;
|
||||
|
||||
import org.cryptomator.common.vaults.Vault;
|
||||
import org.cryptomator.ui.common.FxController;
|
||||
import org.cryptomator.ui.fxapp.FxApplicationWindows;
|
||||
import org.cryptomator.ui.vaultoptions.SelectedVaultOptionsTab;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
@UnlockScoped
|
||||
public class UnlockFuseRestartRequiredController implements FxController {
|
||||
|
||||
private final Stage window;
|
||||
private final FxApplicationWindows appWindows;
|
||||
private final Vault vault;
|
||||
@Inject
|
||||
UnlockFuseRestartRequiredController(@UnlockWindow Stage window, //
|
||||
FxApplicationWindows appWindows, //
|
||||
@UnlockWindow Vault vault) {
|
||||
this.window = window;
|
||||
this.appWindows = appWindows;
|
||||
this.vault = vault;
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void close() {
|
||||
window.close();
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void closeAndOpenVaultOptions() {
|
||||
appWindows.showVaultOptionsWindow(vault, SelectedVaultOptionsTab.MOUNT);
|
||||
window.close();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -81,6 +81,13 @@ abstract class UnlockModule {
|
||||
return fxmlLoaders.createScene(FxmlFile.UNLOCK_INVALID_MOUNT_POINT);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@FxmlScene(FxmlFile.UNLOCK_FUSE_RESTART_REQUIRED)
|
||||
@UnlockScoped
|
||||
static Scene provideFuseRestartRequiredScene(@UnlockWindow FxmlLoaderFactory fxmlLoaders) {
|
||||
return fxmlLoaders.createScene(FxmlFile.UNLOCK_FUSE_RESTART_REQUIRED);
|
||||
}
|
||||
|
||||
// ------------------
|
||||
|
||||
@Binds
|
||||
@@ -93,4 +100,9 @@ abstract class UnlockModule {
|
||||
@FxControllerKey(UnlockInvalidMountPointController.class)
|
||||
abstract FxController bindUnlockInvalidMountPointController(UnlockInvalidMountPointController controller);
|
||||
|
||||
@Binds
|
||||
@IntoMap
|
||||
@FxControllerKey(UnlockFuseRestartRequiredController.class)
|
||||
abstract FxController bindUnlockFuseRestartRequiredController(UnlockFuseRestartRequiredController controller);
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.cryptomator.ui.unlock;
|
||||
|
||||
import com.google.common.base.Throwables;
|
||||
import dagger.Lazy;
|
||||
import org.cryptomator.common.mount.FuseRestartRequiredException;
|
||||
import org.cryptomator.common.mount.IllegalMountPointException;
|
||||
import org.cryptomator.common.vaults.Vault;
|
||||
import org.cryptomator.common.vaults.VaultState;
|
||||
@@ -38,17 +39,27 @@ public class UnlockWorkflow extends Task<Boolean> {
|
||||
private final VaultService vaultService;
|
||||
private final Lazy<Scene> successScene;
|
||||
private final Lazy<Scene> invalidMountPointScene;
|
||||
private final Lazy<Scene> fuseRestartRequiredScene;
|
||||
private final FxApplicationWindows appWindows;
|
||||
private final KeyLoadingStrategy keyLoadingStrategy;
|
||||
private final ObjectProperty<IllegalMountPointException> illegalMountPointException;
|
||||
|
||||
@Inject
|
||||
UnlockWorkflow(@UnlockWindow Stage window, @UnlockWindow Vault vault, VaultService vaultService, @FxmlScene(FxmlFile.UNLOCK_SUCCESS) Lazy<Scene> successScene, @FxmlScene(FxmlFile.UNLOCK_INVALID_MOUNT_POINT) Lazy<Scene> invalidMountPointScene, FxApplicationWindows appWindows, @UnlockWindow KeyLoadingStrategy keyLoadingStrategy, @UnlockWindow ObjectProperty<IllegalMountPointException> illegalMountPointException) {
|
||||
UnlockWorkflow(@UnlockWindow Stage window, //
|
||||
@UnlockWindow Vault vault, //
|
||||
VaultService vaultService, //
|
||||
@FxmlScene(FxmlFile.UNLOCK_SUCCESS) Lazy<Scene> successScene, //
|
||||
@FxmlScene(FxmlFile.UNLOCK_INVALID_MOUNT_POINT) Lazy<Scene> invalidMountPointScene, //
|
||||
@FxmlScene(FxmlFile.UNLOCK_FUSE_RESTART_REQUIRED) Lazy<Scene> fuseRestartRequiredScene, //
|
||||
FxApplicationWindows appWindows, //
|
||||
@UnlockWindow KeyLoadingStrategy keyLoadingStrategy, //
|
||||
@UnlockWindow ObjectProperty<IllegalMountPointException> illegalMountPointException) {
|
||||
this.window = window;
|
||||
this.vault = vault;
|
||||
this.vaultService = vaultService;
|
||||
this.successScene = successScene;
|
||||
this.invalidMountPointScene = invalidMountPointScene;
|
||||
this.fuseRestartRequiredScene = fuseRestartRequiredScene;
|
||||
this.appWindows = appWindows;
|
||||
this.keyLoadingStrategy = keyLoadingStrategy;
|
||||
this.illegalMountPointException = illegalMountPointException;
|
||||
@@ -85,6 +96,13 @@ public class UnlockWorkflow extends Task<Boolean> {
|
||||
});
|
||||
}
|
||||
|
||||
private void handleFuseRestartRequiredError(FuseRestartRequiredException frre) {
|
||||
Platform.runLater(() -> {
|
||||
window.setScene(fuseRestartRequiredScene.get());
|
||||
window.show();
|
||||
});
|
||||
}
|
||||
|
||||
private void handleGenericError(Throwable e) {
|
||||
LOG.error("Unlock failed for technical reasons.", e);
|
||||
appWindows.showErrorWindow(e, window, null);
|
||||
@@ -115,6 +133,9 @@ public class UnlockWorkflow extends Task<Boolean> {
|
||||
Throwable throwable = super.getException();
|
||||
if(throwable instanceof IllegalMountPointException impe) {
|
||||
handleIllegalMountPointError(impe);
|
||||
}
|
||||
else if (throwable instanceof FuseRestartRequiredException fRRE) {
|
||||
handleFuseRestartRequiredError(fRRE);
|
||||
} else {
|
||||
handleGenericError(throwable);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user