From 3909c912bcb30389f42b9be6f9d7d1eb61096a45 Mon Sep 17 00:00:00 2001 From: Jeroen Peters Date: Mon, 3 Jan 2022 19:57:42 +0100 Subject: [PATCH 1/6] WIDGET widbatpc: 0.15: Added option to always display the icon when charging (useful if 'hide if charge greater than' is enabled) --- apps.json | 2 +- apps/widbatpc/ChangeLog | 1 + apps/widbatpc/settings.js | 6 ++++++ apps/widbatpc/widget.js | 3 ++- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/apps.json b/apps.json index 7d8faec91..073c6ded5 100644 --- a/apps.json +++ b/apps.json @@ -936,7 +936,7 @@ "id": "widbatpc", "name": "Battery Level Widget (with percentage)", "shortName": "Battery Widget", - "version": "0.14", + "version": "0.15", "description": "Show the current battery level and charging status in the top right of the clock, with charge percentage", "icon": "widget.png", "type": "widget", diff --git a/apps/widbatpc/ChangeLog b/apps/widbatpc/ChangeLog index 99822b5a9..273e611a4 100644 --- a/apps/widbatpc/ChangeLog +++ b/apps/widbatpc/ChangeLog @@ -11,3 +11,4 @@ 0.12: Fixed for Bangle 2 0.13: Fillbar setting added, see README 0.14: Fix drawing the bar when charging +0.15: Added option to always display the icon when charging (useful if 'hide if charge greater than' is enabled) diff --git a/apps/widbatpc/settings.js b/apps/widbatpc/settings.js index b7a5db9e6..b45fc6749 100644 --- a/apps/widbatpc/settings.js +++ b/apps/widbatpc/settings.js @@ -13,6 +13,7 @@ 'fillbar': false, 'charger': true, 'hideifmorethan': 100, + 'alwaysoncharge': false, } // ...and overwrite them with any saved values // This way saved values are preserved if a new version adds more settings @@ -68,6 +69,11 @@ format: x => x+"%", onchange: save('hideifmorethan'), }, + 'Show on charge': { // Not sure if this is readable enough in the 'big' menu + value: s.alwaysoncharge, + format: onOffFormat, + onchange: save('alwaysoncharge'), + }, } E.showMenu(menu) }) diff --git a/apps/widbatpc/widget.js b/apps/widbatpc/widget.js index 3e5ff47b4..8791b9fe3 100644 --- a/apps/widbatpc/widget.js +++ b/apps/widbatpc/widget.js @@ -29,6 +29,7 @@ 'percentage': true, 'charger': true, 'hideifmorethan': 100, + 'alwaysoncharge': false, }; Object.keys(DEFAULTS).forEach(k=>{ if (settings[k]===undefined) settings[k]=DEFAULTS[k] @@ -67,7 +68,7 @@ var w = 40; if (Bangle.isCharging() && setting('charger')) w += 16; - if (E.getBattery() > setting('hideifmorethan')) + if (setting('alwaysoncharge') == false && E.getBattery() > setting('hideifmorethan')) w = 0; var changed = WIDGETS["batpc"].width != w; WIDGETS["batpc"].width = w; From 61797894afbc096a6a1bd327297ae8fe01d0e9b2 Mon Sep 17 00:00:00 2001 From: Jeroen Peters Date: Mon, 3 Jan 2022 20:28:10 +0100 Subject: [PATCH 2/6] WIDGET widbatpc: 0.15: Added option to always display the icon when charging (useful if 'hide if charge greater than' is enabled) --- apps/widbatpc/widget.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/widbatpc/widget.js b/apps/widbatpc/widget.js index 8791b9fe3..16aea5dae 100644 --- a/apps/widbatpc/widget.js +++ b/apps/widbatpc/widget.js @@ -68,7 +68,7 @@ var w = 40; if (Bangle.isCharging() && setting('charger')) w += 16; - if (setting('alwaysoncharge') == false && E.getBattery() > setting('hideifmorethan')) + if ((setting('alwaysoncharge') == false && Bangle.isCharging()) && E.getBattery() > setting('hideifmorethan')) w = 0; var changed = WIDGETS["batpc"].width != w; WIDGETS["batpc"].width = w; From 37c8fa092185659a73bc37aa65db343675eb7d14 Mon Sep 17 00:00:00 2001 From: Jeroen Peters Date: Mon, 3 Jan 2022 22:41:40 +0100 Subject: [PATCH 3/6] WIDGET widbatpc: 0.15: Added option to always display the icon when charging (useful if 'hide if charge greater than' is enabled) --- apps/widbatpc/widget.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/widbatpc/widget.js b/apps/widbatpc/widget.js index 16aea5dae..5386ffe22 100644 --- a/apps/widbatpc/widget.js +++ b/apps/widbatpc/widget.js @@ -68,8 +68,11 @@ var w = 40; if (Bangle.isCharging() && setting('charger')) w += 16; - if ((setting('alwaysoncharge') == false && Bangle.isCharging()) && E.getBattery() > setting('hideifmorethan')) + if (E.getBattery() > setting('hideifmorethan')) { w = 0; + if( Bangle.isCharging() && setting('alwaysoncharge') === true) + w = 56; + } var changed = WIDGETS["batpc"].width != w; WIDGETS["batpc"].width = w; return changed; From 8c10eb12dd05715ba96d1297b15143e249b1a325 Mon Sep 17 00:00:00 2001 From: Jeroen Peters Date: Mon, 3 Jan 2022 23:19:15 +0100 Subject: [PATCH 4/6] APP ios: 0.08: Added more app identifiers, added 'cannot display' in case a message goes empty because of replacements --- apps.json | 2 +- apps/ios/ChangeLog | 8 +++----- apps/ios/boot.js | 7 ++++++- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/apps.json b/apps.json index ed4eb25a8..609b7e002 100644 --- a/apps.json +++ b/apps.json @@ -116,7 +116,7 @@ { "id": "ios", "name": "iOS Integration", - "version": "0.07", + "version": "0.08", "description": "Display notifications/music/etc from iOS devices", "icon": "app.png", "tags": "tool,system,ios,apple,messages,notifications", diff --git a/apps/ios/ChangeLog b/apps/ios/ChangeLog index 5e60068aa..1873649f9 100644 --- a/apps/ios/ChangeLog +++ b/apps/ios/ChangeLog @@ -2,9 +2,7 @@ 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.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 -0.07: Added more details from music (instead of Undefined) - Added more app identifiers - +0.07: Added more details from music (instead of Undefined), added more app identifiers +0.08: Added more app identifiers, added 'cannot display' in case a message goes empty because of replacements diff --git a/apps/ios/boot.js b/apps/ios/boot.js index 8ccfb617d..d317c23b0 100644 --- a/apps/ios/boot.js +++ b/apps/ios/boot.js @@ -66,6 +66,7 @@ E.on('notify',msg=>{ "com.apple.mobilecal": "Calendar", "com.apple.mobilemail": "Mail", "com.apple.mobilephone": "Phone", + "com.apple.mobileslideshow": "Pictures", "com.apple.MobileSMS": "SMS Message", "com.apple.Passbook": "iOS Wallet", "com.apple.podcasts": "Podcasts", @@ -83,6 +84,7 @@ E.on('notify',msg=>{ "com.ifttt.ifttt" : "IFTTT", "com.jumbo.app" : "Jumbo", "com.linkedin.LinkedIn" : "LinkedIn", + "com.marktplaats.iphone": "Marktplaats", "com.microsoft.Office.Outlook" : "Outlook Mail", "com.nestlabs.jasper.release" : "Nest", "com.netflix.Netflix" : "Netflix", @@ -90,6 +92,7 @@ E.on('notify',msg=>{ "com.skype.skype": "Skype", "com.skype.SkypeForiPad": "Skype", "com.spotify.client": "Spotify", + "com.storytel.iphone": "Storytel", "com.strava.stravaride": "Strava", "com.tinyspeck.chatlyio": "Slack", "com.toyopagroup.picaboo": "Snapchat", @@ -98,6 +101,8 @@ E.on('notify',msg=>{ "com.vilcsak.bitcoin2": "Coinbase", "com.wordfeud.free": "WordFeud", "com.zhiliaoapp.musically": "TikTok", + "io.robbie.HomeAssistant": "Home Assistant", + "net.weks.prowl": "Prowl", "net.whatsapp.WhatsApp": "WhatsApp", "nl.ah.Appie": "Albert Heijn", "nl.postnl.TrackNTrace": "PostNL", @@ -118,7 +123,7 @@ E.on('notify',msg=>{ 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) + body : msg.message&&E.decodeUTF8(msg.message, unicodeRemap, replacer) || "Cannot display" }); // TODO: posaction/negaction? }); From 2d7245943373113cb4bc7e07ee3d46a9efe39d34 Mon Sep 17 00:00:00 2001 From: Jeroen Peters Date: Tue, 4 Jan 2022 00:44:48 +0100 Subject: [PATCH 5/6] APP ios: 0.08: Added more app identifiers, added 'cannot display' in case a message goes empty because of replacements --- apps.json | 2 +- apps/messages/ChangeLog | 1 + apps/messages/app.js | 1 + apps/messages/widget.js | 13 +++++++------ 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/apps.json b/apps.json index 609b7e002..179579cb9 100644 --- a/apps.json +++ b/apps.json @@ -77,7 +77,7 @@ { "id": "messages", "name": "Messages", - "version": "0.14", + "version": "0.15", "description": "App to display notifications from iOS and Gadgetbridge", "icon": "app.png", "type": "app", diff --git a/apps/messages/ChangeLog b/apps/messages/ChangeLog index 94848a26c..4049f3724 100644 --- a/apps/messages/ChangeLog +++ b/apps/messages/ChangeLog @@ -21,3 +21,4 @@ Add 'Delete All' option to message options Now update correctly when 'require("messages").clearAll()' is called 0.14: Hide widget when all unread notifications are dismissed from phone +0.15: Fix: Get dynamic dimensions of notify icon, fixed notification font diff --git a/apps/messages/app.js b/apps/messages/app.js index 79009e77e..345d2115a 100644 --- a/apps/messages/app.js +++ b/apps/messages/app.js @@ -243,6 +243,7 @@ function showMessage(msgid) { checkMessages({clockIfNoMsg:1,clockIfAllRead:1,showMsgIfUnread:1}); }}); } + g.setFont(fontMedium); lines = g.wrapString(msg.body, g.getWidth()-10); var body = (lines.length>4) ? lines.slice(0,4).join("\n")+"..." : lines.join("\n"); layout = new Layout({ type:"v", c: [ diff --git a/apps/messages/widget.js b/apps/messages/widget.js index f01d22ec7..05622b162 100644 --- a/apps/messages/widget.js +++ b/apps/messages/widget.js @@ -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); if (!this.width) return; var c = (Date.now()-this.t)/1000; - g.reset().clearRect(this.x,this.y,this.x+this.width,this.y+23); - 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.reset().clearRect(this.x, this.y, this.x+this.width, this.y+this.ICONS[0].charCodeAt(1)); + g.drawImage(this.ICONS[c&1], this.x, this.y); //if (c<60) Bangle.setLCDPower(1); // keep LCD on for 1 minute let settings = require('Storage').readJSON("messages.settings.json", true) || {}; 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"].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 - WIDGETS["messages"].width=64; + WIDGETS["messages"].width=this.ICONS[0].charCodeAt(0); Bangle.drawWidgets(); Bangle.setLCDPower(1);// turns screen on },hide:function() { @@ -36,7 +37,7 @@ WIDGETS["messages"]={area:"tl",width:0,draw:function() { b(); },touch:function(b,c) { var w=WIDGETS["messages"]; - if (!w||!w.width||c.xw.x+w.width||c.yw.y+23) return; + if (!w||!w.width||c.xw.x+w.width||c.yw.y+w.ICONS[0].charCodeAt(1)) return; load("messages.app.js"); }}; /* 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() { var messages = require("Storage").readJSON("messages.json",1)||[]; if (messages.some(m=>m.new)) WIDGETS["messages"].show(true); -})(); +})(); \ No newline at end of file From cb85dc0c8e4f20b58175dd8db8f77b026c41b1c5 Mon Sep 17 00:00:00 2001 From: Jeroen Peters Date: Tue, 4 Jan 2022 15:32:48 +0100 Subject: [PATCH 6/6] Messages app: bring back icons in code, not on top --- apps/messages/widget.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/messages/widget.js b/apps/messages/widget.js index 05622b162..f2852f2ce 100644 --- a/apps/messages/widget.js +++ b/apps/messages/widget.js @@ -1,10 +1,10 @@ -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 +WIDGETS["messages"]={area:"tl", width:0, iconwidth:23, 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.ICONS[0].charCodeAt(1)); - g.drawImage(this.ICONS[c&1], this.x, this.y); + 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); //if (c<60) Bangle.setLCDPower(1); // keep LCD on for 1 minute let settings = require('Storage').readJSON("messages.settings.json", true) || {}; if (settings.repeat===undefined) settings.repeat = 4; @@ -18,7 +18,7 @@ draw:function() { WIDGETS["messages"].t=Date.now(); // first time 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 - WIDGETS["messages"].width=this.ICONS[0].charCodeAt(0); + WIDGETS["messages"].width=this.iconwidth; Bangle.drawWidgets(); Bangle.setLCDPower(1);// turns screen on },hide:function() { @@ -37,7 +37,7 @@ draw:function() { b(); },touch:function(b,c) { var w=WIDGETS["messages"]; - if (!w||!w.width||c.xw.x+w.width||c.yw.y+w.ICONS[0].charCodeAt(1)) return; + if (!w||!w.width||c.xw.x+w.width||c.yw.y+w.iconwidth) return; load("messages.app.js"); }}; /* We might have returned here if we were in the Messages app for a