messagelist: Fix messages/music updates while app is already open

(And probably some other issues)
When we call Bangle.setUI to draw a new message, Bangle.uiRemove from the
previous message screen would save messages to flash and unset "special"
messages (like `music`).
Solution: delete Bangle.uiRemove before calling Bangle.setUI.
master
Richard de Boer 2023-01-07 15:25:55 +01:00
parent 059a2e7af7
commit dc4c548271
No known key found for this signature in database
3 changed files with 7 additions and 4 deletions

View File

@ -1 +1,2 @@
0.01: New app!
0.01: New app!
0.02: Fix music updates while app is already open

View File

@ -85,9 +85,9 @@
}
const setUI = function(options, cb) {
delete Bangle.uiRemove; // don't clear out things when switching UI within the app
options = Object.assign({remove: () => uiRemove()}, options);
Bangle.setUI(options, cb);
Bangle.on("message", onMessage);
};
const remove = function(msg) {
@ -1162,7 +1162,9 @@
if (idx>=0) alarm = MESSAGES.splice(idx, 1)[0];
};
if (MESSAGES!==undefined) { // only if loading MESSAGES worked
g.reset().clear();
// Internal setUI suppresses Bangle.uiRemove between internal screens, so we
// need to call setUI to run uiRemove from previous app when fast-loaded.
Bangle.setUI();
Bangle.loadWidgets();
require("messages").toggleWidget(false);
Bangle.drawWidgets();

View File

@ -1,7 +1,7 @@
{
"id": "messagelist",
"name": "Message List",
"version": "0.01",
"version": "0.02",
"description": "Display notifications from iOS and Gadgetbridge/Android as a list",
"icon": "app.png",
"type": "app",