From f6ea1b116f1b45b4e1151d88202b3c104859f3b2 Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Fri, 29 Oct 2021 08:33:31 +0100 Subject: [PATCH] Fix default app loading for Bangle.js 1 --- loader.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/loader.js b/loader.js index c4d8d5972a..61e2b1880f 100644 --- a/loader.js +++ b/loader.js @@ -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 espruino.com/apps instead?` ,"warning", 20000); - } else if (versionLess(deviceVersion, RECOMMENDED_VERSION)) { - showToast(`You're using an old Bangle.js firmware (${deviceVersion}). You can update with the instructions here` ,"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 espruino.com/apps instead?` ,"warning", 20000); + } else if (versionLess(deviceVersion, RECOMMENDED_VERSION)) { + showToast(`You're using an old Bangle.js firmware (${deviceVersion}). You can update with the instructions here` ,"warning", 20000); + } + + // check against features shown? filterAppsForDevice(deviceId); /* if we'd saved a device ID but this device is different, ensure @@ -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);