06-26-2021 12:02
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

06-26-2021 12:02
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I'd like to initialize a toggle to the value of the user settings.
E.g., in the settings section of the companion app I have a toggle to switch between "km" and "mi" for distance calculations. I'd like to set its initial value to the current user settings (units.distance)
Is there a way to do so?

06-26-2021 13:57
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


06-26-2021 13:57
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I think this would be possible, but may be slow and messy.
You should be able to initialise the toggle using something like
settingsStorage.setItem(milesSetting, useMiles?'true':'false')
You'd have to get milesSetting by sending it from the watch. This would incur a small delay.
Do you really need for the user to be able to override the preference they've set up in their account?
If so, I'd think about using a <select> so the user could choose 'Miles' or 'km'.
Gondwana Software

06-26-2021 15:29
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

06-26-2021 15:29
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Thank you! I'll take a look

06-26-2021 17:40 - edited 06-26-2021 17:42
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

06-26-2021 17:40 - edited 06-26-2021 17:42
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Either I'm not doing it right or it doesn't work.
I decided to follow your advice and change toggle to a select.
When I call, for example
settingsStorage.setItem("settingsKeyName", 1)
The selection doesn't get set to the second option

06-26-2021 17:47
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

06-26-2021 17:47
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
found your response to a similar question which worked
