confirm and close application before launching installer

This commit is contained in:
Craig Raw 2024-02-22 14:56:38 +02:00
parent 78b0c63f87
commit 6f4d37d3ff

View file

@ -99,7 +99,15 @@ public class DownloadVerifierDialog extends Dialog<ButtonBar.ButtonData> {
releaseVerifiedField.getInputs().add(releaseLink); releaseVerifiedField.getInputs().add(releaseLink);
releaseLink.setOnAction(event -> { releaseLink.setOnAction(event -> {
if(release.get() != null && release.get().exists()) { if(release.get() != null && release.get().exists()) {
AppServices.get().getApplication().getHostServices().showDocument("file://" + release.get().getAbsolutePath()); if(release.get().getName().toLowerCase(Locale.ROOT).startsWith("sparrow")) {
Optional<ButtonType> optType = AppServices.showAlertDialog("Close Sparrow?", "Close Sparrow before installing?", Alert.AlertType.CONFIRMATION, ButtonType.NO, ButtonType.YES);
if(optType.isPresent() && optType.get() == ButtonType.YES) {
javafx.application.Platform.exit();
AppServices.get().getApplication().getHostServices().showDocument("file://" + release.get().getAbsolutePath());
}
} else {
AppServices.get().getApplication().getHostServices().showDocument("file://" + release.get().getAbsolutePath());
}
} }
}); });