mirror of https://github.com/espruino/BangleApps
messages: Hide widget when all unread messages are dismissed
parent
2d1666d037
commit
66e75055a4
|
@ -77,7 +77,7 @@
|
|||
{
|
||||
"id": "messages",
|
||||
"name": "Messages",
|
||||
"version": "0.13",
|
||||
"version": "0.14",
|
||||
"description": "App to display notifications from iOS and Gadgetbridge",
|
||||
"icon": "app.png",
|
||||
"type": "app",
|
||||
|
|
|
@ -20,3 +20,4 @@
|
|||
0.13: Add /*LANG*/ comments for internationalisation
|
||||
Add 'Delete All' option to message options
|
||||
Now update correctly when 'require("messages").clearAll()' is called
|
||||
0.14: Hide widget when all unread notifications are dismissed from phone
|
||||
|
|
|
@ -30,6 +30,10 @@ exports.pushMessage = function(event) {
|
|||
require("Storage").writeJSON("messages.json",messages);
|
||||
// if in app, process immediately
|
||||
if (inApp) return onMessagesModified(mIdx<0 ? {id:event.id} : messages[mIdx]);
|
||||
// if we've removed the last new message, hide the widget
|
||||
if (event.t=="remove" && !messages.some(m=>m.new)) {
|
||||
if (global.WIDGETS && WIDGETS.messages) WIDGETS.messages.hide();
|
||||
}
|
||||
// ok, saved now - we only care if it's new
|
||||
if (event.t!="add") {
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue