Merge pull request #2289 from Rarder44/rebble-fix

[rebble] cleanup code and fix fastload issue
pull/2290/head
Gordon Williams 2022-11-18 16:31:15 +00:00 committed by GitHub
commit aaa602b674
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 55 additions and 44 deletions

View File

@ -11,3 +11,4 @@
0.11: fix issue https://github.com/espruino/BangleApps/issues/2128 (#2128) ( settings undefined )
0.12: implemented widget_utils
0.13: convert var/function into let
0.14: cleanup code and fix fastload issue

View File

@ -2,7 +2,7 @@
"id": "rebble",
"name": "Rebble Clock",
"shortName": "Rebble",
"version": "0.13",
"version": "0.14",
"description": "A Pebble style clock, with configurable background, three sidebars including steps, day, date, sunrise, sunset, long live the rebellion",
"readme": "README.md",
"icon": "rebble.png",

View File

@ -291,48 +291,8 @@ Graphics.prototype.setFontKdamThmor = function(scale) {
}
log_debug("starting..");
loadSettings();
loadLocation();
if(settings.autoCycle || settings.sideTap==0)
{
Bangle.setUI({
mode : "clockupdown",
remove : function() {
// Called to unload all of the clock app
if (drawTimeout) clearTimeout(drawTimeout);
drawTimeout = undefined;
delete Graphics.prototype.setFontKdamThmor;
}},
btn=> {
if (btn<0) prevSidebar();
if (btn>0) nextSidebar();
draw();
});
}
else{
Bangle.setUI({
mode : "clock",
remove : function() {
// Called to unload all of the clock app
if (drawTimeout) clearTimeout(drawTimeout);
drawTimeout = undefined;
delete Graphics.prototype.setFontKdamThmor;
}});
}
Bangle.loadWidgets();
draw();
require("widget_utils").hide();
Bangle.on('charging', function(charging) {
let chargingListener= function(charging) {
//redraw the sidebar ( with the battery )
switch(sideBar) {
@ -343,5 +303,55 @@ Graphics.prototype.setFontKdamThmor = function(scale) {
drawSideBar2();
break;
}
});
}
let deleteAll=function()
{
// Called to unload all of the clock app
if (drawTimeout) clearTimeout(drawTimeout);
drawTimeout = undefined;
delete Graphics.prototype.setFontKdamThmor;
Bangle.removeListener('charging',chargingListener);
}
let main=function(){
log_debug("starting..");
loadSettings();
loadLocation();
if(settings.autoCycle || settings.sideTap==0)
{
Bangle.setUI({
mode : "clockupdown",
remove : deleteAll
},
btn=> {
if (btn<0) prevSidebar();
if (btn>0) nextSidebar();
draw();
});
}
else{
Bangle.setUI({
mode : "clock",
remove : deleteAll
});
}
Bangle.on('charging',chargingListener);
Bangle.loadWidgets();
draw();
require("widget_utils").hide();
}
main();
}