Skip to content

Commit

Permalink
podadrem: exit after 10 min of inactivity
Browse files Browse the repository at this point in the history
  • Loading branch information
thyttan committed Dec 27, 2023
1 parent ba082f6 commit a9f3244
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions apps/podadrem/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ when fastloading.
0.08: Issue newline before GB commands (solves issue with console.log and ignored commands)
0.09: Don't send the gadgetbridge wake command twice. Once should do since we
issue newline before GB commands.
0.10: Exit automatically after 10 minutes of inactivity.
9 changes: 9 additions & 0 deletions apps/podadrem/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ let R;
let widgetUtils = require("widget_utils");
let backToMenu = false;
let dark = g.theme.dark; // bool
let timeoutExit;
let resetTimeoutExit = ()=>{
if (timeoutExit) clearTimeout(timeoutExit);
timeoutExit = setTimeout(load, 10*60*1000);
};
resetTimeoutExit();

// The main layout of the app
let gfx = function() {
Expand Down Expand Up @@ -53,6 +59,7 @@ let gfx = function() {

// Touch handler for main layout
let touchHandler = function(_, xy) {
resetTimeoutExit();
x = xy.x;
y = xy.y;
len = (R.w<R.h+1)?(R.w/3):(R.h/3);
Expand Down Expand Up @@ -91,6 +98,7 @@ let touchHandler = function(_, xy) {

// Swipe handler for main layout, used to jump backward and forward within a podcast episode.
let swipeHandler = function(LR, _) {
resetTimeoutExit();
if (LR==-1) {
btMsg("service", standardCls, "player.jumpforward");
}
Expand All @@ -108,6 +116,7 @@ let setUI = function() {
Bangle.removeListener("touch", touchHandler);
Bangle.removeListener("swipe", swipeHandler);
clearWatch(buttonHandler);
if (timeoutExit) clearTimeout(timeoutExit);
widgetUtils.show();
}
},
Expand Down
2 changes: 1 addition & 1 deletion apps/podadrem/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "podadrem",
"name": "Podcast Addict Remote",
"shortName": "PA Remote",
"version": "0.09",
"version": "0.10",
"description": "Control Podcast Addict on your android device.",
"readme": "README.md",
"type": "app",
Expand Down

0 comments on commit a9f3244

Please sign in to comment.