Search in sources :

Example 1 with DisplayAlertMessageWindow

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();
        }
    }
}
Also used : DisplayAlertMessageWindow(bisq.desktop.main.overlays.windows.DisplayAlertMessageWindow) DisplayUpdateDownloadWindow(bisq.desktop.main.overlays.windows.downloadupdate.DisplayUpdateDownloadWindow) Alert(bisq.core.alert.Alert)

Aggregations

Alert (bisq.core.alert.Alert)1 DisplayAlertMessageWindow (bisq.desktop.main.overlays.windows.DisplayAlertMessageWindow)1 DisplayUpdateDownloadWindow (bisq.desktop.main.overlays.windows.downloadupdate.DisplayUpdateDownloadWindow)1