mirror of https://github.com/espruino/BangleApps
messages: Open app when touching the widget
parent
a45f7506ff
commit
c9ffee04a7
|
@ -57,7 +57,7 @@
|
||||||
{
|
{
|
||||||
"id": "messages",
|
"id": "messages",
|
||||||
"name": "Messages",
|
"name": "Messages",
|
||||||
"version": "0.10",
|
"version": "0.11",
|
||||||
"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",
|
||||||
|
|
|
@ -12,4 +12,5 @@
|
||||||
buzz on new message (fix #999)
|
buzz on new message (fix #999)
|
||||||
0.09: Message now disappears after 60s if no action taken and clock loads (fix 922)
|
0.09: Message now disappears after 60s if no action taken and clock loads (fix 922)
|
||||||
Fix phone icon (#1014)
|
Fix phone icon (#1014)
|
||||||
0.10: Respect the 'new' attribute if it was set from iOS integrations
|
0.10: Respect the 'new' attribute if it was set from iOS integrations
|
||||||
|
0.11: Open app when touching the widget (Bangle.js 2 only)
|
|
@ -1,4 +1,5 @@
|
||||||
WIDGETS["messages"]={area:"tl",width:0,draw:function() {
|
WIDGETS["messages"]={area:"tl",width:0,draw:function() {
|
||||||
|
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().setBgColor((c&1) ? "#0f0" : "#030").setColor((c&1) ? "#000" : "#fff");
|
g.reset().setBgColor((c&1) ? "#0f0" : "#030").setColor((c&1) ? "#000" : "#fff");
|
||||||
|
@ -12,6 +13,7 @@ WIDGETS["messages"]={area:"tl",width:0,draw:function() {
|
||||||
WIDGETS["messages"].buzz(); // buzz every 4 seconds
|
WIDGETS["messages"].buzz(); // buzz every 4 seconds
|
||||||
}
|
}
|
||||||
setTimeout(()=>WIDGETS["messages"].draw(), 1000);
|
setTimeout(()=>WIDGETS["messages"].draw(), 1000);
|
||||||
|
if (process.env.HWVERSION>1) Bangle.on('touch', this.touch);
|
||||||
},show:function(quiet) {
|
},show:function(quiet) {
|
||||||
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
|
||||||
|
@ -33,6 +35,10 @@ WIDGETS["messages"]={area:"tl",width:0,draw:function() {
|
||||||
if (c=="-") Bangle.buzz(500).then(()=>setTimeout(b,100));
|
if (c=="-") Bangle.buzz(500).then(()=>setTimeout(b,100));
|
||||||
}
|
}
|
||||||
b();
|
b();
|
||||||
|
},touch:function(b,c) {
|
||||||
|
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;
|
||||||
|
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
|
||||||
message but then the watch was never viewed. In that case we don't
|
message but then the watch was never viewed. In that case we don't
|
||||||
|
|
Loading…
Reference in New Issue