Ensure upgrade of a custom app re-runs the customiser (fix #160)
parent
e588f31257
commit
f72bb986c9
38
js/index.js
38
js/index.js
|
|
@ -351,22 +351,9 @@ function refreshLibrary() {
|
||||||
});
|
});
|
||||||
} else if (icon.classList.contains("icon-menu")) {
|
} else if (icon.classList.contains("icon-menu")) {
|
||||||
// custom HTML update
|
// custom HTML update
|
||||||
if (app.custom) {
|
icon.classList.remove("icon-menu");
|
||||||
icon.classList.remove("icon-menu");
|
icon.classList.add("loading");
|
||||||
icon.classList.add("loading");
|
customApp(app);
|
||||||
handleCustomApp(app).then((appJSON) => {
|
|
||||||
if (appJSON) appsInstalled.push(appJSON);
|
|
||||||
showToast(app.name+" Uploaded!", "success");
|
|
||||||
icon.classList.remove("loading");
|
|
||||||
icon.classList.add("icon-delete");
|
|
||||||
refreshMyApps();
|
|
||||||
refreshLibrary();
|
|
||||||
}).catch(err => {
|
|
||||||
showToast("Customise failed, "+err, "error");
|
|
||||||
icon.classList.remove("loading");
|
|
||||||
icon.classList.add("icon-menu");
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} else if (icon.classList.contains("icon-delete")) {
|
} else if (icon.classList.contains("icon-delete")) {
|
||||||
// Remove app
|
// Remove app
|
||||||
icon.classList.remove("icon-delete");
|
icon.classList.remove("icon-delete");
|
||||||
|
|
@ -401,9 +388,23 @@ function removeApp(app) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function customApp(app) {
|
||||||
|
return handleCustomApp(app).then((appJSON) => {
|
||||||
|
if (appJSON) appsInstalled.push(appJSON);
|
||||||
|
showToast(app.name+" Uploaded!", "success");
|
||||||
|
refreshMyApps();
|
||||||
|
refreshLibrary();
|
||||||
|
}).catch(err => {
|
||||||
|
showToast("Customise failed, "+err, "error");
|
||||||
|
refreshMyApps();
|
||||||
|
refreshLibrary();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function updateApp(app) {
|
function updateApp(app) {
|
||||||
|
if (app.custom) return customApp(app);
|
||||||
showProgress(`Upgrading ${app.name}`,undefined,"sticky");
|
showProgress(`Upgrading ${app.name}`,undefined,"sticky");
|
||||||
Comms.removeApp(app).then(()=>{
|
return Comms.removeApp(app).then(()=>{
|
||||||
showToast(app.name+" removed successfully. Updating...",);
|
showToast(app.name+" removed successfully. Updating...",);
|
||||||
appsInstalled = appsInstalled.filter(a=>a.id!=app.id);
|
appsInstalled = appsInstalled.filter(a=>a.id!=app.id);
|
||||||
return Comms.uploadApp(app);
|
return Comms.uploadApp(app);
|
||||||
|
|
@ -416,10 +417,13 @@ function updateApp(app) {
|
||||||
}, err=>{
|
}, err=>{
|
||||||
hideProgress("sticky");
|
hideProgress("sticky");
|
||||||
showToast(app.name+" update failed, "+err,"error");
|
showToast(app.name+" update failed, "+err,"error");
|
||||||
|
refreshMyApps();
|
||||||
|
refreshLibrary();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function appNameToApp(appName) {
|
function appNameToApp(appName) {
|
||||||
var app = appJSON.find(app=>app.id==appName);
|
var app = appJSON.find(app=>app.id==appName);
|
||||||
if (app) return app;
|
if (app) return app;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue