Include release date in update changelog

This commit is contained in:
crschnick 2024-01-20 21:45:17 +00:00
parent 809999394d
commit f61bef8bc0
2 changed files with 11 additions and 2 deletions

View file

@ -9,6 +9,10 @@ import javafx.scene.control.ButtonBar;
import javafx.scene.control.ButtonType;
import javafx.stage.Modality;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.time.format.FormatStyle;
public class UpdateChangelogAlert {
private static boolean shown = false;
@ -35,8 +39,11 @@ public class UpdateChangelogAlert {
alert.setAlertType(Alert.AlertType.NONE);
alert.initModality(Modality.NONE);
var date = update.getReleaseDate() != null ?
DateTimeFormatter.ofLocalizedDate(FormatStyle.MEDIUM)
.format(update.getReleaseDate().atZone(ZoneId.systemDefault())) : "Latest";
var markdown = new MarkdownComp(update.getRawDescription(), s -> {
var header = "&nbsp;<h1>" + AppI18n.get("whatsNew", update.getName()) + "</h1>";
var header = "&nbsp;<h1>" + AppI18n.get("whatsNew", update.getName(), date) + "</h1>";
return header + s;
})
.createRegion();

View file

@ -227,7 +227,8 @@ public abstract class UpdateHandler {
var performedUpdate = new PerformedUpdate(
preparedUpdate.getValue().getVersion(),
preparedUpdate.getValue().getBody(),
preparedUpdate.getValue().getVersion());
preparedUpdate.getValue().getVersion(),
preparedUpdate.getValue().getReleaseDate());
AppCache.update("performedUpdate", performedUpdate);
}
});
@ -256,6 +257,7 @@ public abstract class UpdateHandler {
String name;
String rawDescription;
String newVersion;
Instant releaseDate;
}
@Value