Skip to content

Commit

Permalink
Fix default app loading for Bangle.js 1
Browse files Browse the repository at this point in the history
  • Loading branch information
gfwilliams committed Oct 29, 2021
1 parent 011b4bc commit f6ea1b1
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,23 @@ DEVICEINFO = DEVICEINFO.filter(x=>x.id.startsWith("BANGLEJS"));

// When a device is found, filter the apps accordingly
function onFoundDeviceInfo(deviceId, deviceVersion) {
if (deviceId != "BANGLEJS" && deviceId != "BANGLEJS2") {
showToast(`You're using ${deviceId}, not a Bangle.js. Did you want <a href="https://espruino.com/apps">espruino.com/apps</a> instead?` ,"warning", 20000);
} else if (versionLess(deviceVersion, RECOMMENDED_VERSION)) {
showToast(`You're using an old Bangle.js firmware (${deviceVersion}). You can <a href="https://www.espruino.com/Bangle.js#firmware-updates" target="_blank">update with the instructions here</a>` ,"warning", 20000);
}
var fwURL = "#";
if (deviceId == "BANGLEJS") {
fwURL = "https://www.espruino.com/Bangle.js#firmware-updates";
Const.MESSAGE_RELOAD = 'Hold BTN3\nto reload';
}
if (deviceId == "BANGLEJS2") {
fwURL = "https://www.espruino.com/Bangle.js2#firmware-updates";
Const.MESSAGE_RELOAD = 'Hold button\nto reload';
}

if (deviceId != "BANGLEJS" && deviceId != "BANGLEJS2") {
showToast(`You're using ${deviceId}, not a Bangle.js. Did you want <a href="https://espruino.com/apps">espruino.com/apps</a> instead?` ,"warning", 20000);
} else if (versionLess(deviceVersion, RECOMMENDED_VERSION)) {
showToast(`You're using an old Bangle.js firmware (${deviceVersion}). You can <a href="${fwURL}" target="_blank">update with the instructions here</a>` ,"warning", 20000);
}


// check against features shown?
filterAppsForDevice(deviceId);
/* if we'd saved a device ID but this device is different, ensure
Expand Down Expand Up @@ -149,7 +154,7 @@ window.addEventListener('load', (event) => {
document.getElementById("installdefault").addEventListener("click",event=>{
getInstalledApps().then(() => {
if (device.id == "BANGLEJS")
return httpGet("defaultapps_banglejs.json");
return httpGet("defaultapps_banglejs1.json");
if (device.id == "BANGLEJS2")
return httpGet("defaultapps_banglejs2.json");
throw new Error("Unknown device "+device.id);
Expand Down

0 comments on commit f6ea1b1

Please sign in to comment.