code cleanup

This commit is contained in:
Jan-Peter Klein 2024-03-08 10:27:35 +01:00
parent db224e9e5c
commit 1ed77ebcc0
No known key found for this signature in database
GPG Key ID: 90EDA3A7C822FD0E
2 changed files with 3 additions and 6 deletions

View File

@ -87,7 +87,6 @@ public class UpdateChecker {
String latestVersion = updateCheckerService.getValue();
LOG.info("Current version: {}, latest version: {}", getCurrentVersion(), latestVersion);
updateCheckTimeProperty.set(LocalDateTime.now());
//settings.lastUpdateCheck.set(updateCheckTimeProperty.get().toString());
latestVersionProperty.set(latestVersion);
state.set(UpdateCheckState.CHECK_SUCCESSFUL);
}
@ -114,7 +113,7 @@ public class UpdateChecker {
}
public String getCurrentVersion() {
return "1.12.3";//env.getAppVersion();
return env.getAppVersion();
}
public ObjectProperty<LocalDateTime> updateCheckTimeProperty() {

View File

@ -28,7 +28,6 @@ import java.util.Comparator;
import java.util.Locale;
@PreferencesScoped
public class UpdatesPreferencesController implements FxController {
@ -77,7 +76,7 @@ public class UpdatesPreferencesController implements FxController {
checkForUpdatesCheckbox.selectedProperty().bindBidirectional(settings.checkForUpdates);
DateTimeFormatter formatter = DateTimeFormatter.ofLocalizedDateTime(FormatStyle.MEDIUM).withLocale(Locale.getDefault());
updateCheckDateFormattedLabel.arg1Property().bind(Bindings.createStringBinding(() -> (!updateCheckDateProperty.get().equals(LocalDateTime.parse(Settings.DEFAULT_LAST_UPDATE_CHECK)) && latestVersionProperty().isNotNull().get() ) ? updateCheckDateProperty.get().format(formatter) : "-", updateCheckDateProperty, latestVersionProperty()));
updateCheckDateFormattedLabel.arg1Property().bind(Bindings.createStringBinding(() -> (!updateCheckDateProperty.get().equals(LocalDateTime.parse(Settings.DEFAULT_LAST_UPDATE_CHECK)) && latestVersionProperty().isNotNull().get()) ? updateCheckDateProperty.get().format(formatter) : "-", updateCheckDateProperty, latestVersionProperty()));
BooleanBinding isUpdateCheckFailed = updateCheckStateProperty.isEqualTo(UpdateChecker.UpdateCheckState.CHECK_FAILED);
checkFailedHBox.managedProperty().bind(isUpdateCheckFailed);
@ -85,8 +84,7 @@ public class UpdatesPreferencesController implements FxController {
latestVersionFormattedLabel.arg1Property().bind(Bindings.createStringBinding(() -> (latestVersion.get() != null) ? latestVersion.get() : "-", latestVersion));
BooleanBinding isUpdateSuccessfulAndCurrent = updateCheckStateProperty.isEqualTo(UpdateChecker.UpdateCheckState.CHECK_SUCCESSFUL)
.and(latestVersion.isEqualTo(currentVersion));
BooleanBinding isUpdateSuccessfulAndCurrent = updateCheckStateProperty.isEqualTo(UpdateChecker.UpdateCheckState.CHECK_SUCCESSFUL).and(latestVersion.isEqualTo(currentVersion));
updateCheckStateProperty.addListener((_, _, _) -> {
if (isUpdateSuccessfulAndCurrent.get()) {