feat: eagerly start persistent sync reconciliation
This commit is contained in:
parent
2a6e2541fa
commit
2fd5e888f7
|
|
@ -8,11 +8,11 @@ import 'firebase_options.dart';
|
||||||
import 'core/theme/theme.dart';
|
import 'core/theme/theme.dart';
|
||||||
import 'core/router.dart';
|
import 'core/router.dart';
|
||||||
import 'features/records/records_service.dart';
|
import 'features/records/records_service.dart';
|
||||||
|
import 'services/sync/sync_providers.dart';
|
||||||
|
|
||||||
Future<void> main() async {
|
Future<void> main() async {
|
||||||
WidgetsFlutterBinding.ensureInitialized();
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
|
|
||||||
// Authoritative Firebase initialization
|
|
||||||
try {
|
try {
|
||||||
await Firebase.initializeApp(
|
await Firebase.initializeApp(
|
||||||
options: DefaultFirebaseOptions.currentPlatform,
|
options: DefaultFirebaseOptions.currentPlatform,
|
||||||
|
|
@ -47,17 +47,17 @@ class _MotorcycleDashAppState extends ConsumerState<MotorcycleDashApp> {
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.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();
|
_initDeepLinks();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _initDeepLinks() async {
|
Future<void> _initDeepLinks() async {
|
||||||
_appLinks = AppLinks();
|
_appLinks = AppLinks();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final initialUri = await _appLinks.getInitialLink();
|
final initialUri = await _appLinks.getInitialLink();
|
||||||
if (initialUri != null) {
|
if (initialUri != null) _handleDeepLink(initialUri);
|
||||||
_handleDeepLink(initialUri);
|
|
||||||
}
|
|
||||||
} catch (_) {}
|
} catch (_) {}
|
||||||
|
|
||||||
_linkSubscription = _appLinks.uriLinkStream.listen(
|
_linkSubscription = _appLinks.uriLinkStream.listen(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue