mirror of https://github.com/espruino/BangleApps
iOS Making ANCS message receive more resilient (#2402)
parent
487742f037
commit
a567016172
|
@ -10,3 +10,4 @@
|
|||
0.10: Added more bundleIds
|
||||
0.11: Added letters with caron to unicodeRemap, to properly display messages in Czech language
|
||||
0.12: Use new message library
|
||||
0.13: Making ANCS message receive more resilient (#2402)
|
||||
|
|
|
@ -26,7 +26,7 @@ E.on('ANCS',msg=>{
|
|||
// not a remove - we need to get the message info first
|
||||
function ancsHandler() {
|
||||
var msg = Bangle.ancsMessageQueue[0];
|
||||
NRF.ancsGetNotificationInfo( msg.uid ).then( info => {
|
||||
NRF.ancsGetNotificationInfo( msg.uid ).then( info => { // success
|
||||
|
||||
if(msg.preExisting === true){
|
||||
info.new = false;
|
||||
|
@ -38,6 +38,10 @@ E.on('ANCS',msg=>{
|
|||
Bangle.ancsMessageQueue.shift();
|
||||
if (Bangle.ancsMessageQueue.length)
|
||||
ancsHandler();
|
||||
}, err=>{ // failure
|
||||
console.log("ancsGetNotificationInfo failed",err);
|
||||
if (Bangle.ancsMessageQueue.length)
|
||||
ancsHandler();
|
||||
});
|
||||
}
|
||||
Bangle.ancsMessageQueue.push(msg);
|
||||
|
@ -196,7 +200,11 @@ Bangle.messageResponse = (msg,response) => {
|
|||
// error/warn here?
|
||||
};
|
||||
// remove all messages on disconnect
|
||||
NRF.on("disconnect", () => require("messages").clearAll());
|
||||
NRF.on("disconnect", () => {
|
||||
require("messages").clearAll();
|
||||
// Remove any messages from the ANCS queue
|
||||
Bangle.ancsMessageQueue = [];
|
||||
});
|
||||
|
||||
/*
|
||||
// For testing...
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "ios",
|
||||
"name": "iOS Integration",
|
||||
"version": "0.12",
|
||||
"version": "0.13",
|
||||
"description": "Display notifications/music/etc from iOS devices",
|
||||
"icon": "app.png",
|
||||
"tags": "tool,system,ios,apple,messages,notifications",
|
||||
|
|
Loading…
Reference in New Issue