update timeout to clock per new implementation in Icon Launcher

master
thyttan 2022-11-06 21:27:40 +01:00
parent 23a0c2fc2f
commit ef1cf7ef7b
1 changed files with 12 additions and 7 deletions

View File

@ -24,7 +24,7 @@ let s = require("Storage");
name:a.name, type:a.type, icon:a.icon, sortorder:a.sortorder, src:a.src name:a.name, type:a.type, icon:a.icon, sortorder:a.sortorder, src:a.src
};}).filter( };}).filter(
app=>app && (app.type=="app" || (app.type=="clock" && settings.showClocks) || (app.type=="launch" && settings.showLaunchers) || !app.type)); app=>app && (app.type=="app" || (app.type=="clock" && settings.showClocks) || (app.type=="launch" && settings.showLaunchers) || !app.type));
apps.sort((a,b)=>{ apps.sort((a,b)=>{
let n=(0|a.sortorder)-(0|b.sortorder); let n=(0|a.sortorder)-(0|b.sortorder);
if (n) return n; // do sortorder first if (n) return n; // do sortorder first
@ -88,7 +88,7 @@ let drawPage = function(p){
} }
g.flip(); g.flip();
}; };
Bangle.loadWidgets(); Bangle.loadWidgets();
//g.clear(); //g.clear();
Bangle.drawWidgets(); Bangle.drawWidgets();
@ -139,7 +139,7 @@ let touchListenerDt = function(_,p){
} }
}; };
Bangle.on("touch",touchListenerDt); Bangle.on("touch",touchListenerDt);
const returnToClock = function() { const returnToClock = function() {
Bangle.setUI(); Bangle.setUI();
clearWatch(buttonWatch); clearWatch(buttonWatch);
@ -182,9 +182,14 @@ const returnToClock = function() {
}; };
// taken from Icon Launcher with minor alterations // taken from Icon Launcher with minor alterations
if (settings.timeOut!="Off"){ var timeoutToClock;
let time=parseInt(settings.timeOut); //the "s" will be trimmed by the parseInt const updateTimeoutToClock = function(){
var timeoutToClock = setTimeout(returnToClock,time*1000); if (settings.timeOut!="Off"){
} let time=parseInt(settings.timeOut); //the "s" will be trimmed by the parseInt
if (timeoutToClock) clearTimeout(timeoutToClock);
timeoutToClock = setTimeout(returnToClock,time*1000);
}
};
updateTimeoutToClock();
} // end of app scope } // end of app scope