mirror of https://github.com/espruino/BangleApps
Merge pull request #1026 from jeroenpeters1986/master
Fix for iOS: messages app should not pop up with old messages #968pull/1029/head^2
commit
fcf31f2f4c
|
@ -57,7 +57,7 @@
|
|||
{
|
||||
"id": "messages",
|
||||
"name": "Messages",
|
||||
"version": "0.09",
|
||||
"version": "0.10",
|
||||
"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.04",
|
||||
"version": "0.06",
|
||||
"description": "(BETA) App to display notifications from iOS devices",
|
||||
"icon": "app.png",
|
||||
"tags": "tool,system,ios,apple,messages,notifications",
|
||||
|
@ -197,7 +197,7 @@
|
|||
{
|
||||
"id": "locale",
|
||||
"name": "Languages",
|
||||
"version": "0.11",
|
||||
"version": "0.12",
|
||||
"description": "Translations for different countries",
|
||||
"icon": "locale.png",
|
||||
"type": "locale",
|
||||
|
|
|
@ -2,3 +2,6 @@
|
|||
0.02: Remove messages on disconnect
|
||||
0.03: Handling of message actions (ok/clear)
|
||||
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
|
|
@ -26,6 +26,13 @@ E.on('ANCS',msg=>{
|
|||
function ancsHandler() {
|
||||
var msg = Bangle.ancsMessageQueue[0];
|
||||
NRF.ancsGetNotificationInfo( msg.uid ).then( info => {
|
||||
|
||||
if(msg.preExisting === true){
|
||||
info.new = false;
|
||||
} else {
|
||||
info.new = true;
|
||||
}
|
||||
|
||||
E.emit("notify", Object.assign(msg, info));
|
||||
Bangle.ancsMessageQueue.shift();
|
||||
if (Bangle.ancsMessageQueue.length)
|
||||
|
@ -49,30 +56,47 @@ E.on('notify',msg=>{
|
|||
"message" : string,
|
||||
"messageSize" : string,
|
||||
"date" : string,
|
||||
"new" : boolean,
|
||||
"posAction" : string,
|
||||
"negAction" : string,
|
||||
"name" : string,
|
||||
*/
|
||||
var appNames = {
|
||||
"nl.ah.Appie": "Albert Heijn",
|
||||
"com.apple.facetime": "FaceTime",
|
||||
"com.apple.mobilecal": "Calendar",
|
||||
"com.apple.mobilemail": "Mail",
|
||||
"com.apple.MobileSMS": "SMS Message",
|
||||
"com.apple.Passbook": "iOS Wallet",
|
||||
"com.apple.reminders": "Reminders",
|
||||
"com.apple.shortcuts": "Shortcuts",
|
||||
"com.atebits.Tweetie2": "Twitter",
|
||||
"com.burbn.instagram" : "Instagram",
|
||||
"com.facebook.Facebook": "Facebook",
|
||||
"com.facebook.Messenger": "FB Messenger",
|
||||
"com.google.Chromecast" : "Google Home",
|
||||
"com.google.Gmail" : "GMail",
|
||||
"com.google.hangouts" : "Hangouts",
|
||||
"com.google.ios.youtube" : "YouTube",
|
||||
"com.hammerandchisel.discord" : "Discord",
|
||||
"com.ifttt.ifttt" : "IFTTT",
|
||||
"com.jumbo.app" : "Jumbo",
|
||||
"com.linkedin.LinkedIn" : "LinkedIn",
|
||||
"com.nestlabs.jasper.release" : "Nest",
|
||||
"com.netflix.Netflix" : "Netflix",
|
||||
"com.reddit.Reddit" : "Reddit",
|
||||
"com.skype.skype": "Skype",
|
||||
"com.skype.SkypeForiPad": "Skype",
|
||||
"com.spotify.client": "Spotify",
|
||||
"net.whatsapp.WhatsApp": "WhatsApp",
|
||||
"com.tinyspeck.chatlyio": "Slack",
|
||||
"com.toyopagroup.picaboo": "Snapchat",
|
||||
"com.ubercab.UberClient": "Uber",
|
||||
"com.ubercab.UberEats": "UberEats",
|
||||
"com.wordfeud.free": "WordFeud",
|
||||
"com.zhiliaoapp.musically": "TikTok",
|
||||
"net.whatsapp.WhatsApp": "WhatsApp",
|
||||
"nl.ah.Appie": "Albert Heijn",
|
||||
"nl.postnl.TrackNTrace": "PostNL",
|
||||
"ph.telegra.Telegraph": "Telegram",
|
||||
|
||||
// could also use NRF.ancsGetAppInfo(msg.appId) here
|
||||
};
|
||||
|
@ -85,6 +109,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)
|
||||
|
|
|
@ -11,3 +11,4 @@
|
|||
0.09: Added New Zealand en_NZ
|
||||
0.10: Apply 12hour setting to time
|
||||
0.11: Added translations for nl_NL and changes one formatting
|
||||
0.12: Fixed nl_NL formatting, because the full months won't fit on the Bangle.js2's screen
|
||||
|
|
|
@ -184,7 +184,7 @@ var locales = {
|
|||
temperature: "°C",
|
||||
ampm: { 0: "", 1: "" },
|
||||
timePattern: { 0: "%HH:%MM:%SS", 1: "%HH:%MM" },
|
||||
datePattern: { 0: "%B %d %Y", 1: "%d.%m.%y" }, // zondag 1 maart 2020 // 01.01.20
|
||||
datePattern: { 0: "%d %b %Y", 1: "%d-%m-%Y" }, // 28 feb 2020 // 28-02-2020
|
||||
abday: "zo,ma,di,wo,do,vr,za",
|
||||
day: "zondag,maandag,dinsdag,woensdag,donderdag,vrijdag,zaterdag",
|
||||
abmonth: "jan,feb,mrt,apr,mei,jun,jul,aug,sep,okt,nov,dec",
|
||||
|
|
|
@ -12,3 +12,4 @@
|
|||
buzz on new message (fix #999)
|
||||
0.09: Message now disappears after 60s if no action taken and clock loads (fix 922)
|
||||
Fix phone icon (#1014)
|
||||
0.10: Respect the 'new' attribute if it was set from iOS integrations
|
|
@ -1,5 +1,5 @@
|
|||
/* Push a new message onto messages queue, 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}
|
||||
{t:"add",id:int, id:"music", state, artist, track, etc} // add new
|
||||
{t:"remove-",id:int} // remove
|
||||
{t:"modify",id:int, title:string} // modified
|
||||
|
@ -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
|
||||
|
@ -27,7 +31,11 @@ exports.pushMessage = function(event) {
|
|||
// if in app, process immediately
|
||||
if (inApp) return onMessagesModified(mIdx<0 ? {id:event.id} : messages[mIdx]);
|
||||
// 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
|
||||
var loadMessages = Bangle.CLOCK || event.important;
|
||||
// first, buzz
|
||||
|
|
Loading…
Reference in New Issue