Browse Source

Load quick access service lazy

Armin Schrenk 8 months ago
parent
commit
d59f149f7c

+ 0 - 6
src/main/java/org/cryptomator/common/CommonsModule.java

@@ -130,12 +130,6 @@ public abstract class CommonsModule {
 		return executorService;
 	}
 
-	@Provides
-	@Singleton
-	static List<QuickAccessService> provideQuickAccessServices() {
-		return QuickAccessService.get().toList();
-	}
-
 	private static void handleUncaughtExceptionInBackgroundThread(Thread thread, Throwable throwable) {
 		LOG.error("Uncaught exception in " + thread.getName(), throwable);
 	}

+ 2 - 4
src/main/java/org/cryptomator/common/vaults/Vault.java

@@ -74,7 +74,6 @@ public class Vault {
 	private final ObjectBinding<Mountpoint> mountPoint;
 	private final Mounter mounter;
 	private final Settings settings;
-	private final List<QuickAccessService> quickAccessServices;
 	private final BooleanProperty showingStats;
 
 	private final AtomicReference<Mounter.MountHandle> mountHandle = new AtomicReference<>(null);
@@ -86,7 +85,7 @@ public class Vault {
 		  VaultState state, //
 		  @Named("lastKnownException") ObjectProperty<Exception> lastKnownException, //
 		  VaultStats stats, //
-		  Mounter mounter, Settings settings, List<QuickAccessService> 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( //

+ 2 - 2
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> autoStartProvider, List<KeychainAccessProvider> keychainAccessProviders, List<QuickAccessService> quickAccessServices, Application application, Environment environment, FxApplicationWindows appWindows) {
+	GeneralPreferencesController(@PreferencesWindow Stage window, Settings settings, Optional<AutoStartProvider> autoStartProvider, List<KeychainAccessProvider> 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;