mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-05-18 02:31:27 +00:00
moved provideDefaultMountService to MountModule and renamed problematicFuseMountServices to CONFLICTING_MOUNT_SERVICES
This commit is contained in:
@@ -21,11 +21,9 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.SecureRandom;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
@@ -143,13 +141,4 @@ public abstract class CommonsModule {
|
||||
return new AtomicReference<>(null);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
static ObservableValue<MountService> provideDefaultMountService(List<MountService> mountProviders, Settings settings) {
|
||||
var fallbackProvider = mountProviders.stream().findFirst().orElse(null);
|
||||
|
||||
return ObservableUtil.mapWithDefault(settings.mountService, //
|
||||
serviceName -> mountProviders.stream().filter(s -> s.getClass().getName().equals(serviceName)).findFirst().orElse(fallbackProvider), //
|
||||
fallbackProvider);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,9 +2,12 @@ package org.cryptomator.common.mount;
|
||||
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import org.cryptomator.common.ObservableUtil;
|
||||
import org.cryptomator.common.settings.Settings;
|
||||
import org.cryptomator.integrations.mount.MountService;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import java.util.List;
|
||||
|
||||
@Module
|
||||
@@ -16,4 +19,14 @@ public class MountModule {
|
||||
return MountService.get().toList();
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
static ObservableValue<MountService> provideDefaultMountService(List<MountService> mountProviders, Settings settings) {
|
||||
var fallbackProvider = mountProviders.stream().findFirst().orElse(null);
|
||||
|
||||
return ObservableUtil.mapWithDefault(settings.mountService, //
|
||||
serviceName -> mountProviders.stream().filter(s -> s.getClass().getName().equals(serviceName)).findFirst().orElse(fallbackProvider), //
|
||||
fallbackProvider);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ import static org.cryptomator.integrations.mount.MountCapability.UNMOUNT_FORCED;
|
||||
@Singleton
|
||||
public class Mounter {
|
||||
|
||||
private static final List<String> problematicFuseMountServices = List.of("org.cryptomator.frontend.fuse.mount.MacFuseMountProvider", "org.cryptomator.frontend.fuse.mount.FuseTMountProvider");
|
||||
private static final List<String> CONFLICTING_MOUNT_SERVICES = List.of("org.cryptomator.frontend.fuse.mount.MacFuseMountProvider", "org.cryptomator.frontend.fuse.mount.FuseTMountProvider");
|
||||
private final Environment env;
|
||||
private final Settings settings;
|
||||
private final WindowsDriveLetters driveLetters;
|
||||
@@ -40,7 +40,8 @@ public class Mounter {
|
||||
Settings settings, //
|
||||
WindowsDriveLetters driveLetters, //
|
||||
List<MountService> mountProviders, //
|
||||
@Named("FUPFMS") AtomicReference<MountService> firstUsedProblematicFuseMountService, ObservableValue<MountService> defaultMountService) {
|
||||
@Named("FUPFMS") AtomicReference<MountService> firstUsedProblematicFuseMountService, //
|
||||
ObservableValue<MountService> defaultMountService) {
|
||||
this.env = env;
|
||||
this.settings = settings;
|
||||
this.driveLetters = driveLetters;
|
||||
@@ -164,7 +165,7 @@ public class Mounter {
|
||||
}
|
||||
|
||||
public static boolean isProblematicFuseService(MountService service) {
|
||||
return problematicFuseMountServices.contains(service.getClass().getName());
|
||||
return CONFLICTING_MOUNT_SERVICES.contains(service.getClass().getName());
|
||||
}
|
||||
|
||||
public record MountHandle(Mount mountObj, boolean supportsUnmountForced, Runnable specialCleanup) {
|
||||
|
||||
Reference in New Issue
Block a user