recommended approach to generalising code with variables that must be assigned by the user #6945
Replies: 1 comment
-
Posted at 2024-06-19 by @thyttan It sounds to me like customizing the app in the app loader before installing is what you want: https://www.espruino.com/Bangle.js+Custom You could also add a textinput dependency and let users use one of the existing watch keyboards: https://banglejs.com/apps/?c=textinput Posted at 2024-06-19 by rigrigrig I think you want to add a Looks like hasensors does pretty much the thing you want: asks for a bunch of values, then replaces Posted at 2024-06-19 by Guptilious thanks for the suggestions! Will have a look through each and figure out which to use, so I can finish this off :) Posted at 2024-06-19 by AkosLukacs Or you can use Storage to store a config "file" on the device, that has the required credentials. That way you wouldn't have to put the credentials in code. Not even during development. Just read from flash. As long as the config is the same. Posted at 2024-06-19 by @gfwilliams As other have said really, but just to be clear:
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2024-06-19 by Guptilious
I'm nearly finished with an app I've been working on, that allows my bangle JS to work as a TV remote control. I was thinking of learning how to create a mobile app (so the https requests from the watch can go directly to the TV via the app) however for now, I have a node webserver on an rpi and send the https request to that - which then sends commands to the TV.
In order to do this the bangle JS currently has my webservers IP and my login/password for the https server, included as variables inside the code. I obviously can't publish it with my variables but I'm unsure what the best approach here is, if we want to 'generalise' the code, so anyone can then assign their own variables.
I was thinking to comment in the project that you need to write a file to your watch that the code could then reference but wasn't sure if that's the easiest thing to do, to make things generalised for users.
Can someone confirm what the best/easiest approach would be for users to be able to assign their values? Alternatively I could draw some terrible keyboard screen so people can spend 10 minutes typing things in on the watch, but something tells me people won't appreciate that :)
Beta Was this translation helpful? Give feedback.
All reactions