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