From e172aa49279b381fd4202efee5879e7d5b9912b3 Mon Sep 17 00:00:00 2001 From: Jeroen Peters Date: Sat, 19 Feb 2022 00:23:12 +0100 Subject: [PATCH] #1132: Messages: Allow disabling repetition of buzzer --- apps/messages/ChangeLog | 6 ++++-- apps/messages/metadata.json | 4 ++-- apps/messages/settings.js | 1 - apps/messages/widget.js | 6 +++--- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/apps/messages/ChangeLog b/apps/messages/ChangeLog index e2c671fa1..4ad3264b7 100644 --- a/apps/messages/ChangeLog +++ b/apps/messages/ChangeLog @@ -15,7 +15,7 @@ 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) 0.12: Extra app-specific notification icons - New animated notifcationicon (instead of large blinking 'MESSAGES') + New animated notification icon (instead of large blinking 'MESSAGES') Added screenshots 0.13: Add /*LANG*/ comments for internationalisation Add 'Delete All' option to message options @@ -31,4 +31,6 @@ 0.19: Use a larger font for message text if it'll fit 0.20: Allow tapping on the body to show a scrollable view of the message and title in a bigger font (fix #1405, #1031) 0.21: Improve list readability on dark theme -0.22: Allow repeat to be switched Off, so there is no buzzing repetition +0.22: Allow repeat to be switched Off, so there is no buzzing repetition. + Also gave the widget a pixel more room to the right + diff --git a/apps/messages/metadata.json b/apps/messages/metadata.json index 87d541d45..7488c792e 100644 --- a/apps/messages/metadata.json +++ b/apps/messages/metadata.json @@ -1,8 +1,8 @@ { "id": "messages", "name": "Messages", - "version": "0.25", - "description": "App to display notifications from iOS and Gadgetbridge", + "version": "0.22", + "description": "App to display notifications from iOS and Gadgetbridge/Android", "icon": "app.png", "type": "app", "tags": "tool,system", diff --git a/apps/messages/settings.js b/apps/messages/settings.js index ae9b4aab5..dcf7b4636 100644 --- a/apps/messages/settings.js +++ b/apps/messages/settings.js @@ -13,7 +13,6 @@ } var vibPatterns = [/*LANG*/"Off", ".", "-", "--", "-.-", "---"]; - var currentVib = settings().vibrate; var mainmenu = { "" : { "title" : /*LANG*/"Messages" }, "< Back" : back, diff --git a/apps/messages/widget.js b/apps/messages/widget.js index 9d5c77c32..fe609fb5c 100644 --- a/apps/messages/widget.js +++ b/apps/messages/widget.js @@ -1,5 +1,5 @@ WIDGETS["messages"]={area:"tl", width:0, iconwidth:24, -draw:function(buzzed_once) { +draw:function() { Bangle.removeListener('touch', this.touch); if (!this.width) return; var c = (Date.now()-this.t)/1000; @@ -8,12 +8,12 @@ draw:function(buzzed_once) { //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; + else if (settings.repeat===0) settings.repeat = (settings.unreadTimeout+241)*1000; // best way to no-repeat and keep next code if (c<120 && (Date.now()-this.l)>settings.repeat*1000) { this.l = Date.now(); WIDGETS["messages"].buzz(); // buzz every settings.repeat seconds } - if (settings.repeat===0 && buzzed_once===true) settings.repeat = (settings.unreadTimeout+241)*1000; // Dont buzz again after this initial one - setTimeout(()=>WIDGETS["messages"].draw(true), 1000); + setTimeout(()=>WIDGETS["messages"].draw(), 1000); if (process.env.HWVERSION>1) Bangle.on('touch', this.touch); },show:function(quiet) { WIDGETS["messages"].t=Date.now(); // first time