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

pull/1026/head
Jeroen Peters 2021-12-08 02:05:35 +01:00
parent f1cb286daf
commit 456c4f4019
5 changed files with 17 additions and 3 deletions

View File

@ -57,7 +57,7 @@
{
"id": "messages",
"name": "Messages",
"version": "0.08",
"version": "0.09",
"description": "App to display notifications from iOS and Gadgetbridge",
"icon": "app.png",
"type": "app",
@ -95,7 +95,7 @@
{
"id": "ios",
"name": "iOS Integration",
"version": "0.05",
"version": "0.06",
"description": "(BETA) App to display notifications from iOS devices",
"icon": "app.png",
"tags": "tool,system,ios,apple,messages,notifications",

View File

@ -4,3 +4,4 @@
0.04: Added common bundleId's
0.05: Added more bundleId's (app-id's which can be used to
determine a friendly app name in the notifications)
0.06: Fix (not) popupping up old messages

View File

@ -26,6 +26,13 @@ E.on('ANCS',msg=>{
function ancsHandler() {
var msg = Bangle.ancsMessageQueue[0];
NRF.ancsGetNotificationInfo( msg.uid ).then( info => {
if(msg.preExisting){
info.new = false;
} else {
info.new = true;
}
E.emit("notify", Object.assign(msg, info));
Bangle.ancsMessageQueue.shift();
if (Bangle.ancsMessageQueue.length)
@ -100,6 +107,7 @@ E.on('notify',msg=>{
t : msg.event,
id : msg.uid,
src : appNames[msg.appId] || msg.appId,
new : msg.new,
title : msg.title&&E.decodeUTF8(msg.title, unicodeRemap, replacer),
subject : msg.subtitle&&E.decodeUTF8(msg.subtitle, unicodeRemap, replacer),
body : msg.message&&E.decodeUTF8(msg.message, unicodeRemap, replacer)

View File

@ -10,3 +10,4 @@
0.07: Added settings menu with option to choose vibrate pattern and frequency (fix #909)
0.08: Fix rendering of long messages (fix #969)
buzz on new message (fix #999)
0.09: Respect the 'new' attribute if it was set from iOS integrations

View File

@ -16,7 +16,11 @@ exports.pushMessage = function(event) {
if (mIdx>=0) messages.splice(mIdx, 1); // remove item
mIdx=-1;
} else { // add/modify
if (event.t=="add") event.new=true; // new message
if (event.t=="add"){
if(event.new === undefined ) { // If 'new' has not been set yet, set it
event.new=true; // Assume it should be new
}
}
if (mIdx<0) {
mIdx=0;
messages.unshift(event); // add new messages to the beginning