···255255 }
256256 }
257257258258- /// Returns true if push registration is pending (permission not yet requested)
258258+ /// True if push registration is pending (permission not yet requested)
259259 bool get hasPendingPushRegistration => _pendingPushRegistration;
260260261261 /// Requests push notification permission and registers if granted
+13-4
lib/src/features/home/ui/pages/main_page.dart
···33import 'package:flutter/material.dart';
44import 'package:flutter/services.dart';
55import 'package:flutter_riverpod/flutter_riverpod.dart';
66+import 'package:get_it/get_it.dart';
67import 'package:spark/src/core/design_system/components/organisms/bottom_nav_bar.dart';
88+import 'package:spark/src/core/notifications/push_notification_service.dart';
79import 'package:spark/src/core/routing/app_router.dart';
810import 'package:spark/src/core/ui/theme/data/models/app_theme.dart';
911import 'package:spark/src/features/auth/providers/auth_providers.dart';
···2628 @override
2729 void initState() {
2830 super.initState();
2929- // Request push notification permission if pending (after login)
3131+ // Handle post-login tasks after the widget tree is built
3032 WidgetsBinding.instance.addPostFrameCallback((_) {
3131- _requestPushPermissionIfNeeded();
3333+ _handlePostLoginTasks();
3234 });
3335 }
34363535- /// Requests push notification permission if it was deferred during login
3636- Future<void> _requestPushPermissionIfNeeded() async {
3737+ /// Handles tasks that need to run after login/auth completes
3838+ Future<void> _handlePostLoginTasks() async {
3939+ // Request push notification permission if pending (after login)
3740 final auth = ref.read(authProvider.notifier);
3841 if (auth.hasPendingPushRegistration) {
3942 await auth.requestPushPermissionAndRegister();
4343+ }
4444+4545+ // Process any pending notification navigation (cold start)
4646+ final pushService = GetIt.instance<PushNotificationService>();
4747+ if (pushService.hasPendingNotification) {
4848+ pushService.processPendingNotification();
4049 }
4150 }
4251
···2121 Widget build(BuildContext context) {
2222 final notificationState = ref.watch(notificationProvider());
23232424+ // Reset the flag when refreshing so we can mark new notifications as seen
2525+ if (notificationState.isRefreshing) {
2626+ _hasMarkedAsSeen = false;
2727+ }
2828+2429 // Mark notifications as seen once they're loaded
2530 if (!_hasMarkedAsSeen &&
2631 !notificationState.isLoading &&
3232+ !notificationState.isRefreshing &&
2733 notificationState.notifications.isNotEmpty) {
2834 _hasMarkedAsSeen = true;
2935 WidgetsBinding.instance.addPostFrameCallback((_) {
+5
lib/src/sprk_app.dart
···2525 @override
2626 void initState() {
2727 super.initState();
2828+ // Register AppRouter globally for push notification navigation
2929+ if (!GetIt.instance.isRegistered<AppRouter>()) {
3030+ GetIt.instance.registerSingleton<AppRouter>(_appRouter);
3131+ }
3232+2833 ref.read(themeProvider.notifier).initialize();
2934 // Defer initialization to after the widget tree is built
3035 // to avoid modifying providers during build