feat: eagerly start persistent sync reconciliation

This commit is contained in:
bponders12-cell 2026-09-01 23:12:28 -04:00
parent 2a6e2541fa
commit 2fd5e888f7
1 changed files with 5 additions and 5 deletions

View File

@ -8,11 +8,11 @@ import 'firebase_options.dart';
import 'core/theme/theme.dart';
import 'core/router.dart';
import 'features/records/records_service.dart';
import 'services/sync/sync_providers.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
// Authoritative Firebase initialization
try {
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
@ -47,17 +47,17 @@ class _MotorcycleDashAppState extends ConsumerState<MotorcycleDashApp> {
@override
void initState() {
super.initState();
// Eagerly construct the sync manager so persisted outbox work is
// reconciled immediately at app startup, not only after visiting a sync UI.
ref.read(syncManagerProvider);
_initDeepLinks();
}
Future<void> _initDeepLinks() async {
_appLinks = AppLinks();
try {
final initialUri = await _appLinks.getInitialLink();
if (initialUri != null) {
_handleDeepLink(initialUri);
}
if (initialUri != null) _handleDeepLink(initialUri);
} catch (_) {}
_linkSubscription = _appLinks.uriLinkStream.listen(