mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-05-14 08:41:28 +00:00
moved logic of update checking from FxApplication class to UpdateReminderComponent
This commit is contained in:
@@ -9,7 +9,6 @@ import org.slf4j.LoggerFactory;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import javafx.application.Platform;
|
||||
import java.time.LocalDate;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@FxApplicationScoped
|
||||
@@ -69,9 +68,7 @@ public class FxApplication {
|
||||
return null;
|
||||
});
|
||||
|
||||
if (LocalDate.parse(settings.lastUpdateCheck.get()).isBefore(LocalDate.now().minusDays(14)) && !settings.checkForUpdates.getValue()) {
|
||||
appWindows.showUpdateReminderWindow();
|
||||
}
|
||||
appWindows.checkAndShowUpdateReminderWindow();
|
||||
|
||||
launchEventHandler.startHandlingLaunchEvents();
|
||||
autoUnlocker.tryUnlockForTimespan(2, TimeUnit.MINUTES);
|
||||
|
||||
@@ -130,8 +130,8 @@ public class FxApplicationWindows {
|
||||
CompletableFuture.runAsync(() -> quitWindowBuilder.build().showQuitWindow(response,forced), Platform::runLater);
|
||||
}
|
||||
|
||||
public void showUpdateReminderWindow() {
|
||||
CompletableFuture.runAsync(() -> updateReminderWindowBuilder.create().showUpdateReminderWindow(), Platform::runLater);
|
||||
public void checkAndShowUpdateReminderWindow() {
|
||||
CompletableFuture.runAsync(() -> updateReminderWindowBuilder.create().checkAndShowUpdateReminderWindow(), Platform::runLater);
|
||||
}
|
||||
|
||||
public CompletionStage<Void> startUnlockWorkflow(Vault vault, @Nullable Stage owner) {
|
||||
|
||||
@@ -2,11 +2,13 @@ package org.cryptomator.ui.updatereminder;
|
||||
|
||||
import dagger.Lazy;
|
||||
import dagger.Subcomponent;
|
||||
import org.cryptomator.common.settings.Settings;
|
||||
import org.cryptomator.ui.common.FxmlFile;
|
||||
import org.cryptomator.ui.common.FxmlScene;
|
||||
|
||||
import javafx.scene.Scene;
|
||||
import javafx.stage.Stage;
|
||||
import java.time.LocalDate;
|
||||
|
||||
@UpdateReminderScoped
|
||||
@Subcomponent(modules = {UpdateReminderModule.class})
|
||||
@@ -18,11 +20,15 @@ public interface UpdateReminderComponent {
|
||||
@FxmlScene(FxmlFile.UPDATE_REMINDER)
|
||||
Lazy<Scene> updateReminderScene();
|
||||
|
||||
default void showUpdateReminderWindow() {
|
||||
Stage stage = window();
|
||||
stage.setScene(updateReminderScene().get());
|
||||
stage.sizeToScene();
|
||||
stage.show();
|
||||
Settings settings();
|
||||
|
||||
default void checkAndShowUpdateReminderWindow() {
|
||||
if (LocalDate.parse(settings().lastUpdateCheck.get()).isBefore(LocalDate.now().minusDays(14)) && !settings().checkForUpdates.getValue()) {
|
||||
Stage stage = window();
|
||||
stage.setScene(updateReminderScene().get());
|
||||
stage.sizeToScene();
|
||||
stage.show();
|
||||
}
|
||||
}
|
||||
|
||||
@Subcomponent.Factory
|
||||
|
||||
Reference in New Issue
Block a user