浏览代码

Add time unit parameter

Rexbas 1 年之前
父节点
当前提交
32d7189a12

+ 2 - 2
src/main/java/org/cryptomator/ui/fxapp/AutoUnlocker.java

@@ -33,7 +33,7 @@ public class AutoUnlocker {
 		this.scheduler = scheduler;
 	}
 
-	public void tryUnlockForTimespan(int timespan) {
+	public void tryUnlockForTimespan(int timespan, TimeUnit timeUnit) {
 		// Unlock all available auto unlock vaults
 		unlock(vaults.stream().filter(v -> v.getVaultSettings().unlockAfterStartup().get()));
 
@@ -41,7 +41,7 @@ public class AutoUnlocker {
 		if (getMissingAutoUnlockVaults().findAny().isPresent()) {
 			LOG.info("Found MISSING vaults, starting periodic check");
 			unlockMissingFuture = scheduler.scheduleWithFixedDelay(this::unlockMissing, 0, 1, TimeUnit.SECONDS);
-			timeoutFuture = scheduler.schedule(this::timeout, timespan, TimeUnit.MINUTES);
+			timeoutFuture = scheduler.schedule(this::timeout, timespan, timeUnit);
 		}
 	}
 

+ 2 - 1
src/main/java/org/cryptomator/ui/fxapp/FxApplication.java

@@ -9,6 +9,7 @@ import org.slf4j.LoggerFactory;
 import javax.inject.Inject;
 import javax.inject.Named;
 import javafx.application.Platform;
+import java.util.concurrent.TimeUnit;
 
 @FxApplicationScoped
 public class FxApplication {
@@ -68,6 +69,6 @@ public class FxApplication {
 		});
 
 		launchEventHandler.startHandlingLaunchEvents();
-		autoUnlocker.tryUnlockForTimespan(2);
+		autoUnlocker.tryUnlockForTimespan(2, TimeUnit.MINUTES);
 	}
 }