-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[Control Pad] Refactor app for consistency and reliability, as well as UI updates #4135
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
base: master
Are you sure you want to change the base?
Changes from 4 commits
1427e0b
8e88249
1b9a08a
15cc162
d416be2
a0ca73a
3315d0e
14fd511
14a01e5
800628a
ddf5a3c
544cd3a
c6b9a11
32152b1
4593630
99074a1
908a49c
04e4031
f8878e4
47a0eea
32d8545
5ef9b07
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,9 @@ | ||
| 0.01: New app - forked from widhid | ||
| 0.02: Minor code improvements | ||
| 0.03: Major code refactor | ||
| Change to a rounded style | ||
| Add a button for settings | ||
| Make buttons/toggles much more consistent and reliable | ||
| Instead of text, use icons instead | ||
| Make menu slightly wider to feel more spacious without losing the overlay feel | ||
| Change toggle styles/colors slightly |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -15,28 +15,45 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var Overlay = (function () { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| function Overlay() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| this.width = g.getWidth() - 10 * 2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| this.width = g.getWidth() - 2 * 2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| this.height = g.getHeight() - 24 - 10; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| this.g2 = Graphics.createArrayBuffer(this.width, this.height, 4, { msb: true }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| this.g2.transparent = 13; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| this.renderG2(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Overlay.prototype.setBottom = function (bottom) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var g2 = this.g2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var y = bottom - this.height; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Bangle.setLCDOverlay(g2, 10, y - 10); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Bangle.setLCDOverlay(g2, 2, y - 10); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Overlay.prototype.hide = function () { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Bangle.setLCDOverlay(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Overlay.prototype.renderG2 = function () { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| this.g2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .reset() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .setColor(g.theme.bg) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .fillRect(0, 0, this.width, this.height) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .setColor(colour.on.bg) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .drawRect(0, 0, this.width - 1, this.height - 1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .drawRect(1, 1, this.width - 2, this.height - 2); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var border = 3; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| this.g2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .reset() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .setColor(13) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah- it was just a number in the palette that's used as a transparent background color for the corners. It's the best solution I was able to come up with, but if you have another way, I would prefer having a more elegant solution over this.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Gotya - I don't know of any way to set transparent otherwise. Do you have the source palette for us to see how likely it is that this will change?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure what you mean by source palette :( If it helps, in the screenshot before I edited the layers on, the transparent color was shown as an orange..
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, I mean just where the 13 comes from, like where you found it - the image bytes themselves?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, like I said before, it's just a random number I chose, with no significance at all. That probably isn't the best way to go about something like that, but I didn't find another way :(
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, I see! I think 13 is ok then, let's make it clear in a comment that it's a somewhat arbitrary variable chosen out of nowhere in particular :) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .fillRect(0, 0, this.width, this.height) // Background (Transparent) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .setColor(colour.on.bg) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .fillRect({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| x: 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| y: 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| w: this.width, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| h: this.height, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| r: 20 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }) // The Outer Shape | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .setColor(g.theme.bg == "0" ? "#000" : g.theme.bg) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
RKBoss6 marked this conversation as resolved.
Outdated
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .fillRect({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| x: border, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| y: border, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| w: this.width - (border * 2), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| h: this.height - (border * 2), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| r: 16 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var border = 3; | |
| this.g2 | |
| .reset() | |
| .setColor(13) | |
| .fillRect(0, 0, this.width, this.height) // Background (Transparent) | |
| .setColor(colour.on.bg) | |
| .fillRect({ | |
| x: 0, | |
| y: 0, | |
| w: this.width, | |
| h: this.height, | |
| r: 20 | |
| }) // The Outer Shape | |
| .setColor(g.theme.bg == "0" ? "#000" : g.theme.bg) | |
| .fillRect({ | |
| x: border, | |
| y: border, | |
| w: this.width - (border * 2), | |
| h: this.height - (border * 2), | |
| r: 16 | |
| }); | |
| var border = 3; | |
| var g2 = this.g2; | |
| // Helper to draw a filled rounded rectangle using classic Graphics APIs | |
| function fillRoundedRect(gfx, x, y, w, h, r) { | |
| var x2 = x + w - 1; | |
| var y2 = y + h - 1; | |
| // Draw central rectangles | |
| gfx.fillRect(x + r, y, x2 - r, y2); | |
| gfx.fillRect(x, y + r, x2, y2 - r); | |
| // Draw corner circles | |
| gfx.fillCircle(x + r, y + r, r); | |
| gfx.fillCircle(x2 - r, y + r, r); | |
| gfx.fillCircle(x + r, y2 - r, r); | |
| gfx.fillCircle(x2 - r, y2 - r, r); | |
| } | |
| g2.reset() | |
| .setColor(13); | |
| // Background (Transparent) | |
| g2.fillRect(0, 0, this.width, this.height); | |
| // The Outer Shape | |
| g2.setColor(colour.on.bg); | |
| fillRoundedRect(g2, 0, 0, this.width, this.height, 20); | |
| // Inner shape | |
| g2.setColor(g.theme.bg == "0" ? "#000" : g.theme.bg); | |
| fillRoundedRect( | |
| g2, | |
| border, | |
| border, | |
| this.width - (border * 2), | |
| this.height - (border * 2), | |
| 16 | |
| ); |
Copilot
AI
Jan 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The BLE toggle logic checks both advertising and connected states but uses the short-circuit OR operator without parentheses. This can make the logic less clear. Consider wrapping the condition for clarity: if (NRF.getSecurityStatus().advertising || NRF.getSecurityStatus().connected)
| get: () => NRF.getSecurityStatus().advertising||NRF.getSecurityStatus().connected, | |
| toggle: () => { | |
| if (NRF.getSecurityStatus().advertising||NRF.getSecurityStatus().connected) NRF.sleep(); else NRF.wake(); | |
| get: () => { | |
| const status = NRF.getSecurityStatus(); | |
| return status && (status.advertising || status.connected); | |
| }, | |
| toggle: () => { | |
| const status = NRF.getSecurityStatus(); | |
| if (status && (status.advertising || status.connected)) NRF.sleep(); else NRF.wake(); |
Copilot
AI
Jan 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The BLE toggle function also calls NRF.getSecurityStatus() twice. Consider storing the result: const status = NRF.getSecurityStatus(); if (status.advertising || status.connected) NRF.sleep(); else NRF.wake();
| get: () => NRF.getSecurityStatus().advertising||NRF.getSecurityStatus().connected, | |
| toggle: () => { | |
| if (NRF.getSecurityStatus().advertising||NRF.getSecurityStatus().connected) NRF.sleep(); else NRF.wake(); | |
| get: () => { | |
| const status = NRF.getSecurityStatus(); | |
| return status.advertising || status.connected; | |
| }, | |
| toggle: () => { | |
| const status = NRF.getSecurityStatus(); | |
| if (status.advertising || status.connected) NRF.sleep(); else NRF.wake(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should make this optional, I want the quiet mode to be temporary and also avoid the flash writes on each tap
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My only gripe with that is when I first used the control panel, bluetooth wouldn't connect, and it took me a few days before I figured out that it was locally turning bluetooth off, and just wouldn't display that. I would prefer to have it global so all apps are affected but haptics still work, but possibly avoiding flash writes if we can.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there's a mix-up here? This is quiet mode, not bluetooth?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I was using it as an example. The point was I didn't want any local change to quiet mode when there's already a global implementation. Could we have a global variable used in messages instead that is saved on e. Kill? I think that would be a better solution for system-level quiet mode, as it avoids writes unnecessarily until E.kill is triggered, and can just be appended in bootloader for simplicity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I see - my use case is different - I want a global change to just buzz but I don't want quiet mode installed or to have it as a hard dependency of the app. Perhaps have the code check if quiet mode scheduler or similar is installed and enable the functionality in that case?
And yes, agreed - saving quiet mode setting in the kill event handler sounds good
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good! For the e.kill handler, we'll need a global variable to act in the file's place, which we have to create. Should we do that, and then update all the apps that use quiet mode? Alternatively, we could have a more system level one, and create a Bangle.quietMode variable for the system instead that achieves the same effect. @gfwilliams wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really don't like the idea of starting to mess with other apps and adding global variables just to deal with this case. So the reason you want to save is because the messages lib looks at quiet in setting.json?
It looks like you and @bobrippling want different things, and as he says maybe you need it to be an option.
Either:
- You have a temporary change which you can do by just overwriting the
.buzzfunction (although ifquietwas set already in settings, you won't ever be able to unset it by changing .buzz) - You change the global setting by writing to
setting.jsonwhich I think is the best bet - I wouldn't worry about thekillhandler (as then you've got these two ways of disabling buzzing which are overlapping). You're only writing in response to a user input which you'll do at most a few times a day, so I don't think this is a big deal.
I think probably the best bet it to switch to just changing .quiet, and then if it's temporary (as bob would like) in a kill handler you set the setting back to what it was before.
Interestingly internally Bangle.js actually reads the settings file each time an app is loaded and looks at the value of vibrate, and if so disables JSBF_ENABLE_BUZZ which stops vibration regardless of what you do to .buzz or what quiet is set to. Really, longer term we should probably just expose the ability to set that flag and delete all the checks for .quiet.
I guess quiet was added rather than changing vibrate because someone still wanted the haptics even when quiet, but maybe we could have a Bangle.haptic that the built-in menus use, and then that gives us a bit more flexibility (to disable haptics as well as making them stronger/weaker).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds good! As for this however, I can make it a setting and use that to decide whether we want buzzes at all, or only quiet mode for messages, etc. It might take some time though, as I'm a bit busy now, but I'll try to get it done soon.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will mislead users - tapping the button will have no visible effect if another app/widget has enabled it (it'll remain on)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, how do you propose we go about fixing it? It has tripped me up when I used it, so is there a way to distinguish whether we triggered it, or if it's on in general? I suppose if we really want the 'control center feel' that we get on phones, it might be best to have it as it is now, as it just shows the state of the HRM and allows you to toggle...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is - we can either have a boolean to keep track if we triggered it, or we delve into Bangle internals to find out, which is what the code does atm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotya, let me look and see how it's done now to see if we can add that functionality in!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good - the code had the checks in, you could pinch that:
BangleApps/apps/ctrlpad/main.ts
Lines 220 to 221 in 1782ced
| const hrm = (Bangle as any)._PWR?.HRM as undefined | Array<string> ; | |
| const off = !hrm || hrm.indexOf(id) === -1; |
Copilot
AI
Jan 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent brace placement. The opening brace should be on the same line as the arrow function for consistency: toggle: () => {Bangle.showLauncher(); return "close";}
| toggle: () => {Bangle.showClock(); return "close";} | |
| }, | |
| { | |
| text: "launch", | |
| img:atob("GBiBAAAAAAAAAAAAAA/AwB/gwBhgwBhn+Bhn+BhgwB/gwA/AwAAAAAAAAA/D8B/n+BhmGBhmGBhmGBhmGB/n+A/D8AAAAAAAAAAAAA=="), | |
| get: () => false, | |
| toggle: () => {Bangle.showLauncher(); return "close";} | |
| }, | |
| { | |
| text: "settings", | |
| img:atob("GBiBAAA8AAB+AAR+IA7/cB//+D///B//+A/D8B8A+H8A/v4Af/4Af/4Af/4Af38A/h8A+A/D8B//+D///B//+A7/cAR+IAB+AAA8AA=="), | |
| get: () => false, | |
| toggle: () => {Bangle.load("setting.app.js"); return "close";} | |
| toggle: () => { | |
| Bangle.showClock(); | |
| return "close"; | |
| } | |
| }, | |
| { | |
| text: "launch", | |
| img:atob("GBiBAAAAAAAAAAAAAA/AwB/gwBhgwBhn+Bhn+BhgwB/gwA/AwAAAAAAAAA/D8B/n+BhmGBhmGBhmGBhmGB/n+A/D8AAAAAAAAAAAAA=="), | |
| get: () => false, | |
| toggle: () => { | |
| Bangle.showLauncher(); | |
| return "close"; | |
| } | |
| }, | |
| { | |
| text: "settings", | |
| img:atob("GBiBAAA8AAB+AAR+IA7/cB//+D///B//+A/D8B8A+H8A/v4Af/4Af/4Af/4Af38A/h8A+A/D8B//+D///B//+A7/cAR+IAB+AAA8AA=="), | |
| get: () => false, | |
| toggle: () => { | |
| Bangle.load("setting.app.js"); | |
| return "close"; | |
| } |
Copilot
AI
Jan 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent brace placement. The opening brace should be on the same line as the arrow function for consistency: toggle: () => {Bangle.load("setting.app.js"); return "close";}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's ok to have the callback terminate the UI itself, rather than spread the responsibility and allocate strings in the code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was due to ui being undefined when it's called, because it's defined later in scope, so this just passes it down to a place where it can actually terminate the UI first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you show me the code where that's the problem and the error output? These functions are all executed after they're all defined, so I don't see how it can be a scoping problem.
For it being a problem that ui isn't set (not a scope problem, just logic), then:
var result = ctrl.cb(...); // if ui was `undefined` here then
if(result == "close"){
terminateUI(); // there's no code between there and here which will make it defined
return;
}|
bobrippling marked this conversation as resolved.
|
Uh oh!
There was an error while loading. Please reload this page.