fix: say why a restore failed in words that can be translated

The snackbar appended the codec's or the exception's own English text,
class names and all. Failures now carry a category (not a backup, from a
newer version, invalid data, too large, unreadable) that the screen maps
to a string resource; the detail stays in the result for tests.
This commit is contained in:
makiolaj committed 2026-10-21 17:39:38 +02:00
1 parent 3003f75333
commit cac58a98db
6 files changed
+78 -27

No files matched your search

@@ -3,6 +3,7 @@ package de.jeanlucmakiola.clockula.ui.settings
import com.google.common.truth.Truth.assertThat
import de.jeanlucmakiola.clockula.backup.BackupFiles
import de.jeanlucmakiola.clockula.data.backup.BackupCodec
import de.jeanlucmakiola.clockula.data.backup.BackupProblem
import de.jeanlucmakiola.clockula.testing.MainDispatcherExtension
import de.jeanlucmakiola.clockula.testing.backupHarness
import kotlinx.coroutines.flow.first
@@ -31,7 +32,7 @@ class BackupViewModelTest {
viewModel.onExportFolderPicked("content://folder")
assertThat(viewModel.events.first()).isEqualTo(BackupEvent.ExportFailed("provider unavailable"))
assertThat(viewModel.events.first()).isEqualTo(BackupEvent.ExportFailed)
assertThat(viewModel.busy.value).isFalse()
}
@@ -49,7 +50,7 @@ class BackupViewModelTest {
viewModel.onImportFilePicked("content://backup")
assertThat(viewModel.events.first()).isEqualTo(BackupEvent.ImportFailed("database unavailable"))
assertThat(viewModel.events.first()).isEqualTo(BackupEvent.ImportFailed(BackupProblem.NOT_APPLIED))
assertThat(viewModel.busy.value).isFalse()
}
}