From 1251f261da4ff7a6eb0d7ecab8124303f7fdbb57 Mon Sep 17 00:00:00 2001 From: thyttan <6uuxstm66@mozmail.comā©> Date: Tue, 2 Jul 2024 00:43:29 +0200 Subject: [PATCH] spotrem: refactor to handle ui all inside setUI and fix lint warnings --- apps/spotrem/ChangeLog | 1 + apps/spotrem/app.js | 15 ++++----------- apps/spotrem/metadata.json | 2 +- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/apps/spotrem/ChangeLog b/apps/spotrem/ChangeLog index 723fbd2d7f..f214545514 100644 --- a/apps/spotrem/ChangeLog +++ b/apps/spotrem/ChangeLog @@ -11,3 +11,4 @@ when fastloading. 0.10: Some refactoring to shorten the code. 0.11: Further refactoring to shorten the code. Fixed search and play that was broken in v0.10. 0.12: Fix some warnings from the linter. +0.13: Move ui-handlers inside setUI-call. diff --git a/apps/spotrem/app.js b/apps/spotrem/app.js index 4abc5392c8..bbe706b935 100644 --- a/apps/spotrem/app.js +++ b/apps/spotrem/app.js @@ -14,7 +14,6 @@ let gfx = function() { widgetUtils.hide(); R = Bangle.appRect; const MARIGIN = 8; - // g.drawString(str, x, y, solid) g.clearRect(R); g.reset(); @@ -100,23 +99,17 @@ let swipeHandler = function(LR, _) { // Navigation input on the main layout let setUI = function() { -// Bangle.setUI code from rigrig's smessages app for volume control: https://git.tubul.net/rigrig/BangleApps/src/branch/personal/apps/smessages/app.js Bangle.setUI( {mode : "updown", - remove : ()=>{ - Bangle.removeListener("touch", touchHandler); - Bangle.removeListener("swipe", swipeHandler); - clearWatch(buttonHandler); - widgetUtils.show(); - } + touch: touchHandler, + swipe: swipeHandler, + btn: ()=>load(), + remove : ()=>widgetUtils.show(), }, ud => { if (ud) Bangle.musicControl(ud>0 ? "volumedown" : "volumeup"); } ); - Bangle.on("touch", touchHandler); - Bangle.on("swipe", swipeHandler); - let buttonHandler = setWatch(()=>{load();}, BTN, {edge:'falling'}); }; // Get back to the main layout diff --git a/apps/spotrem/metadata.json b/apps/spotrem/metadata.json index f25b0e42b3..8ecc0d867c 100644 --- a/apps/spotrem/metadata.json +++ b/apps/spotrem/metadata.json @@ -1,7 +1,7 @@ { "id": "spotrem", "name": "Remote for Spotify", - "version": "0.12", + "version": "0.13", "description": "Control spotify on your android device.", "readme": "README.md", "type": "app",