use of bisq.desktop.main.overlays.windows.DisplayAlertMessageWindow in project bisq-desktop by bisq-network.
the class MainViewModel method displayAlertIfPresent.
private void displayAlertIfPresent(Alert alert, boolean openNewVersionPopup) {
if (alert != null) {
if (alert.isUpdateInfo()) {
user.setDisplayedAlert(alert);
final boolean isNewVersion = alert.isNewVersion();
newVersionAvailableProperty.set(isNewVersion);
String key = "Update_" + alert.getVersion();
if (isNewVersion && (preferences.showAgain(key) || openNewVersionPopup)) {
new DisplayUpdateDownloadWindow(alert).actionButtonText(Res.get("displayUpdateDownloadWindow.button.downloadLater")).onAction(() -> {
// update later
preferences.dontShowAgain(key, false);
}).closeButtonText(Res.get("shared.cancel")).onClose(() -> {
// ignore update
preferences.dontShowAgain(key, true);
}).show();
}
} else {
final Alert displayedAlert = user.getDisplayedAlert();
if (displayedAlert == null || !displayedAlert.equals(alert))
new DisplayAlertMessageWindow().alertMessage(alert).onClose(() -> {
user.setDisplayedAlert(alert);
}).show();
}
}
}
Aggregations