@@ -61,6 +61,7 @@ import java.io.InputStreamReader
6161import javax.inject.Inject
6262import javax.inject.Singleton
6363import androidx.core.net.toUri
64+ import com.example.util.simpletimetracker.domain.prefs.interactor.PrefsInteractor
6465
6566/* *
6667 * Do not change backup parts order, always add new to the end.
@@ -87,6 +88,7 @@ class BackupRepoImpl @Inject constructor(
8788 private val complexRuleRepo : ComplexRuleRepo ,
8889 private val recordShortcutRepo : RecordShortcutRepo ,
8990 private val clearDataInteractor : ClearDataInteractor ,
91+ private val prefsInteractor : PrefsInteractor ,
9092 private val resourceRepo : ResourceRepo ,
9193 private val daysOfWeekDataLocalMapper : DaysOfWeekDataLocalMapper ,
9294 private val backupPrefsRepo : BackupPrefsRepo ,
@@ -206,6 +208,7 @@ class BackupRepoImpl @Inject constructor(
206208 successCodeMessage = R .string.message_backup_restored,
207209 errorCodeMessage = R .string.message_restore_error,
208210 clearData = true ,
211+ clearPrefs = restoreSettings,
209212 migrateTags = {
210213 migrateTags(
211214 types = recordTypeRepo.getAll(),
@@ -242,6 +245,7 @@ class BackupRepoImpl @Inject constructor(
242245 @StringRes successCodeMessage : Int? ,
243246 @StringRes errorCodeMessage : Int ,
244247 clearData : Boolean ,
248+ clearPrefs : Boolean ,
245249 migrateTags : suspend (MutableList <Pair <RecordTag , Long >>) -> Unit ,
246250 dataHandler : DataHandler ,
247251 ): ResultCode = withContext(Dispatchers .IO ) {
@@ -262,6 +266,7 @@ class BackupRepoImpl @Inject constructor(
262266 if (line != BACKUP_IDENTIFICATION ) return @withContext errorCode
263267
264268 if (clearData) clearDataInteractor.execute()
269+ if (clearPrefs) prefsInteractor.clear()
265270
266271 // List of tag to related type id.
267272 val tagsMigrationData: MutableList <Pair <RecordTag , Long >> = mutableListOf ()
0 commit comments