1
0
Fork 0

Merge branch 'master' into clock-ffcniftya-v0.02

master
Danny 2021-12-23 00:15:11 +01:00
commit b596728c45
3 changed files with 9 additions and 7 deletions

View File

@ -77,7 +77,7 @@
{ {
"id": "messages", "id": "messages",
"name": "Messages", "name": "Messages",
"version": "0.14", "version": "0.15",
"description": "App to display notifications from iOS and Gadgetbridge", "description": "App to display notifications from iOS and Gadgetbridge",
"icon": "app.png", "icon": "app.png",
"type": "app", "type": "app",

View File

@ -21,3 +21,4 @@
Add 'Delete All' option to message options Add 'Delete All' option to message options
Now update correctly when 'require("messages").clearAll()' is called Now update correctly when 'require("messages").clearAll()' is called
0.14: Hide widget when all unread notifications are dismissed from phone 0.14: Hide widget when all unread notifications are dismissed from phone
0.15: Fix: Dims of notification icon (v0.12) are retrieved from icon header (no more hardcoded width=64px)

View File

@ -1,9 +1,10 @@
WIDGETS["messages"]={area:"tl",width:0,draw:function() { WIDGETS["messages"]={area:"tl", width:0, ICONS:[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==")], //icons should be equal size or first larger
draw:function() {
Bangle.removeListener('touch', this.touch); Bangle.removeListener('touch', this.touch);
if (!this.width) return; if (!this.width) return;
var c = (Date.now()-this.t)/1000; var c = (Date.now()-this.t)/1000;
g.reset().clearRect(this.x,this.y,this.x+this.width,this.y+23); g.reset().clearRect(this.x, this.y, this.x+this.width, this.y+this.ICONS[0].charCodeAt(1));
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); g.drawImage(this.ICONS[c&1], this.x, this.y);
//if (c<60) Bangle.setLCDPower(1); // keep LCD on for 1 minute //if (c<60) Bangle.setLCDPower(1); // keep LCD on for 1 minute
let settings = require('Storage').readJSON("messages.settings.json", true) || {}; let settings = require('Storage').readJSON("messages.settings.json", true) || {};
if (settings.repeat===undefined) settings.repeat = 4; if (settings.repeat===undefined) settings.repeat = 4;
@ -17,7 +18,7 @@ WIDGETS["messages"]={area:"tl",width:0,draw:function() {
WIDGETS["messages"].t=Date.now(); // first time WIDGETS["messages"].t=Date.now(); // first time
WIDGETS["messages"].l=Date.now()-10000; // last buzz WIDGETS["messages"].l=Date.now()-10000; // last buzz
if (quiet) WIDGETS["messages"].t -= 500000; // if quiet, set last time in the past so there is no buzzing if (quiet) WIDGETS["messages"].t -= 500000; // if quiet, set last time in the past so there is no buzzing
WIDGETS["messages"].width=64; WIDGETS["messages"].width=this.ICONS[0].charCodeAt(0);
Bangle.drawWidgets(); Bangle.drawWidgets();
Bangle.setLCDPower(1);// turns screen on Bangle.setLCDPower(1);// turns screen on
},hide:function() { },hide:function() {
@ -36,7 +37,7 @@ WIDGETS["messages"]={area:"tl",width:0,draw:function() {
b(); b();
},touch:function(b,c) { },touch:function(b,c) {
var w=WIDGETS["messages"]; var w=WIDGETS["messages"];
if (!w||!w.width||c.x<w.x||c.x>w.x+w.width||c.y<w.y||c.y>w.y+23) return; if (!w||!w.width||c.x<w.x||c.x>w.x+w.width||c.y<w.y||c.y>w.y+w.ICONS[0].charCodeAt(1)) return;
load("messages.app.js"); load("messages.app.js");
}}; }};
/* We might have returned here if we were in the Messages app for a /* We might have returned here if we were in the Messages app for a
@ -45,4 +46,4 @@ want to buzz but should still show that there are unread messages. */
if (global.MESSAGES===undefined) (function() { if (global.MESSAGES===undefined) (function() {
var messages = require("Storage").readJSON("messages.json",1)||[]; var messages = require("Storage").readJSON("messages.json",1)||[];
if (messages.some(m=>m.new)) WIDGETS["messages"].show(true); if (messages.some(m=>m.new)) WIDGETS["messages"].show(true);
})(); })();