~exprez135/cryptomator-libre

29182156dfceac6407e3eb5be11c42c9d5f0c834 — Sebastian Stenzel 1 year, 7 months ago 357d63f
fixes #1196
1 files changed, 7 insertions(+), 3 deletions(-)

M main/ui/src/main/java/org/cryptomator/ui/launcher/UiLauncher.java
M main/ui/src/main/java/org/cryptomator/ui/launcher/UiLauncher.java => main/ui/src/main/java/org/cryptomator/ui/launcher/UiLauncher.java +7 -3
@@ 62,10 62,10 @@ public class UiLauncher {
		Desktop.getDesktop().addAppEventListener((AppReopenedListener) e -> showMainWindowAsync(hasTrayIcon));

		// auto unlock
		Collection<Vault> vaultsWithAutoUnlockEnabled = vaults.filtered(v -> v.getVaultSettings().unlockAfterStartup().get());
		if (!vaultsWithAutoUnlockEnabled.isEmpty()) {
		Collection<Vault> vaultsToAutoUnlock = vaults.filtered(this::shouldAttemptAutoUnlock);
		if (!vaultsToAutoUnlock.isEmpty()) {
			fxApplicationStarter.get(hasTrayIcon).thenAccept(app -> {
				for (Vault vault : vaultsWithAutoUnlockEnabled){
				for (Vault vault : vaultsToAutoUnlock){
					app.startUnlockWorkflow(vault);
				}
			});


@@ 73,6 73,10 @@ public class UiLauncher {

		launchEventHandler.startHandlingLaunchEvents(hasTrayIcon);
	}
	
	private boolean shouldAttemptAutoUnlock(Vault vault) {
		return vault.isLocked() && vault.getVaultSettings().unlockAfterStartup().get();
	}

	private void showMainWindowAsync(boolean hasTrayIcon) {
		fxApplicationStarter.get(hasTrayIcon).thenAccept(FxApplication::showMainWindow);