UI: settings show/hide update display (#1072)
* UI: settings show/hide update display This PR replaces the PR #1003 In this PR, the visual for available update is added to the foreground. There are new settings to generally show/hide the update display, and only administrators receive the update display. * change to `Bean` * Update AppUpdateShowService.java * add update message * revision service * change shouldShow * Update githubVersion.js * rm folder * Update AppUpdateService.java
This commit is contained in:
@@ -30,19 +30,39 @@ async function getLatestReleaseVersion() {
|
||||
|
||||
async function checkForUpdate() {
|
||||
// Initialize the update button as hidden
|
||||
var updateBtn = document.getElementById("update-btn");
|
||||
var updateBtn = document.getElementById("update-btn") || null;
|
||||
var updateLink = document.getElementById("update-link") || null;
|
||||
if (updateBtn !== null) {
|
||||
updateBtn.style.display = "none";
|
||||
}
|
||||
if (updateLink !== null) {
|
||||
console.log("hidden!");
|
||||
if (!updateLink.classList.contains("visually-hidden")) {
|
||||
updateLink.classList.add("visually-hidden");
|
||||
}
|
||||
}
|
||||
|
||||
const latestVersion = await getLatestReleaseVersion();
|
||||
console.log("latestVersion=" + latestVersion);
|
||||
console.log("currentVersion=" + currentVersion);
|
||||
console.log("compareVersions(latestVersion, currentVersion) > 0)=" + compareVersions(latestVersion, currentVersion));
|
||||
if (latestVersion && compareVersions(latestVersion, currentVersion) > 0) {
|
||||
document.getElementById("update-btn").style.display = "block";
|
||||
if (updateBtn != null) {
|
||||
document.getElementById("update-btn").style.display = "block";
|
||||
}
|
||||
if (updateLink !== null) {
|
||||
document.getElementById("app-update").innerHTML = updateAvailable.replace("{0}", '<b>' + currentVersion + '</b>').replace("{1}", '<b>' + latestVersion + '</b>');
|
||||
if (updateLink.classList.contains("visually-hidden")) {
|
||||
updateLink.classList.remove("visually-hidden");
|
||||
}
|
||||
}
|
||||
console.log("visible");
|
||||
} else {
|
||||
if (updateLink !== null) {
|
||||
if (!updateLink.classList.contains("visually-hidden")) {
|
||||
updateLink.classList.add("visually-hidden");
|
||||
}
|
||||
}
|
||||
console.log("hidden");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,6 +46,12 @@ function reorderCards() {
|
||||
cards.sort(function (a, b) {
|
||||
var aIsFavorite = localStorage.getItem(a.id) === "favorite";
|
||||
var bIsFavorite = localStorage.getItem(b.id) === "favorite";
|
||||
if (a.id === "update-link") {
|
||||
return -1;
|
||||
}
|
||||
if (b.id === "update-link") {
|
||||
return 1;
|
||||
}
|
||||
if (aIsFavorite && !bIsFavorite) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user