Add sanity check for clocks calling loadWidgets before setUI

pull/2110/head^2
Gordon Williams 2022-09-05 11:03:41 +01:00
parent 7ba3ae3f08
commit 84819f5cae
1 changed files with 7 additions and 0 deletions

View File

@ -225,6 +225,13 @@ apps.forEach((app,appIdx) => {
console.log("=====================================================");
ERROR(`App ${app.id}'s ${file.name} is a JS file but isn't valid JS`, {file:appDirRelative+file.url});
}
// clock app checks
if (app.type=="clock") {
var a = fileContents.indexOf("Bangle.loadWidgets()");
var b = fileContents.indexOf("Bangle.setUI(");
if (a>=0 && b>=0 && a<b)
WARN(`Clock ${app.id} file calls loadWidgets before setUI (clock widget/etc won't be aware a clock app is running)`, {file:appDirRelative+file.url});
}
}
for (const key in file) {
if (!STORAGE_KEYS.includes(key)) ERROR(`App ${app.id} file ${file.name} has unknown key ${key}`, {file:appDirRelative+file.url});