change scope of HostServiceRevealer to @FxApplicationScoped

because unlock always happens after application start anyway
This commit is contained in:
Sebastian Stenzel
2021-01-22 09:31:43 +01:00
parent 7cd5c66836
commit b1d7cfc81b

View File

@@ -1,24 +1,25 @@
package org.cryptomator.ui.common;
import dagger.Lazy;
import org.cryptomator.common.vaults.Volume;
import org.cryptomator.ui.launcher.FxApplicationStarter;
import org.cryptomator.ui.fxapp.FxApplicationScoped;
import javax.inject.Inject;
import javax.inject.Singleton;
import javafx.application.Application;
import java.nio.file.Path;
@Singleton
@FxApplicationScoped
public class HostServiceRevealer implements Volume.Revealer {
private final FxApplicationStarter fxApplicationStarter;
private final Lazy<Application> application;
@Inject
public HostServiceRevealer(FxApplicationStarter fxApplicationStarter) {
this.fxApplicationStarter = fxApplicationStarter;
public HostServiceRevealer(Lazy<Application> application) {
this.application = application;
}
@Override
public void reveal(Path p) throws Volume.VolumeException {
fxApplicationStarter.get().thenAccept(app -> app.getHostServices().showDocument(p.toUri().toString()));
application.get().getHostServices().showDocument(p.toUri().toString());
}
}