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.
33 lines
1,017 B
Dart
33 lines
1,017 B
Dart
import 'package:flutter/widgets.dart';
|
|
|
|
import 'app.dart';
|
|
import 'data/species_repository.dart';
|
|
import 'data/variety_repository.dart';
|
|
import 'di/injector.dart';
|
|
import 'i18n/strings.g.dart';
|
|
import 'services/auto_backup_service.dart';
|
|
import 'services/onboarding_store.dart';
|
|
import 'services/social_service.dart';
|
|
import 'services/social_settings.dart';
|
|
|
|
Future<void> main() async {
|
|
WidgetsFlutterBinding.ensureInitialized();
|
|
LocaleSettings.useDeviceLocaleSync();
|
|
await configureDependencies();
|
|
final onboarding = getIt<OnboardingStore>();
|
|
runApp(
|
|
TranslationProvider(
|
|
child: TaneApp(
|
|
repository: getIt<VarietyRepository>(),
|
|
species: getIt<SpeciesRepository>(),
|
|
onboarding: onboarding,
|
|
social: getIt<SocialService>(),
|
|
socialSettings: getIt<SocialSettings>(),
|
|
showIntro: !await onboarding.introSeen(),
|
|
autoBackup: getIt.isRegistered<AutoBackupService>()
|
|
? getIt<AutoBackupService>()
|
|
: null,
|
|
),
|
|
),
|
|
);
|
|
}
|