refactored updateChecker by incorporating state management and date tracking

This commit is contained in:
Jan-Peter Klein
2024-02-29 09:29:26 +01:00
parent 2302db6206
commit 4064b61cd7
5 changed files with 96 additions and 42 deletions
@@ -8,6 +8,7 @@
<?import javafx.scene.control.Hyperlink?>
<?import javafx.scene.layout.VBox?>
<?import org.cryptomator.ui.controls.FontAwesome5Spinner?>
<VBox xmlns:fx="http://javafx.com/fxml"
xmlns="http://javafx.com/javafx"
fx:controller="org.cryptomator.ui.preferences.UpdatesPreferencesController"
@@ -18,19 +19,17 @@
<padding>
<Insets topRightBottomLeft="24"/>
</padding>
<children>
<FormattedLabel format="%preferences.updates.currentVersion" arg1="${controller.currentVersion}" textAlignment="CENTER" wrapText="true"/>
<FormattedLabel format="%preferences.updates.currentVersion" arg1="${controller.currentVersion}" textAlignment="CENTER" wrapText="true"/>
<CheckBox fx:id="checkForUpdatesCheckbox" text="%preferences.updates.autoUpdateCheck"/>
<CheckBox fx:id="checkForUpdatesCheckbox" text="%preferences.updates.autoUpdateCheck"/>
<VBox alignment="CENTER" spacing="12">
<Button text="%preferences.updates.checkNowBtn" defaultButton="true" onAction="#checkNow" contentDisplay="${controller.checkForUpdatesButtonState}">
<graphic>
<FontAwesome5Spinner fx:id="spinner" glyphSize="12"/>
</graphic>
</Button>
<Hyperlink text="${linkLabel.value}" onAction="#visitDownloadsPage" textAlignment="CENTER" wrapText="true" styleClass="hyperlink-underline" visible="${controller.updateAvailable}"/>
</VBox>
</children>
<VBox alignment="CENTER" spacing="12">
<Button text="%preferences.updates.checkNowBtn" defaultButton="true" onAction="#checkNow" contentDisplay="${controller.checkForUpdatesButtonState}">
<graphic>
<FontAwesome5Spinner glyphSize="12"/>
</graphic>
</Button>
<FormattedLabel fx:id="statusFormattedLabel" format="%preferences.updates.status" wrapText="true"/>
<FormattedLabel fx:id="updateCheckDateFormattedLabel" format="%preferences.updates.lastUpdateCheck" textAlignment="CENTER" wrapText="true"/>
<Hyperlink text="${linkLabel.value}" onAction="#visitDownloadsPage" textAlignment="CENTER" wrapText="true" styleClass="hyperlink-underline" visible="${controller.updateAvailable}" managed="${controller.updateAvailable}"/>
</VBox>
</VBox>
@@ -321,6 +321,13 @@ preferences.updates.currentVersion=Current Version: %s
preferences.updates.autoUpdateCheck=Check for updates automatically
preferences.updates.checkNowBtn=Check Now
preferences.updates.updateAvailable=Update to version %s available.
preferences.updates.lastUpdateCheck=The last update check was performed on: %s.
preferences.updates.status=Status: %s
preferences.updates.status.notChecked=Not checked
preferences.updates.status.isChecking=Is checking
preferences.updates.status.checkSuccessful=Check successful
preferences.updates.status.checkFailed=Check failed
## Contribution
preferences.contribute=Support Us
preferences.contribute.registeredFor=Supporter certificate registered for %s