Merge pull request #3386 from bobrippling/fix/chargent-notify-hide

chargent: fix manual/tap hiding of notification
pull/3397/head
thyttan 2024-05-02 18:05:30 +02:00 committed by GitHub
commit 37879b57bd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 5 additions and 3 deletions

View File

@ -4,3 +4,4 @@
0.04: Added notification
0.05: Fixed boot
0.06: Allow tap to silence notification/buzzing
0.07: Fix notification-tap silencing and notification length

View File

@ -24,8 +24,8 @@
lim = sum / cnt;
require('Storage').writeJSON('chargent.json', {limit: lim});
}
const onHide = () => { id = clearInterval(id) };
require('notify').show({id: 'chargent', title: 'Fully charged', onHide });
const onHide = () => { if(id) id = clearInterval(id) };
require('notify').show({id: 'chargent', title: 'Charged', onHide });
// TODO ? customizable
Bangle.buzz(500);
setTimeout(() => Bangle.buzz(500), 1000);

View File

@ -1,6 +1,6 @@
{ "id": "chargent",
"name": "Charge Gently",
"version": "0.06",
"version": "0.07",
"description": "When charging, reminds you to disconnect the watch to prolong battery life.",
"icon": "icon.png",
"type": "bootloader",

View File

@ -157,6 +157,7 @@ exports.hide = function(options) {
hideCallback = undefined;
id = null;
Bangle.removeListener("touch", exports.hide);
E.stopEventPropagation && E.stopEventPropagation();
function anim() {
pos += 4;
if (pos > 0) {