feat(sync): préparation à la synchronisation cloud (ticket #12)
Ajuste les ports et le bootstrap applicatif, ainsi que le mapping Drift des repositories, pour préparer une future synchronisation cloud (invariants documentés dans docs/sync-invariants.md). Corrige au passage un bug de fuseau horaire UTC dans le mapping Drift. flutter analyze propre, 35/35 tests verts, build APK debug validé. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@ -11,6 +11,7 @@ final class AppBootstrap {
|
||||
required this.activeWorkoutSessionUseCases,
|
||||
required this.closeWorkoutSessionUseCase,
|
||||
required this.workoutHistoryUseCases,
|
||||
required this.syncGateway,
|
||||
});
|
||||
|
||||
final AppDatabase database;
|
||||
@ -21,6 +22,7 @@ final class AppBootstrap {
|
||||
final ActiveWorkoutSessionUseCases activeWorkoutSessionUseCases;
|
||||
final CloseWorkoutSessionUseCase closeWorkoutSessionUseCase;
|
||||
final WorkoutHistoryUseCases workoutHistoryUseCases;
|
||||
final SyncGateway syncGateway;
|
||||
|
||||
static Future<AppBootstrap> create() async {
|
||||
final database = AppDatabase.open();
|
||||
@ -83,6 +85,7 @@ final class AppBootstrap {
|
||||
repository: historyRepository,
|
||||
clock: clock,
|
||||
),
|
||||
syncGateway: const NoOpSyncGateway(),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -92,3 +92,26 @@ abstract interface class WorkoutHistoryRepository {
|
||||
Future<void> saveSetResult(WorkoutHistorySetResult result);
|
||||
Future<void> delete(String id, DateTime deletedAt);
|
||||
}
|
||||
|
||||
final class SyncRunSummary {
|
||||
const SyncRunSummary({
|
||||
required this.pushedChanges,
|
||||
required this.pulledChanges,
|
||||
});
|
||||
|
||||
final int pushedChanges;
|
||||
final int pulledChanges;
|
||||
}
|
||||
|
||||
abstract interface class SyncGateway {
|
||||
Future<SyncRunSummary> synchronize();
|
||||
}
|
||||
|
||||
final class NoOpSyncGateway implements SyncGateway {
|
||||
const NoOpSyncGateway();
|
||||
|
||||
@override
|
||||
Future<SyncRunSummary> synchronize() async {
|
||||
return const SyncRunSummary(pushedChanges: 0, pulledChanges: 0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user