mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-27 12:00:03 +03:00
adding javadoc to the data store provider
This commit is contained in:
parent
3212bc2266
commit
0db38567ed
1 changed files with 7 additions and 0 deletions
|
@ -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 a new issue