Handle preference stores corruption by clearing them (#5086)
* Handle preference stores corruption by clearing them:
- Use the centralised `PreferenceDataStoreFactory` instead of `preferences by`.
- Add `DefaultPreferencesCorruptionHandlerFactory.replaceWithEmpty` to its `create(name)` method so all preference stores are cleared if they're corrupted.
* Add detekt rule to make sure we use `PreferenceDataStoreFactory` instead of `by preferencesDataStore`
* Remove `@SingleIn` annotations as the annotated class no longer have to be singletons
This commit is contained in:
parent
3faaab407f
commit
8245ad8bc3
30 changed files with 198 additions and 138 deletions
|
|
@ -10,10 +10,14 @@ package io.element.android.x.initializer
|
|||
import android.content.Context
|
||||
import androidx.startup.Initializer
|
||||
import io.element.android.features.rageshake.impl.crash.VectorUncaughtExceptionHandler
|
||||
import io.element.android.features.rageshake.impl.di.RageshakeBindings
|
||||
import io.element.android.libraries.architecture.bindings
|
||||
|
||||
class CrashInitializer : Initializer<Unit> {
|
||||
override fun create(context: Context) {
|
||||
VectorUncaughtExceptionHandler(context).activate()
|
||||
VectorUncaughtExceptionHandler(
|
||||
context.bindings<RageshakeBindings>().preferencesCrashDataStore(),
|
||||
).activate()
|
||||
}
|
||||
|
||||
override fun dependencies(): List<Class<out Initializer<*>>> = emptyList()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue