qmsched: Bangle.js 2 support

Just a minor tweak to make the menu text always fit
pull/914/head
Richard de Boer 2021-11-20 19:35:29 +01:00
parent 100384f2e8
commit 45b78fc5d5
3 changed files with 13 additions and 14 deletions

View File

@ -3718,12 +3718,12 @@
"id": "qmsched",
"name": "Quiet Mode Schedule and Widget",
"shortName": "Quiet Mode",
"version": "0.02",
"version": "0.03",
"description": "Automatically turn Quiet Mode on or off at set times",
"icon": "app.png",
"screenshots": [{"url":"screenshot_edit.png"},{"url":"screenshot_main.png"},{"url":"screenshot_widget_alarms.png"},{"url":"screenshot_widget_silent.png"}],
"tags": "tool,widget",
"supports": ["BANGLEJS"],
"supports": ["BANGLEJS","BANGLEJS2"],
"readme": "README.md",
"storage": [
{"name":"qmsched","url":"lib.js"},

View File

@ -1,3 +1,3 @@
0.01: First version
0.02: Add widget
0.03: Bangle.js 2 support

View File

@ -32,17 +32,16 @@ function formatTime(t) {
}
function showMainMenu() {
const menu = {
"": {"title": "Quiet Mode"},
"Current Mode": {
value: (require("Storage").readJSON("setting.json", 1) || {}).quiet|0,
format: v => modeNames[v],
onchange: function(v) {
if (v<0) {v = 2;}
if (v>2) {v = 0;}
require("qmsched").setMode(v);
this.value = v;
},
let menu = {"": {"title": "Quiet Mode"}};
// "Current Mode""Silent" won't fit on Bangle.js 2
menu["Current" + ((process.env.HWVERSION===2)?"":" Mode")]= {
value: (require("Storage").readJSON("setting.json", 1) || {}).quiet|0,
format: v => modeNames[v],
onchange: function(v) {
if (v<0) {v = 2;}
if (v>2) {v = 0;}
require("qmsched").setMode(v);
this.value = v;
},
};
scheds.sort((a, b) => (a.hr-b.hr));