Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Dashboard] Add corruption handlers to Data Stores using Protocol Buffer schemas. #13058

Merged
merged 10 commits into from
Dec 4, 2024
Prev Previous commit
Next Next commit
Add CorruptionHandler to the CustomDateRange DataStore
  • Loading branch information
ThomazFB committed Dec 3, 2024
commit d77fe117d70f982c7c0842e61fb9886c9ab3e8bb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.woocommerce.android.datastore
import android.content.Context
import androidx.datastore.core.DataStore
import androidx.datastore.core.DataStoreFactory
import androidx.datastore.core.handlers.ReplaceFileCorruptionHandler
import androidx.datastore.preferences.core.PreferenceDataStoreFactory
import androidx.datastore.preferences.core.Preferences
import androidx.datastore.preferences.preferencesDataStoreFile
Expand Down Expand Up @@ -102,6 +103,9 @@ class DataStoreModule {
produceFile = {
appContext.preferencesDataStoreFile("dashboard_coupons_custom_date_range_configuration")
},
corruptionHandler = ReplaceFileCorruptionHandler {
CustomDateRange.getDefaultInstance()
},
scope = CoroutineScope(appCoroutineScope.coroutineContext + Dispatchers.IO),
serializer = CustomDateRangeSerializer
)
Expand Down