Move default app handling into loader.js, clear list of installed apps on disconnect

different default apps for the 2 bangle versions
pull/854/head
Gordon Williams 2021-10-21 10:14:40 +01:00
parent e829ad54ac
commit 26f43a787a
4 changed files with 19 additions and 2 deletions

2
core

@ -1 +1 @@
Subproject commit bc5b1284f41b0fcfdd264e1e2f12872e0b18c479
Subproject commit cdbf46feaeefcb0d48ce9c170e90786dab11a03f

View File

@ -0,0 +1 @@
["boot","launch","s7clk","setting","about","widbat","widbt","widlock","widid"]

View File

@ -133,8 +133,8 @@ window.addEventListener('load', (event) => {
});
});
// Hook onto device chooser dropdown
window.addEventListener('load', (event) => {
// Hook onto device chooser dropdown
htmlToArray(document.querySelectorAll(".devicetype-nav .menu-item")).forEach(button => {
button.addEventListener("click", event => {
var a = event.target;
@ -144,4 +144,20 @@ window.addEventListener('load', (event) => {
document.querySelector(".devicetype-nav span").innerText = a.innerText;
});
});
// Button to install all default apps in one go
document.getElementById("installdefault").addEventListener("click",event=>{
getInstalledApps().then(() => {
if (device.id == "BANGLEJS")
return httpGet("defaultapps_banglejs.json");
if (device.id == "BANGLEJS2")
return httpGet("defaultapps_banglejs2.json");
throw new Error("Unknown device "+device.id);
}).then(json=>{
return installMultipleApps(JSON.parse(json), "default");
}).catch(err=>{
Progress.hide({sticky:true});
showToast("App Install failed, "+err,"error");
});
});
});