Skip to content
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

constant prefs filename #24

Closed
emakar opened this issue May 11, 2016 · 1 comment
Closed

constant prefs filename #24

emakar opened this issue May 11, 2016 · 1 comment

Comments

@emakar
Copy link

emakar commented May 11, 2016

SharedPreferences in PersistedMap are created with name:

PersistedMap.class.getSimpleName() + mapName

however if class is obfuscated it might have different name on further app versions, so I'm guessing it would be better to protect class from obfuscation or give preferences a constant name (or allow to specify it on client side)

@jonfinerty
Copy link
Owner

Ah. That is a very good point which I hadn't considered.

Constant name sounds like a simpler option.

However, this raising a bigger issue, which is would be a breaking change. If the name of the prefs changes, then any new calls to Once will return incorrect results. This is already happening though if two builds obfuscate the class into different names, a pretty bad bug.

Perhaps the best choice is to replace the PersistedMap.class.getSimpleName() section with "PersistedMap" which would ensure existing, non-obsfucated clients wouldn't break

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

No branches or pull requests

2 participants