mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-04-20 09:36:55 -04:00
Merge branch 'develop' into feature/vault-volume-type
# Conflicts: # src/main/java/org/cryptomator/ui/unlock/UnlockWorkflow.java
This commit is contained in:
@@ -19,16 +19,8 @@ import java.util.concurrent.Future;
|
||||
@Subcomponent(modules = {UnlockModule.class})
|
||||
public interface UnlockComponent {
|
||||
|
||||
ExecutorService defaultExecutorService();
|
||||
|
||||
UnlockWorkflow unlockWorkflow();
|
||||
|
||||
default Future<Boolean> startUnlockWorkflow() {
|
||||
UnlockWorkflow workflow = unlockWorkflow();
|
||||
defaultExecutorService().submit(workflow);
|
||||
return workflow;
|
||||
}
|
||||
|
||||
@Subcomponent.Factory
|
||||
interface Factory {
|
||||
UnlockComponent create(@BindsInstance @UnlockWindow Vault vault, @BindsInstance @Named("unlockWindowOwner") @Nullable Stage owner);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
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;
|
||||
@@ -30,7 +29,7 @@ import java.io.IOException;
|
||||
* This class runs the unlock process and controls when to display which UI.
|
||||
*/
|
||||
@UnlockScoped
|
||||
public class UnlockWorkflow extends Task<Boolean> {
|
||||
public class UnlockWorkflow extends Task<Void> {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(UnlockWorkflow.class);
|
||||
|
||||
@@ -66,25 +65,17 @@ public class UnlockWorkflow extends Task<Boolean> {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Boolean call() throws InterruptedException, IOException, CryptoException, MountFailedException {
|
||||
try {
|
||||
attemptUnlock();
|
||||
return true;
|
||||
} catch (UnlockCancelledException e) {
|
||||
cancel(false); // set Tasks state to cancelled
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void attemptUnlock() throws IOException, CryptoException, MountFailedException {
|
||||
protected Void call() throws InterruptedException, IOException, CryptoException, MountFailedException {
|
||||
try {
|
||||
keyLoadingStrategy.use(vault::unlock);
|
||||
return null;
|
||||
} catch (UnlockCancelledException e) {
|
||||
cancel(false); // set Tasks state to cancelled
|
||||
return null;
|
||||
} catch (IOException | RuntimeException | MountFailedException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
Throwables.propagateIfPossible(e, IOException.class);
|
||||
Throwables.propagateIfPossible(e, CryptoException.class);
|
||||
Throwables.propagateIfPossible(e, IllegalMountPointException.class);
|
||||
Throwables.propagateIfPossible(e, MountFailedException.class);
|
||||
throw new IllegalStateException("unexpected exception type", e);
|
||||
throw new IllegalStateException("Unexpected exception type", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user