Skip to content

Feature Request. In Preferences library expose ability to check if a key exists already #4440

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ed-french opened this issue Oct 24, 2020 · 1 comment · Fixed by #4441
Closed

Comments

@ed-french
Copy link

Feature Request only.

A common requirement for ESP32 projects is to have default values, for instance for settings, that can be overridden by the user.
The preferences library provides a great way to conveniently store the settings.
However, on boot, via the Preferences library, there seems to be no way to test if the user has already configured a value of their own, and therefore whether to adopt the hardcoded default instead.
I feel it would be helpful to expose an additional method for preferences that allows the program to check if a key has been set, so the value can then be set to the default, whereas if it has been set that old saved value would be appropriate.
At the moment the get methods do allow a value to be provided as a default, which is returned. But this value is not itself saved, so the program doesn't know if the value is saved (but happens to be the default) or the default has been returned.

@lbernstone
Copy link
Contributor

My attention span is like a fruit fly. I have a patch, and never submitted a PR...

me-no-dev pushed a commit that referenced this issue Nov 3, 2020
Checks to see if a string is a key in the namespace. 

Fixes #4440
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants