From 0db38567ed79db8e2418ec35839cfbe9c5dad72a Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Wed, 2 Feb 2022 15:47:30 +0000 Subject: [PATCH] adding javadoc to the data store provider --- .../java/im/vector/app/core/datastore/DataStoreProvider.kt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/vector/src/main/java/im/vector/app/core/datastore/DataStoreProvider.kt b/vector/src/main/java/im/vector/app/core/datastore/DataStoreProvider.kt index f5f76b48b3..5b7988b76f 100644 --- a/vector/src/main/java/im/vector/app/core/datastore/DataStoreProvider.kt +++ b/vector/src/main/java/im/vector/app/core/datastore/DataStoreProvider.kt @@ -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 + *
+ * val Context.dataStoreProvider by dataStoreProvider()
+ * 
*/ fun dataStoreProvider(): ReadOnlyProperty DataStore> { return MappedPreferenceDataStoreSingletonDelegate()