Skip to content

Commit

Permalink
Merge pull request #2289 from Rarder44/rebble-fix
Browse files Browse the repository at this point in the history
[rebble] cleanup code and fix fastload issue
  • Loading branch information
gfwilliams authored Nov 18, 2022
2 parents 35668fd + c6255ce commit aaa602b
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 44 deletions.
3 changes: 2 additions & 1 deletion apps/rebble/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@
0.10: Tell clock widgets to hide.
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.13: convert var/function into let
0.14: cleanup code and fix fastload issue
2 changes: 1 addition & 1 deletion apps/rebble/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
94 changes: 52 additions & 42 deletions apps/rebble/rebble.app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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();
}

0 comments on commit aaa602b

Please sign in to comment.