Repository navigation
fix(devtools): show non-string ApplicationSettings values - #11580
Open
NathanWalker wants to merge 1 commit into
main from
fix/devtools-non-string-settings
Open
Conversation
Copy link
Copy Markdown
Contributor
PR Checklist
What is the current behavior?
The devtools Storage panel reads every ApplicationSettings key with ApplicationSettings.getString(key). On Android that's SharedPreferences.getString(), which throws java.lang.ClassCastException: java.lang.Boolean cannot be cast to java.lang.String for any key stored with setBoolean or setNumber. As a result, opening Storage fails for any app with a non-string setting (#10513 ).
What is the new behavior?
ApplicationSettingsKeyValueProvider.getValue tries the string, boolean and number getters in turn and returns the first one that succeeds, as a string. Missing keys still return undefined. Writes are unchanged.
Verification: I ran a one-off Vitest spec against a mocked ApplicationSettings whose getters throw on a type mismatch, the way Android's do. String, boolean and number keys all read back as 'text', 'true' and '2.5', and the missing key stays undefined. The same spec fails without this change. tsc for packages/devtools reports no new errors.
Closes #10513 .
fix(devtools): show non-string ApplicationSettings values
4646ceb
Closes #10513
Copy link
Copy Markdown
|
View your CI Pipeline Execution ↗ for commit 4646ceb
| Command |
Status |
Duration |
Result |
nx test apps-automated -c=android |
✅ Succeeded |
3m 21s |
View ↗ |
nx run-many --target=test --configuration=ci --... |
✅ Succeeded |
<1s |
View ↗ |
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗
☁️ Nx Cloud last updated this comment at 2026-10-23 20:39:10 UTC
|
Copy link
Copy Markdown
|
Open in StackBlitz
npm i https://pkg.pr.new/@nativescript/core@11580
npm i https://pkg.pr.new/@nativescript/vite@11580
npm i https://pkg.pr.new/@nativescript/webpack@11580
commit: 4646ceb
|
CatchABus
reviewed
Nov 12, 2026
View reviewed changes
Comment thread
packages/devtools/src/impl/ApplicationSettingsKeyValueProvider.ts
|
|
}
|
|
|
getValue(key: string) {
|
|
|
return ApplicationSettings.getString(key);
|
|
|
// Android's typed getters throw ClassCastException when the stored value has a different type.
|
farfromrefug
reviewed
Nov 12, 2026
View reviewed changes
Comment thread
packages/devtools/src/impl/ApplicationSettingsKeyValueProvider.ts
|
|
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)];
|
This branch has not been deployed
No deployments
Sign up for free
to join this conversation on GitHub .
Already have an account?
Sign in to comment
Labels
None yet
3 participants