Hi all,

I've just landed GeckoSharedPrefs (bug 940575) in fx-team (it's looking all 
green so it should hit m-c very soon). GeckoSharedPrefs is the API for scoped 
SharedPreferences in Fennec. This means, we can now easily scope 
SharedPreferences keys per profile or for the whole app. So, here's what you 
need to know:

- If you want to store a app-scoped key, accessible across profiles, use 
GeckoSharedPrefs.forApp() to get a SharedPreferences instance.
- If you want to store a profile-scope key, only available to the current 
profile, use GeckoSharedPrefs.forProfile() to get a SharedPreferences instance.
- We should *not* be use PreferenceManager.getDefaultSharedPreferences() 
anywhere in our code.

GeckoSharedPrefs also has infrastructure to migrate existing keys to different 
scopes. For now, I've migrated all keys stored in PreferenceManager to the app 
or default profile scopes. If you know of any existing keys that are currently 
app-scoped but should actually be per profile, just add a new migration and 
update the forApp()/forProfile() calls accordingly. Let's try to do those 
migrations in batches though.

Let me know if you have any questions.

Cheers!

--lucasr
_______________________________________________
mobile-firefox-dev mailing list
mobile-firefox-dev@mozilla.org
https://mail.mozilla.org/listinfo/mobile-firefox-dev

Reply via email to