Load quick access service lazy

This commit is contained in:
Armin Schrenk
2024-08-06 15:17:18 +02:00
parent 028f6e7a02
commit d59f149f7c
3 changed files with 4 additions and 12 deletions

View File

@@ -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);
}

View File

@@ -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( //

View File

@@ -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;