Closed Mek101 closed 1 year ago
Hello @Mek101 Thank you for your contribution
Can you please include the code where you use your injectable dependency of cache provider?
Thank you
You mean in the example application?
Yes. I just tested out your code, and it works fine though.
Your solution works alright, but has one potential issue which I see. If the user wishes to implement caching, they need to create a class on their own and pass it as a parameter, but what if a user wishes to use the default shared preferences rather than creating one on their own. Also, this solution eliminates the ability for the user to choose if they wish to implement caching or not.
What are your thoughts?
Thanks
what if a user wishes to use the default shared preferences rather than creating one on their own.
They can simple create a SharedPrefsCacheProvider
instance and pass it as an argument to the OpenGraphParser
constructor.
this solution eliminates the ability for the user to choose if they wish to implement caching or not.
The cacheProvider
parameter can be null, allowing the user to disable caching by providing no implementation.
I also added how to use the default provider with in the example application
I also made the member functions of CacheProvider
suspendable so they can be used in coroutine-heavy contexts.
@Mek101 This is great. I now understand how it would work. Thank you for your explanation.
I will test out your changes soon.
Thank you
@Mek101 Thank you for your contribution.
Merging your changes
This removes the hard-dependency on SharedPreference as a cache implementation and allows the user to supply their own