Skip to content

Bangle_setUI_Q3: fix btn back handler was not always rm:ed correctly #2636

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 10, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions libs/js/banglejs/Bangle_setUI_Q3.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,13 @@
if (options.redraw) // handler for redrawing the UI
Bangle.uiRedraw = options.redraw;
if (options.back) {
var btnWatch;
// only add back button handler if there's no existing watch on BTN1
if (Bangle.btnWatches===undefined)
btnWatch = setWatch(function() {
btnWatch = undefined;
if (Bangle.btnWatches===undefined) {
Bangle.btnWatches = [ setWatch(function() {
Bangle.btnWatches = undefined; // watch doesn't repeat
options.back();
}, BTN1, {edge:"rising"});
}, BTN1, {edge:"rising"}) ];
}
// if we have widgets loaded *and* visible at the top, add a back widget (see #3788)
if (global.WIDGETS && Bangle.appRect.y) {
// add our own touch handler for touching in the top left
Expand All @@ -143,7 +143,6 @@
remove:function(noclear){
var w = WIDGETS.back;
if (w.area!="tl") noclear=true; // area="" is set by widget_utils.hide, so avoid drawing
if (btnWatch) clearWatch(btnWatch);
Bangle.removeListener("touch", touchHandler);
if (!noclear) g.reset().clearRect({x:w.x, y:w.y, w:24,h:24});
delete WIDGETS.back;
Expand Down
Loading