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

View File

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

View File

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