From 67d89761b53e8273f55ded723616ed1c0f7f8344 Mon Sep 17 00:00:00 2001 From: Rob Pilling Date: Mon, 24 Apr 2023 20:47:12 +0100 Subject: [PATCH 01/14] Fix wid_edit draw() - pass WIDGET as first argument When attempting to edit a widget whose `draw` function takes the widget as an argument, we get an exception from that `draw` function. This fixes that by catering for both APIs. The back button widget expects this, as does [`widsleepstatus`], [`widlock`] and [`widlockunlock`]. There are other widgets ([`widmessages`], [`widbatpc`] and [`widalarmeta`]) which use something else for the first parameter, however these are type-checked and used to distinguish calls from `Bangle.drawWidgets()` and elsewhere. [`widsleepstatus`]: https://github.com/espruino/BangleApps/blob/2f6862024d6b92a11fd05a5183a1dd9a53dc5e48/apps/widsleepstatus/widget.js#L20 [`widlock`]: https://github.com/espruino/BangleApps/blob/2f6862024d6b92a11fd05a5183a1dd9a53dc5e48/apps/widlock/widget.js#L5 [`widlockunlock`]: https://github.com/espruino/BangleApps/blob/2f6862024d6b92a11fd05a5183a1dd9a53dc5e48/apps/widlockunlock/widget.js#L27 [`widmessages`]: https://github.com/espruino/BangleApps/blob/2f6862024d6b92a11fd05a5183a1dd9a53dc5e48/apps/widmessages/widget.js#L14 [`widbatpc`]: https://github.com/espruino/BangleApps/blob/2f6862024d6b92a11fd05a5183a1dd9a53dc5e48/apps/widbatpc/widget.js#L89 [`widalarmeta`]: https://github.com/espruino/BangleApps/blob/2f6862024d6b92a11fd05a5183a1dd9a53dc5e48/apps/widalarmeta/widget.js#L28 --- apps/wid_edit/settings.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/wid_edit/settings.js b/apps/wid_edit/settings.js index 1d34ae0ca..be09923f2 100644 --- a/apps/wid_edit/settings.js +++ b/apps/wid_edit/settings.js @@ -67,7 +67,7 @@ function highlight() { if (WIDGET.width > 0) { // draw widget, then draw a highlighted border on top - WIDGET.draw(); + WIDGET.draw(WIDGET); g.setColor(g.theme.fgH) .drawRect(WIDGET.x, WIDGET.y, WIDGET.x+WIDGET.width-1, WIDGET.y+23); } else { From f46a9f526d5e0e903050b2c4bc151514d726cf9f Mon Sep 17 00:00:00 2001 From: Rob Pilling Date: Tue, 25 Apr 2023 22:09:05 +0100 Subject: [PATCH 02/14] Fix ABI of widget.draw() --- apps/widalarmeta/widget.js | 7 ++++--- apps/widbatpc/widget.js | 2 +- apps/widmessages/widget.js | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/apps/widalarmeta/widget.js b/apps/widalarmeta/widget.js index 77b7ebb88..d24b185d9 100644 --- a/apps/widalarmeta/widget.js +++ b/apps/widalarmeta/widget.js @@ -25,7 +25,7 @@ } } // getNextAlarm - function draw(fromInterval) { + function draw(_w, fromInterval) { if (this.nextAlarm === undefined) { let alarm = getNextAlarm(); if (alarm === undefined) { @@ -101,8 +101,9 @@ clearTimeout(this.timeoutId); } this.timeoutId = setTimeout(()=>{ - WIDGETS["widalarmeta"].timeoutId = undefined; - WIDGETS["widalarmeta"].draw(true); + var w = WIDGETS["widalarmeta"]; + w.timeoutId = undefined; + w.draw(w, true); }, timeout); } /* draw */ diff --git a/apps/widbatpc/widget.js b/apps/widbatpc/widget.js index b508cce8b..7ba060d6d 100644 --- a/apps/widbatpc/widget.js +++ b/apps/widbatpc/widget.js @@ -181,7 +181,7 @@ if (on) update(); }); - var id = setInterval(()=>WIDGETS["batpc"].draw(true), intervalLow); + var id = setInterval(()=>WIDGETS["batpc"].draw(WIDGETS["batpc"], true), intervalLow); WIDGETS["batpc"]={area:"tr",width:40,draw:draw,reload:reload}; setWidth(); diff --git a/apps/widmessages/widget.js b/apps/widmessages/widget.js index 44f525ec8..357ca06e3 100644 --- a/apps/widmessages/widget.js +++ b/apps/widmessages/widget.js @@ -11,7 +11,7 @@ // the name still needs to be "messages": the library calls WIDGETS["messages'].hide()/show() // see e.g. widmsggrid WIDGETS["messages"] = { - area: "tl", width: 0, srcs: [], draw: function(recall) { + area: "tl", width: 0, srcs: [], draw: function(_w, recall) { // If we had a setTimeout queued from the last time we were called, remove it if (WIDGETS["messages"].i) { clearTimeout(WIDGETS["messages"].i); @@ -42,7 +42,7 @@ this.x+12+i*24, this.y+12, {rotate: 0/*force centering*/}); } } - WIDGETS["messages"].i = setTimeout(() => WIDGETS["messages"].draw(true), 1000); + WIDGETS["messages"].i = setTimeout(() => WIDGETS["messages"].draw(WIDGETS["messages"], true), 1000); if (process.env.HWVERSION>1) Bangle.on("touch", this.touch); }, onMsg: function(type, msg) { if (this.hidden) return; From d56de3048bc30b2a2e4669d8106d1708ed3a7a9a Mon Sep 17 00:00:00 2001 From: Rob Pilling Date: Tue, 25 Apr 2023 22:23:17 +0100 Subject: [PATCH 03/14] Move minify setting into expandable area, and warn This moves the minify option to an expandable advanced section, and changes the warning ("may" -> "will") See #2562 for more details. --- index.html | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index 1ed95107e..e7b7c7bd4 100644 --- a/index.html +++ b/index.html @@ -146,10 +146,6 @@ Pretokenise apps before upload (smaller, faster apps) - +
+ Advanced Options + +
+ +   Translations (BETA - more info). Any apps that are uploaded to Bangle.js after changing this will have any text automatically translated. +
Advanced Options
-
-   Translations (BETA - more info). Any apps that are uploaded to Bangle.js after changing this will have any text automatically translated. -
@@ -134,7 +136,8 @@ -

+ +

Settings

@@ -147,12 +150,24 @@ Always update time when we connect +
privacy policy. +
  Translations (BETA - more info). Any apps that are uploaded to Bangle.js after changing this will have any text automatically translated.
- +
+ Advanced Options + + +
- - - - - - - - - - - + + + + + + + + + + + +
@@ -132,14 +133,14 @@

Using Espruino, Icons from icons8.com

Utilities

-

- - - - -

-

-

+

+ + + + +

+

+

Settings

- - - - - - - - - - - + + + + + + + + + + + +
@@ -132,14 +133,14 @@

Using Espruino, Icons from icons8.com

Utilities

-

- - - - -

-

-

+

+ + + + +

+

+

Settings