Skip to content

fix(android): ApplicationSettings not returning precise stored numbers - #10094

Merged
NathanWalker merged 1 commit into
NativeScript:mainfrom
CatchABus:application-settings-number-fix
Nov 17, 2022
Merged

NathanWalker merged 1 commit into
NativeScript:mainfrom
CatchABus:application-settings-number-fix

Conversation

@CatchABus

@CatchABus CatchABus commented Nov 15, 2022 •

Copy link
Copy Markdown
Contributor

PR Checklist

What is the current behavior?

ApplicationSettings.getNumber does not return the precise value of a stored number. That is because setNumber uses SharedPreferences.putFloat inside and float is 32-bit.

To reproduce

ApplicationSettings.setNumber("timestamp", 1668478505);
console.log(ApplicationSettings.getNumber("timestamp")); // Returns 1668478464

What is the new behavior?

ApplicationSettings.setNumber will store the precise value and return it as double.

Issue: https://discord.com/channels/603595811204366337/828973479343947787/1041908934266589195

@cla-bot cla-bot Bot added the cla: yes label Nov 15, 2022
@NathanWalker NathanWalker added this to the 8.4 milestone Nov 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants