How To: Add a new setting #28
-
Hi! I had mentioned in #23 that I was planning to implement a feature:
I need some help to get started. The first step would be to add a new setting and make it both visible and changeable via the web app. All I know so far is that the I'd like to add a boolean setting to E.g.
Do new settings need to be What is next? E.g. how do I add a slider to the web app? How do I add captions in different languages, etc.? Thank you for your support. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 8 replies
-
The code is designed in a way that it's quite simple to add a new feature to the app. You basically don't need to touch the app code at all, since the UI is dynamically generated automatically. To implement a new setting, you need to do the following (if I remember correctly):
This should be all that is needed. If you have any questions, feel free to ask. I hope that I didn't forget anything. |
Beta Was this translation helpful? Give feedback.
-
Thanks, Clemens! That was a good starting point. As my setting affects the
Then building the software again does not seem to be enough:
And restarting the application did not make the setting appear in the web app. Do you also need to run If so, I'd need some further help here, please:
Edit: with the contents of the log file being...
|
Beta Was this translation helpful? Give feedback.
-
Yes, you are right. We have to rebuild the app in order to include the new setting. The code is generated during building, not during runtime. Sorry, I forgot. I have tried this in the last hours and am finally able to build the app again. 🎉 It turns out, that the package.json file had some dependencies missing as well as a wrong one..? I'm not sure how this even worked before. So, hopefully, you should be able to build the app as follows: ➜ ~ npm -v
8.4.1
➜ ~ node -v
v17.5.0
sudo npm i -g @ionic/cli
➜ web git:(tutorial/add_new_setting) npm install This may complain about deprecated dependencies, but will hopefully install everything you need. |
Beta Was this translation helpful? Give feedback.
-
I have created a new branch and implemented the minimal changes needed for a new setting. Note that the app in this branch was not rebuilt, so you can use it to test your setup. The important changes are: 0726aa0 |
Beta Was this translation helpful? Give feedback.
Yes, you are right. We have to rebuild the app in order to include the new setting. The code is generated during building, not during runtime. Sorry, I forgot.
I have tried this in the last hours and am finally able to build the app again. 🎉
It turns out, that the package.json file had some dependencies missing as well as a wrong one..? I'm not sure how this even worked before.
So, hopefully, you should be able to build the app as follows:
0. I have the following versions of node and npm installed: