Fix #968: messages app should not pop up with old messages

master
Jeroen Peters 2021-12-08 02:22:06 +01:00
parent cf604588bf
commit f61d5c8d57
2 changed files with 8 additions and 2 deletions

View File

@ -56,6 +56,7 @@ E.on('notify',msg=>{
"message" : string, "message" : string,
"messageSize" : string, "messageSize" : string,
"date" : string, "date" : string,
"new" : boolean,
"posAction" : string, "posAction" : string,
"negAction" : string, "negAction" : string,
"name" : string, "name" : string,
@ -64,6 +65,7 @@ E.on('notify',msg=>{
"com.apple.facetime": "FaceTime", "com.apple.facetime": "FaceTime",
"com.apple.mobilecal": "Calendar", "com.apple.mobilecal": "Calendar",
"com.apple.mobilemail": "Mail", "com.apple.mobilemail": "Mail",
"com.apple.MobileSMS": "SMS Message",
"com.apple.Passbook": "iOS Wallet", "com.apple.Passbook": "iOS Wallet",
"com.apple.reminders": "Reminders", "com.apple.reminders": "Reminders",
"com.apple.shortcuts": "Shortcuts", "com.apple.shortcuts": "Shortcuts",

View File

@ -1,6 +1,6 @@
exports.pushMessage = function(event) { exports.pushMessage = function(event) {
/* event is: /* event is:
{t:"add",id:int, src,title,subject,body,sender,tel, important:bool} // add new {t:"add",id:int, src,title,subject,body,sender,tel, important:bool, new:bool} // add new
{t:"add",id:int, id:"music", state, artist, track, etc} // add new {t:"add",id:int, id:"music", state, artist, track, etc} // add new
{t:"remove-",id:int} // remove {t:"remove-",id:int} // remove
{t:"modify",id:int, title:string} // modified {t:"modify",id:int, title:string} // modified
@ -31,7 +31,11 @@ exports.pushMessage = function(event) {
// if in app, process immediately // if in app, process immediately
if (inApp) return onMessagesModified(mIdx<0 ? {id:event.id} : messages[mIdx]); if (inApp) return onMessagesModified(mIdx<0 ? {id:event.id} : messages[mIdx]);
// ok, saved now - we only care if it's new // ok, saved now - we only care if it's new
if (event.t!="add") return; if (event.t!="add") {
return;
} else if(event.new == false) {
return;
}
// otherwise load messages/show widget // otherwise load messages/show widget
var loadMessages = Bangle.CLOCK || event.important; var loadMessages = Bangle.CLOCK || event.important;
// first, buzz // first, buzz