Test backup: run every configured mechanism, stop misreporting passphrase-only as unconfigured

The user's report: with only a backup passphrase set (no S3), 'Test
backup nå' errored 'ikke konfigurert' even though Google Auto Backup
works on the passphrase alone. New runConfiguredBackups() writes the
Google blob whenever a passphrase exists and uploads to S3 only when
those credentials are present, throwing only when NOTHING is set up.
The toast now names what actually ran ('Kryptert Google-kopi
oppdatert' and/or the bucket key). Two instrumented tests pin both
ends: passphrase-only succeeds, nothing-configured throws.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Ole-Morten Duesund 2026-06-11 21:20:16 +02:00
commit 8e8156488a
3 changed files with 49 additions and 2 deletions

View file

@ -191,8 +191,15 @@ fun BackupSettingsScreen(nav: Nav) {
onClick = {
scope.launch(Dispatchers.IO) {
try {
val key = BackupManager(context).runAutoBackup()
withContext(Dispatchers.Main) { toast("Lastet opp: $key") }
val r = BackupManager(context).runConfiguredBackups()
val msg = buildString {
if (r.cloudBlobWritten) append("Kryptert Google-kopi oppdatert")
if (r.s3Key != null) {
if (isNotEmpty()) append("\n")
append("Lastet opp til bøtta: ${r.s3Key}")
}
}
withContext(Dispatchers.Main) { toast(msg) }
} catch (e: Exception) {
withContext(Dispatchers.Main) { toast("Backup feilet: ${e.message}") }
}