mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-01-02 04:46:47 +01:00
adding javadoc to the data store provider
This commit is contained in:
parent
3212bc2266
commit
0db38567ed
@ -28,6 +28,13 @@ import kotlin.reflect.KProperty
|
||||
/**
|
||||
* Provides a singleton datastore cache
|
||||
* allows for lazily fetching a datastore instance by key to avoid creating multiple stores for the same file
|
||||
* Based on https://androidx.tech/artifacts/datastore/datastore-preferences/1.0.0-source/androidx/datastore/preferences/PreferenceDataStoreDelegate.kt.html
|
||||
*
|
||||
* Makes use of a ReadOnlyProperty in order to provide a simplified api on top of a Context
|
||||
* ReadOnlyProperty allows us to lazily access the backing property instead of requiring it upfront as a dependency
|
||||
* <pre>
|
||||
* val Context.dataStoreProvider by dataStoreProvider()
|
||||
* </pre>
|
||||
*/
|
||||
fun dataStoreProvider(): ReadOnlyProperty<Context, (String) -> DataStore<Preferences>> {
|
||||
return MappedPreferenceDataStoreSingletonDelegate()
|
||||
|
Loading…
Reference in New Issue
Block a user