diff --git a/apps/cutelauncher/app.js b/apps/cutelauncher/app.js index 4387c8923..f96e6ee57 100644 --- a/apps/cutelauncher/app.js +++ b/apps/cutelauncher/app.js @@ -44,7 +44,7 @@ const ITEM_HEIGHT = 88; - let scroller = E.showScroller({ + E.showScroller({ h: ITEM_HEIGHT, c: apps.length, draw: (idx, rect) => { @@ -75,35 +75,14 @@ load(apps[idx].src); }, remove: () => { - if (timeoutToClock) clearTimeout(timeoutToClock); + // Remove button handler + setWatch(() => { }, BTN1); + // Remove lock handler + Bangle.removeListener('lock'); } }); - // Update timeout on user interaction - const originalDraw = scroller.draw; - scroller.draw = () => { - updateTimeoutToClock(); - originalDraw(); - }; - - // taken from Icon Launcher with minor alterations - let timeoutToClock; - const updateTimeoutToClock = function () { - if (settings.timeOut != 'Off') { - let time = parseInt(settings.timeOut); //the "s" will be trimmed by the parseInt - if (timeoutToClock) clearTimeout(timeoutToClock); - timeoutToClock = setTimeout(Bangle.showClock, time * 1000); - } - }; - updateTimeoutToClock(); - - if (Bangle.backHandler) clearWatch(Bangle.backHandler); - Bangle.backHandler = setWatch(Bangle.showClock, BTN1, { debounce: 100 }); -} // end of app scope - -// setUI now also needs to clear up our back button touch handler -Bangle.setUI = (old => function () { - if (Bangle.backHandler) clearWatch(Bangle.backHandler); - delete Bangle.backHandler; - return old.apply(this, arguments); -})(Bangle.setUI); \ No newline at end of file + setWatch(Bangle.showClock, BTN1, { debounce: 100 }); + // Add lock handler to show clock when locked + Bangle.on('lock', (on) => { if (on) Bangle.showClock(); }); +} diff --git a/apps/cutelauncher/metadata.json b/apps/cutelauncher/metadata.json index b344e0b46..4355ab966 100644 --- a/apps/cutelauncher/metadata.json +++ b/apps/cutelauncher/metadata.json @@ -1,7 +1,7 @@ { "id": "cutelauncher", "name": "Cute Launcher", - "version": "0.03", + "version": "0.04", "description": "A simple launcher app for Bangle.js 2 that makes use of the full touchscreen", "icon": "app.png", "type": "launch",