Show update notification msg only if client version is older.

This commit is contained in:
Manfred Karrer 2016-03-20 14:04:13 +01:00
parent c4a1105c09
commit 0e2ccbcdb9
3 changed files with 8 additions and 5 deletions

View file

@ -33,7 +33,7 @@ public final class Alert implements StoragePayload {
// That object is sent over the wire, so we need to take care of version compatibility. // That object is sent over the wire, so we need to take care of version compatibility.
private static final long serialVersionUID = Version.P2P_NETWORK_VERSION; private static final long serialVersionUID = Version.P2P_NETWORK_VERSION;
private static final Logger log = LoggerFactory.getLogger(Alert.class); private static final Logger log = LoggerFactory.getLogger(Alert.class);
private static final long TTL = TimeUnit.DAYS.toMillis(10); private static final long TTL = TimeUnit.DAYS.toMillis(21);
public final String message; public final String message;
public final String version; public final String version;

View file

@ -671,6 +671,7 @@ public class MainViewModel implements ViewModel {
user.setDisplayedAlert(alert); user.setDisplayedAlert(alert);
if (alert != null && !alreadyDisplayed) { if (alert != null && !alreadyDisplayed) {
if (!alert.isUpdateInfo || !alert.version.equals(Version.VERSION))
new DisplayAlertMessageWindow().alertMessage(alert).show(); new DisplayAlertMessageWindow().alertMessage(alert).show();
} }
} }

View file

@ -19,7 +19,6 @@ package io.bitsquare.gui.main.overlays.windows;
import io.bitsquare.alert.Alert; import io.bitsquare.alert.Alert;
import io.bitsquare.app.BitsquareApp; import io.bitsquare.app.BitsquareApp;
import io.bitsquare.app.Version;
import io.bitsquare.common.util.Tuple2; import io.bitsquare.common.util.Tuple2;
import io.bitsquare.gui.components.InputTextField; import io.bitsquare.gui.components.InputTextField;
import io.bitsquare.gui.main.overlays.Overlay; import io.bitsquare.gui.main.overlays.Overlay;
@ -100,6 +99,9 @@ public class SendAlertMessageWindow extends Overlay<SendAlertMessageWindow> {
CheckBox isUpdateCheckBox = addLabelCheckBox(gridPane, ++rowIndex, "Is update notification:", "").second; CheckBox isUpdateCheckBox = addLabelCheckBox(gridPane, ++rowIndex, "Is update notification:", "").second;
isUpdateCheckBox.setSelected(true); isUpdateCheckBox.setSelected(true);
InputTextField versionInputTextField = addLabelInputTextField(gridPane, ++rowIndex, "New version nr.:").second;
versionInputTextField.disableProperty().bind(isUpdateCheckBox.selectedProperty().not());
if (BitsquareApp.DEV_MODE) if (BitsquareApp.DEV_MODE)
keyInputTextField.setText("2e41038992f89eef2e4634ff3586e342c68ad9a5a7ffafee866781687f77a9b1"); keyInputTextField.setText("2e41038992f89eef2e4634ff3586e342c68ad9a5a7ffafee866781687f77a9b1");
@ -107,7 +109,7 @@ public class SendAlertMessageWindow extends Overlay<SendAlertMessageWindow> {
sendButton.setOnAction(e -> { sendButton.setOnAction(e -> {
if (alertMessageTextArea.getText().length() > 0 && keyInputTextField.getText().length() > 0) { if (alertMessageTextArea.getText().length() > 0 && keyInputTextField.getText().length() > 0) {
if (sendAlertMessageHandler.handle( if (sendAlertMessageHandler.handle(
new Alert(alertMessageTextArea.getText(), isUpdateCheckBox.isSelected(), Version.VERSION), new Alert(alertMessageTextArea.getText(), isUpdateCheckBox.isSelected(), versionInputTextField.getText()),
keyInputTextField.getText())) keyInputTextField.getText()))
hide(); hide();
else else
@ -125,7 +127,7 @@ public class SendAlertMessageWindow extends Overlay<SendAlertMessageWindow> {
} }
}); });
closeButton = new Button("Cancel"); closeButton = new Button("Close");
closeButton.setOnAction(e -> { closeButton.setOnAction(e -> {
hide(); hide();
closeHandlerOptional.ifPresent(closeHandler -> closeHandler.run()); closeHandlerOptional.ifPresent(closeHandler -> closeHandler.run());