0.47: Add polyfill for setUI with an object as an argument (fix regression for 2v12 devices after Layout module changed)
parent
90e212749b
commit
15a6d07e06
|
|
@ -50,3 +50,4 @@
|
||||||
0.44: Write .boot0 without ever having it all in RAM (fix Bangle.js 1 issues with BTHRM)
|
0.44: Write .boot0 without ever having it all in RAM (fix Bangle.js 1 issues with BTHRM)
|
||||||
0.45: Fix 0.44 regression (auto-add semi-colon between each boot code chunk)
|
0.45: Fix 0.44 regression (auto-add semi-colon between each boot code chunk)
|
||||||
0.46: Fix no clock found error on Bangle.js 2
|
0.46: Fix no clock found error on Bangle.js 2
|
||||||
|
0.47: Add polyfill for setUI with an object as an argument (fix regression for 2v12 devices after Layout module changed)
|
||||||
|
|
|
||||||
|
|
@ -97,52 +97,20 @@ delete g.theme; // deleting stops us getting confused by our own decl. builtins
|
||||||
if (!g.theme) {
|
if (!g.theme) {
|
||||||
boot += `g.theme={fg:-1,bg:0,fg2:-1,bg2:7,fgH:-1,bgH:0x02F7,dark:true};\n`;
|
boot += `g.theme={fg:-1,bg:0,fg2:-1,bg2:7,fgH:-1,bgH:0x02F7,dark:true};\n`;
|
||||||
}
|
}
|
||||||
delete Bangle.setUI; // deleting stops us getting confused by our own decl. builtins can't be deleted
|
try {
|
||||||
if (!Bangle.setUI) { // assume this is just for F18 - Q3 should already have it
|
Bangle.setUI({}); // In 2v12.xx we added the option for mode to be an object - for 2v12 and earlier, add a fix if it fails with an object supplied
|
||||||
boot += `Bangle.setUI=function(mode, cb) {
|
} catch(e) {
|
||||||
if (Bangle.btnWatches) {
|
boot += `Bangle._setUI = Bangle.setUI;
|
||||||
Bangle.btnWatches.forEach(clearWatch);
|
Bangle.setUI=function(mode, cb) {
|
||||||
delete Bangle.btnWatches;
|
if (Bangle.uiRemove) {
|
||||||
}
|
Bangle.uiRemove();
|
||||||
if (Bangle.swipeHandler) {
|
delete Bangle.uiRemove;
|
||||||
Bangle.removeListener("swipe", Bangle.swipeHandler);
|
}
|
||||||
delete Bangle.swipeHandler;
|
if ("object"==typeof mode) {
|
||||||
}
|
// TODO: handle mode.back?
|
||||||
if (Bangle.touchHandler) {
|
mode = mode.mode;
|
||||||
Bangle.removeListener("touch", Bangle.touchHandler);
|
}
|
||||||
delete Bangle.touchHandler;
|
Bangle._setUI(mode, cb);
|
||||||
}
|
|
||||||
if (!mode) return;
|
|
||||||
else if (mode=="updown") {
|
|
||||||
Bangle.btnWatches = [
|
|
||||||
setWatch(function() { cb(-1); }, BTN1, {repeat:1}),
|
|
||||||
setWatch(function() { cb(1); }, BTN3, {repeat:1}),
|
|
||||||
setWatch(function() { cb(); }, BTN2, {repeat:1})
|
|
||||||
];
|
|
||||||
} else if (mode=="leftright") {
|
|
||||||
Bangle.btnWatches = [
|
|
||||||
setWatch(function() { cb(-1); }, BTN1, {repeat:1}),
|
|
||||||
setWatch(function() { cb(1); }, BTN3, {repeat:1}),
|
|
||||||
setWatch(function() { cb(); }, BTN2, {repeat:1})
|
|
||||||
];
|
|
||||||
Bangle.swipeHandler = d => {cb(d);};
|
|
||||||
Bangle.on("swipe", Bangle.swipeHandler);
|
|
||||||
Bangle.touchHandler = d => {cb();};
|
|
||||||
Bangle.on("touch", Bangle.touchHandler);
|
|
||||||
} else if (mode=="clock") {
|
|
||||||
Bangle.CLOCK=1;
|
|
||||||
Bangle.btnWatches = [
|
|
||||||
setWatch(Bangle.showLauncher, BTN2, {repeat:1,edge:"falling"})
|
|
||||||
];
|
|
||||||
} else if (mode=="clockupdown") {
|
|
||||||
Bangle.CLOCK=1;
|
|
||||||
Bangle.btnWatches = [
|
|
||||||
setWatch(function() { cb(-1); }, BTN1, {repeat:1}),
|
|
||||||
setWatch(function() { cb(1); }, BTN3, {repeat:1}),
|
|
||||||
setWatch(Bangle.showLauncher, BTN2, {repeat:1,edge:"falling"})
|
|
||||||
];
|
|
||||||
} else
|
|
||||||
throw new Error("Unknown UI mode");
|
|
||||||
};\n`;
|
};\n`;
|
||||||
}
|
}
|
||||||
delete E.showScroller; // deleting stops us getting confused by our own decl. builtins can't be deleted
|
delete E.showScroller; // deleting stops us getting confused by our own decl. builtins can't be deleted
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"id": "boot",
|
"id": "boot",
|
||||||
"name": "Bootloader",
|
"name": "Bootloader",
|
||||||
"version": "0.46",
|
"version": "0.47",
|
||||||
"description": "This is needed by Bangle.js to automatically load the clock, menu, widgets and settings",
|
"description": "This is needed by Bangle.js to automatically load the clock, menu, widgets and settings",
|
||||||
"icon": "bootloader.png",
|
"icon": "bootloader.png",
|
||||||
"type": "bootloader",
|
"type": "bootloader",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue