Open JosephSanjaya opened 1 year ago
hey @JosephSanjaya, can you elaborate your issue in detail?
I'm using Proto DataStore with custom serializer, for example
DataStore<UserPrefData>
but currently PlutoDatastoreWatcher
, is just supported DataStore with Preferences (DataStore Pref)
DataStore<Preferences>
you can see in com.pluto.plugins.datastore.pref.PlutoDatastoreWatcher
it only support DataStore Pref.
object PlutoDatastoreWatcher {
internal val sources = MutableStateFlow<Set<PreferenceHolder>>(emptySet())
fun watch(name: String, store: DataStore<Preferences>) {
sources.update { oldSet ->
mutableSetOf<PreferenceHolder>().apply {
addAll(oldSet)
add(PreferenceHolder(name, store))
}
}
}
fun remove(name: String) {
sources.update { oldSet ->
mutableSetOf<PreferenceHolder>().apply {
oldSet.forEach {
if (it.name != name) add(it)
}
}
}
}
}
internal data class PreferenceHolder(val name: String, val preferences: DataStore<Preferences>)
Is your feature request related to a problem? Please describe. Currently im using proto datastore to support encryption, but i can't seems attach watcher because it need to use
Preferences
generic class.Describe the solution you'd like Please add support Proto DataStore with custom serializer,