diff --git a/apps/messages/ChangeLog b/apps/messages/ChangeLog index 092a38eb6..3e676c21e 100644 --- a/apps/messages/ChangeLog +++ b/apps/messages/ChangeLog @@ -43,3 +43,4 @@ 0.28: Option to auto-unlock the watch when a new message arrives 0.29: Fix message list overwrites on Bangle.js 1 (fix #1642) 0.30: Add new Icons (Youtube, Twitch, MS TODO, Teams, Snapchat, Signal, Post & DHL, Nina, Lieferando, Kalender, Discord, Corona Warn, Bibel) +0.31: Option to disable icon flashing diff --git a/apps/messages/README.md b/apps/messages/README.md index 780d8e50b..da2701f35 100644 --- a/apps/messages/README.md +++ b/apps/messages/README.md @@ -21,6 +21,7 @@ is chosen if there isn't much message text, but this specifies the smallest the it starts getting clipped. * `Auto-Open Music` - Should the app automatically open when the phone starts playing music? * `Unlock Watch` - Should the app unlock the watch when a new message arrives, so you can touch the buttons at the bottom of the app? +* `Flash Icon` - Toggle flashing of the widget icon. ## New Messages diff --git a/apps/messages/metadata.json b/apps/messages/metadata.json index dfeedaef7..5c1e67702 100644 --- a/apps/messages/metadata.json +++ b/apps/messages/metadata.json @@ -1,7 +1,7 @@ { "id": "messages", "name": "Messages", - "version": "0.30", + "version": "0.31", "description": "App to display notifications from iOS and Gadgetbridge/Android", "icon": "app.png", "type": "app", diff --git a/apps/messages/settings.js b/apps/messages/settings.js index 754347f19..cc0030ec5 100644 --- a/apps/messages/settings.js +++ b/apps/messages/settings.js @@ -7,6 +7,7 @@ settings.unlockWatch=!!settings.unlockWatch; settings.openMusic=!!settings.openMusic; settings.maxUnreadTimeout=240; + if (settings.flash===undefined) settings.flash=true; return settings; } function updateSetting(setting, value) { @@ -47,6 +48,11 @@ format: v => v?/*LANG*/'Yes':/*LANG*/'No', onchange: v => updateSetting("unlockWatch", v) }, + /*LANG*/'Flash Icon': { + value: !!settings().flash, + format: v => v?/*LANG*/'Yes':/*LANG*/'No', + onchange: v => updateSetting("flash", v) + }, }; E.showMenu(mainmenu); }) diff --git a/apps/messages/widget.js b/apps/messages/widget.js index 3ac726e77..4b368ffd6 100644 --- a/apps/messages/widget.js +++ b/apps/messages/widget.js @@ -1,5 +1,5 @@ WIDGETS["messages"]={area:"tl", width:0, iconwidth:24, -draw:function() { +draw:function(recall) { // If we had a setTimeout queued from the last time we were called, remove it if (WIDGETS["messages"].i) { clearTimeout(WIDGETS["messages"].i); @@ -8,15 +8,18 @@ draw:function() { Bangle.removeListener('touch', this.touch); if (!this.width) return; var c = (Date.now()-this.t)/1000; - g.reset().clearRect(this.x, this.y, this.x+this.width, this.y+this.iconwidth); - g.drawImage((c&1) ? atob("GBiBAAAAAAAAAAAAAAAAAAAAAB//+DAADDAADDAADDwAPD8A/DOBzDDn/DA//DAHvDAPvjAPvjAPvjAPvh///gf/vAAD+AAB8AAAAA==") : atob("GBiBAAAAAAAAAAAAAAAAAAAAAB//+D///D///A//8CP/xDj/HD48DD+B8D/D+D/3vD/vvj/vvj/vvj/vvh/v/gfnvAAD+AAB8AAAAA=="), this.x, this.y); let settings = require('Storage').readJSON("messages.settings.json", true) || {}; + if (settings.flash===undefined) settings.flash = true; + if (recall !== true || settings.flash) { + g.reset().clearRect(this.x, this.y, this.x+this.width, this.y+23); + g.drawImage(settings.flash && (c&1) ? atob("GBiBAAAAAAAAAAAAAAAAAAAAAB//+DAADDAADDAADDwAPD8A/DOBzDDn/DA//DAHvDAPvjAPvjAPvjAPvh///gf/vAAD+AAB8AAAAA==") : atob("GBiBAAAAAAAAAAAAAAAAAAAAAB//+D///D///A//8CP/xDj/HD48DD+B8D/D+D/3vD/vvj/vvj/vvj/vvh/v/gfnvAAD+AAB8AAAAA=="), this.x, this.y-1); + } if (settings.repeat===undefined) settings.repeat = 4; if (c<120 && (Date.now()-this.l)>settings.repeat*1000) { this.l = Date.now(); WIDGETS["messages"].buzz(); // buzz every 4 seconds } - WIDGETS["messages"].i=setTimeout(()=>WIDGETS["messages"].draw(), 1000); + WIDGETS["messages"].i=setTimeout(()=>WIDGETS["messages"].draw(true), 1000); if (process.env.HWVERSION>1) Bangle.on('touch', this.touch); },show:function(quiet) { WIDGETS["messages"].t=Date.now(); // first time