mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-05-18 18:51:26 +00:00
Change logic on how the config wrapper is injected
This commit is contained in:
@@ -10,6 +10,7 @@ import dagger.Subcomponent;
|
||||
import org.cryptomator.common.Nullable;
|
||||
import org.cryptomator.common.mountpoint.MountPointChooserModule;
|
||||
import org.cryptomator.common.settings.VaultSettings;
|
||||
import org.cryptomator.cryptofs.VaultConfig;
|
||||
|
||||
import javax.inject.Named;
|
||||
|
||||
@@ -25,6 +26,9 @@ public interface VaultComponent {
|
||||
@BindsInstance
|
||||
Builder vaultSettings(VaultSettings vaultSettings);
|
||||
|
||||
@BindsInstance
|
||||
Builder vaultConfigWrapper(VaultConfigWrapper rapper);
|
||||
|
||||
@BindsInstance
|
||||
Builder initialVaultState(VaultState.Value vaultState);
|
||||
|
||||
|
||||
@@ -17,13 +17,11 @@ import java.util.Objects;
|
||||
/**
|
||||
* Wrapper for lazy loading and on-demand reloading of the vault configuration.
|
||||
*/
|
||||
@PerVault
|
||||
public class VaultConfigWrapper {
|
||||
|
||||
private final VaultSettings settings;
|
||||
private final ObjectProperty<VaultConfig.UnverifiedVaultConfig> config;
|
||||
|
||||
@Inject
|
||||
VaultConfigWrapper(VaultSettings settings) {
|
||||
this.settings = settings;
|
||||
this.config = new SimpleObjectProperty<>();
|
||||
|
||||
@@ -98,8 +98,9 @@ public class VaultListManager {
|
||||
try {
|
||||
VaultState.Value vaultState = determineVaultState(vaultSettings.path().get());
|
||||
if (vaultState == LOCKED) {
|
||||
//TODO: maybe already set it in the vault Wrapper ?
|
||||
VaultConfig.UnverifiedVaultConfig config = VaultConfigWrapper.readConfigFromStorage(vaultSettings.path().get());
|
||||
VaultConfigWrapper wrapper = new VaultConfigWrapper(vaultSettings);
|
||||
compBuilder.vaultConfigWrapper(wrapper); //first set the wrapper in the builder, THEN try to load config
|
||||
wrapper.reloadConfig();
|
||||
}
|
||||
compBuilder.initialVaultState(vaultState);
|
||||
} catch (IOException e) {
|
||||
|
||||
Reference in New Issue
Block a user