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
parent
059a2e7af7
commit
dc4c548271
|
|
@ -1 +1,2 @@
|
||||||
0.01: New app!
|
0.01: New app!
|
||||||
|
0.02: Fix music updates while app is already open
|
||||||
|
|
|
||||||
|
|
@ -85,9 +85,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
const setUI = function(options, cb) {
|
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);
|
options = Object.assign({remove: () => uiRemove()}, options);
|
||||||
Bangle.setUI(options, cb);
|
Bangle.setUI(options, cb);
|
||||||
Bangle.on("message", onMessage);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const remove = function(msg) {
|
const remove = function(msg) {
|
||||||
|
|
@ -1162,7 +1162,9 @@
|
||||||
if (idx>=0) alarm = MESSAGES.splice(idx, 1)[0];
|
if (idx>=0) alarm = MESSAGES.splice(idx, 1)[0];
|
||||||
};
|
};
|
||||||
if (MESSAGES!==undefined) { // only if loading MESSAGES worked
|
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();
|
Bangle.loadWidgets();
|
||||||
require("messages").toggleWidget(false);
|
require("messages").toggleWidget(false);
|
||||||
Bangle.drawWidgets();
|
Bangle.drawWidgets();
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"id": "messagelist",
|
"id": "messagelist",
|
||||||
"name": "Message List",
|
"name": "Message List",
|
||||||
"version": "0.01",
|
"version": "0.02",
|
||||||
"description": "Display notifications from iOS and Gadgetbridge/Android as a list",
|
"description": "Display notifications from iOS and Gadgetbridge/Android as a list",
|
||||||
"icon": "app.png",
|
"icon": "app.png",
|
||||||
"type": "app",
|
"type": "app",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue