From ed42b0eb41d88659a224fc3d23a1424dc6361a67 Mon Sep 17 00:00:00 2001 From: Martin Boonk Date: Sat, 20 Apr 2024 08:31:41 +0200 Subject: [PATCH] sleeplog - Fix translation messing with back menu items --- apps/sleeplog/ChangeLog | 1 + apps/sleeplog/metadata.json | 2 +- apps/sleeplog/settings.js | 22 +++++++++++----------- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/apps/sleeplog/ChangeLog b/apps/sleeplog/ChangeLog index 9f48750d0..de0ce30cd 100644 --- a/apps/sleeplog/ChangeLog +++ b/apps/sleeplog/ChangeLog @@ -13,3 +13,4 @@ 0.15: Issue newline before GB commands (solves issue with console.log and ignored commands) 0.16: Only write logs if we have a non-empty log to write 0.17: Minor code improvements +0.18: Add back as a function to prevent translation making it a menu entry diff --git a/apps/sleeplog/metadata.json b/apps/sleeplog/metadata.json index 0c3d73a96..455900694 100644 --- a/apps/sleeplog/metadata.json +++ b/apps/sleeplog/metadata.json @@ -2,7 +2,7 @@ "id":"sleeplog", "name":"Sleep Log", "shortName": "SleepLog", - "version": "0.17", + "version": "0.18", "description": "Log and view your sleeping habits. This app is using the built in movement calculation.", "icon": "app.png", "type": "app", diff --git a/apps/sleeplog/settings.js b/apps/sleeplog/settings.js index 7bac69857..2d9da361f 100644 --- a/apps/sleeplog/settings.js +++ b/apps/sleeplog/settings.js @@ -246,14 +246,14 @@ // setup debugging menu var debugMenu = { "": { - title: /*LANG*/"Debugging" - }, - /*LANG*/"< Back": () => { - // check if some value has changed - if (enabled !== !!global.sleeplog.debug || file !== (typeof global.sleeplog.debug === "object") || duration) - require("sleeplog").setDebug(enabled, file ? duration || 12 : undefined); - // redraw main menu - showMain(7); + title: /*LANG*/"Debugging", + back: () => { + // check if some value has changed + if (enabled !== !!global.sleeplog.debug || file !== (typeof global.sleeplog.debug === "object") || duration) + require("sleeplog").setDebug(enabled, file ? duration || 12 : undefined); + // redraw main menu + showMain(7); + } }, /*LANG*/"View log": () => selectDebug(), /*LANG*/"Enable": { @@ -293,9 +293,9 @@ //var menu; var thresholdsMenu = { "": { - title: /*LANG*/"Thresholds" + title: /*LANG*/"Thresholds", + back: () => showMain(2) }, - /*LANG*/"< Back": () => showMain(2), /*LANG*/"Max Awake": { value: settings.maxAwake / 6E4, step: 10, @@ -398,9 +398,9 @@ var mainMenu = { "": { title: "Sleep Log", + back: back, selected: selected }, - /*LANG*/"< Back": () => back(), /*LANG*/"Thresholds": () => showThresholds(), /*LANG*/"Break ToD": { value: settings.breakToD,