GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — fix(devtools): show non-string ApplicationSettings values by NathanWalker · Pull Request #11580 · NativeScript/NativeScript Conversation
Contributor
PR Checklist
What is the current behavior?The devtools Storage panel reads every ApplicationSettings key with What is the new behavior?
Verification: I ran a one-off Vitest spec against a mocked Closes #10513.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
|
There was an error while loading. Please reload this page.
|
View your CI Pipeline Execution ↗ for commit 4646ceb
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗ ☁️ Nx Cloud last updated this comment at |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
commit: |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| } | ||
| getValue(key: string) { | ||
| return ApplicationSettings.getString(key); | ||
| // Android's typed getters throw ClassCastException when the stored value has a different type. |
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I understand the need here but it might also be a good idea to consider a feature implementation that allows retrieving any value.
Android provides getAll() to retrieve a copy(usually a copy) of the hash-map and allows retrieving the values as Objects using HashMap.get.
A thing that comes to mind is an Application.getAny for both platforms which could perhaps return object toString().
This is one way to help avoid unnecessary calls and ClassCastExceptions.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| getValue(key: string) { | ||
| return ApplicationSettings.getString(key); | ||
| // Android's typed getters throw ClassCastException when the stored value has a different type. | ||
| const readers = [() => ApplicationSettings.getString(key), () => ApplicationSettings.getBoolean(key), () => ApplicationSettings.getNumber(key)]; |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
that s really ugly. And if the stored data is the wrong type it is an app issue.
i would much prefer Application.getAny
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
Devtools 0.0.1 Error: java.lang.ClassCastException: java.lang.Boolean cannot be cast to java.lang.String
There was an error while loading. Please reload this page.