gbridge: Handle notify- events
So dismissing notifications on the phone also clears them on the watchmaster
parent
9c55b47263
commit
a5f3118859
|
|
@ -121,7 +121,7 @@
|
|||
{ "id": "gbridge",
|
||||
"name": "Gadgetbridge",
|
||||
"icon": "app.png",
|
||||
"version":"0.15",
|
||||
"version":"0.16",
|
||||
"description": "The default notification handler for Gadgetbridge notifications from Android",
|
||||
"tags": "tool,system,android,widget",
|
||||
"type":"widget",
|
||||
|
|
|
|||
|
|
@ -13,4 +13,5 @@
|
|||
0.12: Setting to show/hide icon
|
||||
0.13: Modified to use the 'notify' library
|
||||
0.14: Added 'find' event handling
|
||||
0.15: Don't keep LCD on while playing music
|
||||
0.15: Don't keep LCD on while playing music
|
||||
0.16: Handle dismissing notifications on the phone
|
||||
|
|
@ -25,24 +25,30 @@
|
|||
}
|
||||
|
||||
function handleNotificationEvent(event) {
|
||||
require("notify").show(event);
|
||||
Bangle.buzz();
|
||||
if (event.t === "notify") {
|
||||
require("notify").show(event);
|
||||
Bangle.buzz();
|
||||
} else { // notify-
|
||||
require("notify").hide(event);
|
||||
}
|
||||
}
|
||||
|
||||
function updateMusic(options){
|
||||
if (state.music === "play") {
|
||||
require("notify").show(Object.assign({size:40, render:y => {
|
||||
g.setColor(-1);
|
||||
g.drawImage(require("heatshrink").decompress(atob("jEYwILI/EAv/8gP/ARcMgOAASN8h+A/kfwP8n4CD/E/gHgjg/HA=")), 8, y + 8);
|
||||
g.setFontAlign(-1, -1);
|
||||
var x = 40;
|
||||
g.setFont("4x6", 2).drawString(state.musicInfo.artist, x, y + 8);
|
||||
g.setFont("6x8", 1).drawString(state.musicInfo.track, x, y + 22);
|
||||
}}, options));
|
||||
require("notify").show(Object.assign({
|
||||
size:40, id:"music",
|
||||
render:y => {
|
||||
g.setColor(-1);
|
||||
g.drawImage(require("heatshrink").decompress(atob("jEYwILI/EAv/8gP/ARcMgOAASN8h+A/kfwP8n4CD/E/gHgjg/HA=")), 8, y + 8);
|
||||
g.setFontAlign(-1, -1);
|
||||
var x = 40;
|
||||
g.setFont("4x6", 2).drawString(state.musicInfo.artist, x, y + 8);
|
||||
g.setFont("6x8", 1).drawString(state.musicInfo.track, x, y + 22);
|
||||
}}, options));
|
||||
}
|
||||
|
||||
if (state.music === "pause") {
|
||||
require("notify").hide();
|
||||
require("notify").hide("music");
|
||||
}
|
||||
}
|
||||
function handleMusicStateUpdate(event) {
|
||||
|
|
@ -59,7 +65,7 @@
|
|||
function handleCallEvent(event) {
|
||||
if (event.cmd === "accept") {
|
||||
require("notify").show({
|
||||
size: 55, title: event.name,
|
||||
size: 55, title: event.name, id: "call",
|
||||
body: event.number, icon:require("heatshrink").decompress(atob("jEYwIMJj4CCwACJh4CCCIMOAQMGAQMHAQMDAQMBCIMB4PwgHz/EAn4CBj4CBg4CBgACCAAw="))});
|
||||
Bangle.buzz();
|
||||
}
|
||||
|
|
@ -81,6 +87,7 @@
|
|||
global.GB = (event) => {
|
||||
switch (event.t) {
|
||||
case "notify":
|
||||
case "notify-":
|
||||
handleNotificationEvent(event);
|
||||
break;
|
||||
case "musicinfo":
|
||||
|
|
|
|||
Loading…
Reference in New Issue