espruino / BangleApps

Bangle.js App Loader (and Apps)
https://banglejs.com/apps
MIT License
496 stars 1.17k forks source link

smpltmr: adapt to new setui #3644

Open thyttan opened 3 weeks ago

thyttan commented 3 weeks ago

btn -> btnRelease as to not fire unintentionally when long pressing the button to reset the watch.

bobrippling commented 6 days ago

Nice idea - is this something we might want to change in other apps too? And if so, would you say we might want a shorter way of doing that?

thyttan commented 6 days ago

I'd think there are probably some other ones as well yes. Haven't done any greping to search for them though.

Might be a good idea - how would we go about it?

bobrippling commented 6 days ago

Yeah, it's a little unfortunate that we'd need the version checking code in other files, which is a few lines of code

if (parseFloat(process.env.VERSION.replace("v","")) < 224.164) {
  uiOptions.btn = ...
} else {
  uiOptions.btnRelease = ...
}

I guess we could trim it down to something like this:

uiOptions[parseFloat(process.env.VERSION.replace("v","")) < 224.164 ? "btn" : "btnRelease"] = ...

and going off a search, apply it to:

apps/angles/app.js
apps/bikespeedo/app.js
apps/calendar/calendar.js
apps/calibration/app.js
apps/clockbg/settings.js
apps/drained/app.js
apps/drained/app.ts
apps/espruinoterm/app.js
apps/folderlaunch/app.js
apps/folderlaunch/app.ts
apps/gipy/app.js
apps/gpstrek/app.js
apps/kbedgewrite/lib.js
apps/messagelist/app.js
apps/mitherm/app.js
apps/openstmap/app.js
apps/pomoplus/app.js
apps/rebbleagenda/app.js
apps/scicalc/app.js
apps/smpltmr/app.js
apps/spacew/app.js
apps/spacew/bench.js
apps/stopwatch/stopwatch.app.js
apps/sudoku/app.js
apps/tempmonitor/tempmonitor.app.js
apps/tetris/tetris.app.js
apps/tinyheads/settings.js
apps/torch/app.js
apps/wrkmem/app.js

But perhaps as another PR, wdyt? Reckon we flag it to Gordon as something that we might want to change in setUI instead?