I've made a fork here https://github.com/MFlisar/ModernAndroidPreferences and implemented an arbitrary storage layer here
What I did:
- created an interface
Storage
- created a default storage implementation
SharedPreferencesStorage which works just as your current solution
- replaced the
SharedPreferences inside your library with the Storage instance (builder, dsl, ...)
Why?
In my case I need multi process support and therefore I have written a room based preference library and I want to plug in this library into yours. Additionally, preferences are not the most modern solution for preferences, datastore is the new way - with my solution you can easily provide a storage implementation that uses the DataStore instead of the SharedPreferences in the future and still let your users choose. And of course, any user can replace the storage implementation with their own
Question
Do you think such a change (it's small and does not add any complexity to your library) does make sense and should be merged into your library? I did not adjust any tests yet but if you like the idea, I'll make those adjustments and create a pull request.
I've made a fork here https://github.com/MFlisar/ModernAndroidPreferences and implemented an arbitrary storage layer here
What I did:
StorageSharedPreferencesStoragewhich works just as your current solutionSharedPreferencesinside your library with theStorageinstance (builder, dsl, ...)Why?
In my case I need multi process support and therefore I have written a room based preference library and I want to plug in this library into yours. Additionally, preferences are not the most modern solution for preferences, datastore is the new way - with my solution you can easily provide a storage implementation that uses the
DataStoreinstead of theSharedPreferencesin the future and still let your users choose. And of course, any user can replace the storage implementation with their ownQuestion
Do you think such a change (it's small and does not add any complexity to your library) does make sense and should be merged into your library? I did not adjust any tests yet but if you like the idea, I'll make those adjustments and create a pull request.