Skip to content

Commit 2773151

Browse files
committed
feat(ads): integrate AdNavigatorObserver with GoRouter
- Add AdNavigatorObserver to the list of observers in GoRouter - Update createRouter function to accept AdNavigatorObserver as a parameter - Import AdNavigatorObserver from ads module
1 parent 6144b60 commit 2773151

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/router/router.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import 'package:flutter_news_app_mobile_client_full_source_code/account/view/man
1313
import 'package:flutter_news_app_mobile_client_full_source_code/account/view/manage_followed_items/topics/add_topic_to_follow_page.dart';
1414
import 'package:flutter_news_app_mobile_client_full_source_code/account/view/manage_followed_items/topics/followed_topics_list_page.dart';
1515
import 'package:flutter_news_app_mobile_client_full_source_code/account/view/saved_headlines_page.dart';
16+
import 'package:flutter_news_app_mobile_client_full_source_code/ads/ad_navigator_observer.dart';
1617
import 'package:flutter_news_app_mobile_client_full_source_code/ads/ad_service.dart';
1718
import 'package:flutter_news_app_mobile_client_full_source_code/ads/models/ad_theme_style.dart';
1819
import 'package:flutter_news_app_mobile_client_full_source_code/app/bloc/app_bloc.dart';
@@ -70,6 +71,7 @@ GoRouter createRouter({
7071
required DataRepository<User> userRepository,
7172
required local_config.AppEnvironment environment,
7273
required AdService adService,
74+
required AdNavigatorObserver adNavigatorObserver, // Accept AdNavigatorObserver
7375
}) {
7476
// Instantiate AccountBloc once to be shared
7577
final accountBloc = AccountBloc(
@@ -91,6 +93,9 @@ GoRouter createRouter({
9193
// an attempt to build a complex page before the app state is ready.
9294
initialLocation: '/',
9395
debugLogDiagnostics: true,
96+
observers: [
97+
adNavigatorObserver, // Pass the AdNavigatorObserver to GoRouter
98+
],
9499
// --- Redirect Logic ---
95100
redirect: (BuildContext context, GoRouterState state) {
96101
final appStatus = context.read<AppBloc>().state.status;

0 commit comments

Comments
 (0)