From d59f149f7c5a577709d865318f04222f5155ffd9 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Tue, 6 Aug 2024 15:17:18 +0200 Subject: [PATCH] Load quick access service lazy --- src/main/java/org/cryptomator/common/CommonsModule.java | 6 ------ src/main/java/org/cryptomator/common/vaults/Vault.java | 6 ++---- .../ui/preferences/GeneralPreferencesController.java | 4 ++-- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/src/main/java/org/cryptomator/common/CommonsModule.java b/src/main/java/org/cryptomator/common/CommonsModule.java index e5738972f..4f9cbab21 100644 --- a/src/main/java/org/cryptomator/common/CommonsModule.java +++ b/src/main/java/org/cryptomator/common/CommonsModule.java @@ -130,12 +130,6 @@ public abstract class CommonsModule { return executorService; } - @Provides - @Singleton - static List provideQuickAccessServices() { - return QuickAccessService.get().toList(); - } - private static void handleUncaughtExceptionInBackgroundThread(Thread thread, Throwable throwable) { LOG.error("Uncaught exception in " + thread.getName(), throwable); } diff --git a/src/main/java/org/cryptomator/common/vaults/Vault.java b/src/main/java/org/cryptomator/common/vaults/Vault.java index 4a0cbe865..4f4ac0da5 100644 --- a/src/main/java/org/cryptomator/common/vaults/Vault.java +++ b/src/main/java/org/cryptomator/common/vaults/Vault.java @@ -74,7 +74,6 @@ public class Vault { private final ObjectBinding mountPoint; private final Mounter mounter; private final Settings settings; - private final List quickAccessServices; private final BooleanProperty showingStats; private final AtomicReference mountHandle = new AtomicReference<>(null); @@ -86,7 +85,7 @@ public class Vault { VaultState state, // @Named("lastKnownException") ObjectProperty lastKnownException, // VaultStats stats, // - Mounter mounter, Settings settings, List quickAccessServices) { + Mounter mounter, Settings settings) { this.vaultSettings = vaultSettings; this.configCache = configCache; this.cryptoFileSystem = cryptoFileSystem; @@ -103,7 +102,6 @@ public class Vault { this.mountPoint = Bindings.createObjectBinding(this::getMountPoint, state); this.mounter = mounter; this.settings = settings; - this.quickAccessServices = quickAccessServices; this.showingStats = new SimpleBooleanProperty(false); this.quickAccessEntry = new AtomicReference<>(null); } @@ -207,7 +205,7 @@ public class Vault { return; } - quickAccessServices.stream() // + QuickAccessService.get() // .filter(s -> s.getClass().getName().equals(settings.quickAccessService.getValue())) // .findFirst() // .ifPresentOrElse( // diff --git a/src/main/java/org/cryptomator/ui/preferences/GeneralPreferencesController.java b/src/main/java/org/cryptomator/ui/preferences/GeneralPreferencesController.java index caae57306..800a292a9 100644 --- a/src/main/java/org/cryptomator/ui/preferences/GeneralPreferencesController.java +++ b/src/main/java/org/cryptomator/ui/preferences/GeneralPreferencesController.java @@ -48,12 +48,12 @@ public class GeneralPreferencesController implements FxController { public ToggleGroup nodeOrientation; @Inject - GeneralPreferencesController(@PreferencesWindow Stage window, Settings settings, Optional autoStartProvider, List keychainAccessProviders, List quickAccessServices, Application application, Environment environment, FxApplicationWindows appWindows) { + GeneralPreferencesController(@PreferencesWindow Stage window, Settings settings, Optional autoStartProvider, List keychainAccessProviders, Application application, Environment environment, FxApplicationWindows appWindows) { this.window = window; this.settings = settings; this.autoStartProvider = autoStartProvider; this.keychainAccessProviders = keychainAccessProviders; - this.quickAccessServices = quickAccessServices; + this.quickAccessServices = QuickAccessService.get().toList(); this.application = application; this.environment = environment; this.appWindows = appWindows;