Trigger background sync on connectivity recovery

This commit is contained in:
Rijad Zuzo
2026-02-17 23:52:32 +01:00
parent d76b31d37d
commit 9bb484e95d
13 changed files with 268 additions and 3 deletions
+30 -2
View File
@@ -2,6 +2,34 @@
Updated: 2026-02-17
## Latest Milestone (2026-02-17): Connectivity Event-Driven Background Sync
Implemented online-transition-triggered sync so background sync reacts faster
when network returns:
- Added connectivity stream support to reachability abstraction:
- `lib/core/network/reachability/network_reachability.dart`
- new `watch(...)` API for reachability change events
- Added IO implementation using connectivity plugin + internet probe:
- `lib/core/network/reachability/network_reachability_io.dart`
- `connectivity_plus` integrated as transport signal source
- Updated background runner:
- `lib/features/sync/sync_background_runner.dart`
- now listens for offline -> online transitions and triggers immediate sync
- keeps existing startup/resume/periodic behavior
- Added coverage:
- `test/features/sync/sync_background_runner_test.dart`
- verifies transition-trigger behavior and avoids duplicate triggers when
already online
- Updated setup docs:
- `docs/SETUP.md` background sync section now includes connectivity-return
behavior note
Validation for this milestone:
- `flutter analyze` -> pass
- `flutter test` -> pass
## Latest Milestone (2026-02-17): Sync Repair Test Stability + Mobile CRUD/Sync Flow Coverage
Completed two test-depth upgrades:
@@ -313,8 +341,8 @@ Validation for this milestone:
- future enhancement: auto-select and highlight the exact row in main feature
screens after save.
3. Sync trigger maturity:
- implemented via reachability gating; future improvement is explicit OS
connectivity event subscription.
- implemented via reachability gating + online-transition event triggers.
- future: add richer platform-specific network quality awareness if needed.
4. Test depth:
- expanded with mobile compact CRUD+sync flow and rejected-repair flow.
- future: add desktop + web-specific end-to-end sync error/retry scenario.