Preparation for App Store builds:

possibility to disable update checks by setting java environment variable `-Dcryptomator.updatesManagedExternally=true`
This commit is contained in:
Sebastian Stenzel
2015-11-02 14:15:53 +01:00
parent b254564657
commit 6c4752cee1
8 changed files with 225 additions and 9 deletions
@@ -38,6 +38,7 @@ import javafx.application.Platform;
import javafx.beans.value.ObservableValue;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.Node;
import javafx.scene.control.CheckBox;
import javafx.scene.control.Hyperlink;
import javafx.scene.control.Label;
@@ -53,6 +54,9 @@ public class WelcomeController extends AbstractFXMLViewController {
@FXML
private ImageView botImageView;
@FXML
private Node checkForUpdatesContainer;
@FXML
private CheckBox checkForUpdatesCheckbox;
@@ -93,8 +97,15 @@ public class WelcomeController extends AbstractFXMLViewController {
botImageView.setImage(new Image(getClass().getResource("/bot_welcome.png").toString()));
checkForUpdatesCheckbox.setSelected(settings.isCheckForUpdatesEnabled());
checkForUpdatesCheckbox.selectedProperty().addListener(this::checkForUpdatesChanged);
if (settings.isCheckForUpdatesEnabled()) {
executor.execute(this::checkForUpdates);
if (areUpdatesManagedExternally()) {
checkForUpdatesContainer.setVisible(false);
checkForUpdatesContainer.setManaged(false);
} else {
checkForUpdatesCheckbox.setSelected(settings.isCheckForUpdatesEnabled());
checkForUpdatesCheckbox.selectedProperty().addListener(this::checkForUpdatesChanged);
if (settings.isCheckForUpdatesEnabled()) {
executor.execute(this::checkForUpdates);
}
}
}
@@ -110,7 +121,14 @@ public class WelcomeController extends AbstractFXMLViewController {
}
}
private boolean areUpdatesManagedExternally() {
return Boolean.parseBoolean(System.getProperty("cryptomator.updatesManagedExternally", "false"));
}
private void checkForUpdates() {
if (areUpdatesManagedExternally()) {
return;
}
Platform.runLater(() -> {
checkForUpdatesCheckbox.setVisible(false);
checkForUpdatesStatus.setText(resourceBundle.getString("welcome.checkForUpdates.label.currentlyChecking"));
+8 -7
View File
@@ -27,15 +27,16 @@
<children>
<VBox AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="20.0" prefWidth="400.0" alignment="CENTER" spacing="10.0" cacheShape="true" cache="true">
<Label alignment="CENTER" style="-fx-font-size: 1.5em;" text="%welcome.welcomeLabel" cacheShape="true" cache="true" />
<HBox alignment="CENTER" spacing="5.0" cacheShape="true" cache="true">
<CheckBox fx:id="checkForUpdatesCheckbox" cacheShape="true" cache="true" />
<Label fx:id="checkForUpdatesStatus" text="%welcome.checkForUpdates.label.checkboxLabel" cacheShape="true" cache="true" />
<ProgressIndicator fx:id="checkForUpdatesIndicator" progress="-1" prefWidth="15.0" prefHeight="15.0" visible="false" cacheShape="true" cache="true" cacheHint="SPEED" />
</HBox>
<Hyperlink alignment="CENTER" fx:id="updateLink" onAction="#didClickUpdateLink" visible="false" cacheShape="true" cache="true" />
<VBox fx:id="checkForUpdatesContainer" prefWidth="400.0" alignment="CENTER" spacing="5.0" cacheShape="true" cache="true">
<HBox alignment="CENTER" spacing="5.0" cacheShape="true" cache="true">
<CheckBox fx:id="checkForUpdatesCheckbox" cacheShape="true" cache="true" />
<Label fx:id="checkForUpdatesStatus" text="%welcome.checkForUpdates.label.checkboxLabel" cacheShape="true" cache="true" />
<ProgressIndicator fx:id="checkForUpdatesIndicator" progress="-1" prefWidth="15.0" prefHeight="15.0" visible="false" cacheShape="true" cache="true" cacheHint="SPEED" />
</HBox>
<Hyperlink alignment="CENTER" fx:id="updateLink" onAction="#didClickUpdateLink" visible="false" cacheShape="true" cache="true" />
</VBox>
</VBox>
<ImageView fx:id="botImageView" AnchorPane.leftAnchor="100.0" AnchorPane.topAnchor="200.0" fitHeight="200.0" preserveRatio="true" smooth="false" cache="true"/>
<Line AnchorPane.leftAnchor="4.0" AnchorPane.topAnchor="380.0" startX="0.0" endX="6.0" startY="5.0" endY="0.0" strokeWidth="1.0" cache="true" />