10-11-2021 02:32
10-11-2021 02:32
Is there a way to add a single entry with multiple components?
For example Time, Place. Two separate fields in one entry.
Author | ch, passion for improvement.
Answered! Go to the Best Answer.
03-28-2022 02:26
03-28-2022 02:26
@Gondwana - thanks, with your help the multiple value pair entry is resolved.
<Section title={<Text bold>Multiple pair values</Text>}>
<Text>{"Enter the corresponding place for the time "+props.settingsStorage.getItem("myDate")}</Text>
<TextInput
label={"Time at (" + props.settingsStorage.getItem("myTime1")+")"}
settingsKey="myPlaceSetting1"
/>
<TextInput
label={"Time at (" + props.settingsStorage.getItem("myTime2")+")"}
settingsKey="myPlaceSetting2"
/>
</Section>
Author | ch, passion for improvement.
01-02-2022 00:53
01-02-2022 00:53
Hi @skeil - looking at the watch face in your post "Avoid "origin=null" set in POST request" it seems you may be able to answer this question?
If Orange was a time, can a place be associated with it in the Settings of the App in the Fitbit App? It would be necessary to enter both the time and the place for a single entry.
Author | ch, passion for improvement.
01-02-2022 05:29
01-02-2022 05:29
Hey, I'm not sure if I correctly understand your question.
I think the way the settings are built can not be transferred 1:1 to a normal app layout.
In the screenshot you used I use tile-list-items and checkbox-tiles:
https://github.com/SaskiaKeil/fitbit-todo/blob/master/resources/widgets.gui
But what you want is that one is able to set time and place in the settings, but together in one field?
So far I only used separated fields in the settings, like here for the several auth tokens:
https://github.com/SaskiaKeil/fitbit-todo/blob/master/settings/index.jsx
Maybe you can specify your question a bit more and we can see if I can be of help 🙂
01-02-2022 06:42
01-02-2022 06:42
Hi @skeil - thank so much for your time and effort.
It is the latter, to be able to enter in Settings two fields [Time and Description] that make one entry.
My goal was to have a number of entries in Settings, hopefully being able to use the popup time picker [to avoid validation] to choose a time, and a string field that goes with it to enter the text. This would avoid having to try and do it on the watch,.
Not sure at this stage if a tile-list-items will be used to display on the watch, more likely a textbox with the individual lines for information, as any editing would be done in Settings.
The idea would be to popup an indication of the Description at the specified time.
Author | ch, passion for improvement.
01-02-2022 09:59
01-02-2022 09:59
AFAIK this can only be done in two different fields, especially if you want to use any validation like the time validation.
This page should list all the options:
https://dev.fitbit.com/build/guides/settings/
I fear though that also having a popup time picker is not supported, at least not from what I read in the documentation.
03-17-2022 20:22
03-17-2022 20:22
Using the text input where a label and a user input is shown in Settings, is it possible to programmatically change the label value by picking it up from a variable in the jsx?
The jsx should show the current value in the heading label and allow the user to enter the appropriate description for it.
Author | ch, passion for improvement.
03-17-2022 20:49
03-17-2022 20:49
Maybe. Try something like
<Text>{props.settingsStorage.getItem('labelHeading')??''}</Text>
Use setItem to put a string value in labelHeading. Note that labelHeading isn't the settingsKey of any setting component.
It may be possible to do this just using a local variable, rather than via settingsStorage. An advantage of using settingsStorage is that you can change the value in companion/index.js, which is sometimes useful.
03-28-2022 02:26
03-28-2022 02:26
@Gondwana - thanks, with your help the multiple value pair entry is resolved.
<Section title={<Text bold>Multiple pair values</Text>}>
<Text>{"Enter the corresponding place for the time "+props.settingsStorage.getItem("myDate")}</Text>
<TextInput
label={"Time at (" + props.settingsStorage.getItem("myTime1")+")"}
settingsKey="myPlaceSetting1"
/>
<TextInput
label={"Time at (" + props.settingsStorage.getItem("myTime2")+")"}
settingsKey="myPlaceSetting2"
/>
</Section>
Author | ch, passion for improvement.
03-28-2022 12:15
03-28-2022 12:15
Nice!
In theory, it should be possible to put more than one getItem() inside a <Text>.
03-28-2022 12:29
03-28-2022 13:00
03-28-2022 13:00
In general, the best approach to initialising a setting component is to determine what default value you want it to have (typically by entering it manually and console.logging in companion). Then, put start-up code in companion that checks whether the setting has a value; if it doesn't, setItem() it to the default you determined.
Note that setItem() takes a string value.
03-28-2022 13:07
03-28-2022 13:07
Doesn't seem to accept a default value set in the companion at initialisation. Still investigating.
Author | ch, passion for improvement.
03-28-2022 13:14
03-28-2022 13:14
Bonus unsolicited tip: don't try to guess the structure of the value. Inspect a value entered manually.