From c6e70dbab4dfaeebb0ca296da4e4d0221617cb5b Mon Sep 17 00:00:00 2001 From: thyttan <6uuxstm66@mozmail.comā©> Date: Mon, 14 Nov 2022 18:42:06 +0100 Subject: [PATCH] Use Bangle.load and Bangle.showClock --- apps/iconlaunch/ChangeLog | 1 + apps/iconlaunch/app.js | 37 ++++++++++------------------------- apps/iconlaunch/metadata.json | 2 +- 3 files changed, 12 insertions(+), 28 deletions(-) diff --git a/apps/iconlaunch/ChangeLog b/apps/iconlaunch/ChangeLog index b0fcaf856..bc5c09c62 100644 --- a/apps/iconlaunch/ChangeLog +++ b/apps/iconlaunch/ChangeLog @@ -14,3 +14,4 @@ added timeOut to return to the clock 0.11: Cleanup timeout when changing to clock Reset timeout on swipe and drag +0.12: Use Bangle.load and Bangle.showClock diff --git a/apps/iconlaunch/app.js b/apps/iconlaunch/app.js index a7b89996a..ee3d8e313 100644 --- a/apps/iconlaunch/app.js +++ b/apps/iconlaunch/app.js @@ -94,7 +94,7 @@ const appId = id * appsN + iconN; if( settings.direct && launchCache.apps[appId]) { - load(launchCache.apps[appId].src); + Bangle.load(launchCache.apps[appId].src); return; } if (appId == selectedItem && launchCache.apps[appId]) { @@ -102,7 +102,7 @@ if (!app.src || s.read(app.src) === undefined) { E.showMessage( /*LANG*/ "App Source\nNot found"); } else { - load(app.src); + Bangle.load(app.src); } } selectedItem = appId; @@ -186,39 +186,22 @@ let i = YtoIdx(e.y); selectItem(i, e); }, - swipe: (h,_) => { if(settings.swipeExit && h==1) { returnToClock(); } }, + swipe: (h,_) => { if(settings.swipeExit && h==1) { Bangle.showClock(); } }, + btn: _=> { if (settings.oneClickExit) Bangle.showClock(); }, + remove: function() { + if (timeout) clearTimeout(timeout); + } }; - const returnToClock = function() { - Bangle.setUI(); - delete launchCache; - delete launchHash; - delete drawItemAuto; - delete drawText; - delete selectItem; - delete onDrag; - delete drawItems; - delete drawItem; - delete returnToClock; - delete idxToY; - delete YtoIdx; - delete settings; - if (timeout) clearTimeout(timeout); - setTimeout(eval, 0, s.read(".bootcde")); - }; - - - if (settings.oneClickExit) mode.btn = returnToClock; - let timeout; const updateTimeout = function(){ if (settings.timeOut!="Off"){ let time=parseInt(settings.timeOut); //the "s" will be trimmed by the parseInt if (timeout) clearTimeout(timeout); - timeout = setTimeout(returnToClock,time*1000); + timeout = setTimeout(returnToClock,time*1000); } - } - + }; + updateTimeout(); Bangle.setUI(mode); diff --git a/apps/iconlaunch/metadata.json b/apps/iconlaunch/metadata.json index 8154d830a..78281a0c9 100644 --- a/apps/iconlaunch/metadata.json +++ b/apps/iconlaunch/metadata.json @@ -2,7 +2,7 @@ "id": "iconlaunch", "name": "Icon Launcher", "shortName" : "Icon launcher", - "version": "0.11", + "version": "0.12", "icon": "app.png", "description": "A launcher inspired by smartphones, with an icon-only scrollable menu.", "tags": "tool,system,launcher",