mirror of https://github.com/espruino/BangleApps
Move default app handling into loader.js, clear list of installed apps on disconnect
different default apps for the 2 bangle versionspull/854/head
parent
e829ad54ac
commit
26f43a787a
2
core
2
core
|
@ -1 +1 @@
|
||||||
Subproject commit bc5b1284f41b0fcfdd264e1e2f12872e0b18c479
|
Subproject commit cdbf46feaeefcb0d48ce9c170e90786dab11a03f
|
|
@ -0,0 +1 @@
|
||||||
|
["boot","launch","s7clk","setting","about","widbat","widbt","widlock","widid"]
|
18
loader.js
18
loader.js
|
@ -133,8 +133,8 @@ window.addEventListener('load', (event) => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Hook onto device chooser dropdown
|
|
||||||
window.addEventListener('load', (event) => {
|
window.addEventListener('load', (event) => {
|
||||||
|
// Hook onto device chooser dropdown
|
||||||
htmlToArray(document.querySelectorAll(".devicetype-nav .menu-item")).forEach(button => {
|
htmlToArray(document.querySelectorAll(".devicetype-nav .menu-item")).forEach(button => {
|
||||||
button.addEventListener("click", event => {
|
button.addEventListener("click", event => {
|
||||||
var a = event.target;
|
var a = event.target;
|
||||||
|
@ -144,4 +144,20 @@ window.addEventListener('load', (event) => {
|
||||||
document.querySelector(".devicetype-nav span").innerText = a.innerText;
|
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");
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue