feat(backup): add automatic weekly encrypted backups

A silent safety net against in-app data loss or DB corruption, with zero
friction. Driven off the app lifecycle (startup + when hidden), it writes a
sealed .tanemaki copy into the app's private storage once a week, keeping the
newest 3 (rotating). Reuses the manual backup's encryption via the extracted
ExportImportService.buildSealedBackup(); never throws, so a failed copy can't
crash startup or backgrounding. Not registered on web (no file storage).

Settings shows a quiet reassurance line with the date of the last automatic
copy (localised via intl), hidden where no automatic backup exists.
This commit is contained in:
vjrj 2026-07-10 10:17:36 +02:00
parent 0e7eb22c26
commit 39adc423b9
19 changed files with 559 additions and 29 deletions

View file

@ -236,6 +236,15 @@ class Translations$backup$en {
/// en: 'Backup & restore'
String get title => 'Backup & restore';
/// en: 'Automatic backups'
String get autoBackupTitle => 'Automatic backups';
/// en: 'Last copy saved {date}'
String autoBackupLast({required Object date}) => 'Last copy saved ${date}';
/// en: 'A copy is kept automatically in the background'
String get autoBackupNone => 'A copy is kept automatically in the background';
/// en: 'Save a backup'
String get exportJson => 'Save a backup';
@ -1592,6 +1601,9 @@ extension on Translations {
'settings.aboutText' => 'Local-first, encrypted inventory for traditional seeds. AGPL-3.0.',
'settings.aboutOpen' => 'About Tanemaki',
'backup.title' => 'Backup & restore',
'backup.autoBackupTitle' => 'Automatic backups',
'backup.autoBackupLast' => ({required Object date}) => 'Last copy saved ${date}',
'backup.autoBackupNone' => 'A copy is kept automatically in the background',
'backup.exportJson' => 'Save a backup',
'backup.exportJsonSubtitle' => 'A complete copy to keep safe, restore later or move to another device',
'backup.importJson' => 'Restore a backup',