Fix messages ignoring "Vibrate: Off" setting (from PR #2023)

master
Marco Heiming 2022-07-06 07:49:16 +02:00
parent 0f4fc046f6
commit d82454f942
2 changed files with 6 additions and 2 deletions

View File

@ -55,3 +55,4 @@
0.40: Use default Bangle formatter for booleans
0.41: Add notification icons in the widget
0.42: Separate buzz pattern for incoming calls
Fix messages ignoring "Vibrate: Off" setting

View File

@ -62,12 +62,15 @@ draw:function(recall) {
Bangle.drawWidgets();
},buzz:function(msgSrc) {
if ((require('Storage').readJSON('setting.json',1)||{}).quiet) return; // never buzz during Quiet Mode
var pattern;
if (msgSrc != undefined && msgSrc.toLowerCase() == "phone") {
// special vibration pattern for incoming calls
require("buzz").pattern((require('Storage').readJSON("messages.settings.json", true) || {}).vibrateCalls || ":");
pattern = (require('Storage').readJSON("messages.settings.json", true) || {}).vibrateCalls;
} else {
require("buzz").pattern((require('Storage').readJSON("messages.settings.json", true) || {}).vibrate || ":");
pattern = (require('Storage').readJSON("messages.settings.json", true) || {}).vibrate;
}
if (pattern === undefined) { pattern = ":"; } // pattern may be "", so we can't use || ":" here
require("buzz").pattern(pattern);
},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+w.iconwidth) return;