Skip to content

Commit 706cd82

Browse files
committed
feat(router): inject InlineAdCacheService into multiple pages
- Add InlineAdCacheService import - Inject InlineAdCacheService into various router pages - Update method signatures to include inlineAdCacheService parameter
1 parent aefbe09 commit 706cd82

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

lib/router/router.dart

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@ import 'package:flutter_news_app_mobile_client_full_source_code/account/view/man
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';
1616
import 'package:flutter_news_app_mobile_client_full_source_code/ads/ad_service.dart';
17+
import 'package:flutter_news_app_mobile_client_full_source_code/ads/inline_ad_cache_service.dart'; // Import InlineAdCacheService
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';
19-
import 'package:flutter_news_app_mobile_client_full_source_code/app/config/config.dart'
20-
as local_config;
2120
import 'package:flutter_news_app_mobile_client_full_source_code/app/view/app_shell.dart';
2221
import 'package:flutter_news_app_mobile_client_full_source_code/authentication/bloc/authentication_bloc.dart';
2322
import 'package:flutter_news_app_mobile_client_full_source_code/authentication/view/authentication_page.dart';
@@ -61,22 +60,21 @@ GoRouter createRouter({
6160
required AuthRepository authenticationRepository,
6261
required DataRepository<Headline> headlinesRepository,
6362
required DataRepository<Topic> topicsRepository,
64-
required DataRepository<Country> countriesRepository,
6563
required DataRepository<Source> sourcesRepository,
64+
required DataRepository<Country> countriesRepository,
6665
required DataRepository<UserAppSettings> userAppSettingsRepository,
6766
required DataRepository<UserContentPreferences>
6867
userContentPreferencesRepository,
6968
required DataRepository<RemoteConfig> remoteConfigRepository,
7069
required DataRepository<User> userRepository,
71-
required local_config.AppEnvironment environment,
7270
required AdService adService,
7371
required GlobalKey<NavigatorState> navigatorKey,
72+
required InlineAdCacheService inlineAdCacheService,
7473
}) {
7574
// Instantiate AccountBloc once to be shared
7675
final accountBloc = AccountBloc(
7776
authenticationRepository: authenticationRepository,
7877
userContentPreferencesRepository: userContentPreferencesRepository,
79-
environment: environment,
8078
);
8179

8280
// Instantiate FeedDecoratorService once to be shared
@@ -298,6 +296,7 @@ GoRouter createRouter({
298296
accountBloc: accountBloc,
299297
appBloc: context.read<AppBloc>(),
300298
feedDecoratorService: feedDecoratorService,
299+
inlineAdCacheService: inlineAdCacheService,
301300
)..add(
302301
EntityDetailsLoadRequested(
303302
entityId: args.entityId,
@@ -385,6 +384,7 @@ GoRouter createRouter({
385384
.read<DataRepository<UserContentPreferences>>(),
386385
feedDecoratorService: feedDecoratorService,
387386
appBloc: context.read<AppBloc>(),
387+
inlineAdCacheService: inlineAdCacheService,
388388
);
389389
},
390390
),
@@ -398,6 +398,7 @@ GoRouter createRouter({
398398
countryRepository: context.read<DataRepository<Country>>(),
399399
appBloc: context.read<AppBloc>(),
400400
feedDecoratorService: feedDecoratorService,
401+
inlineAdCacheService: inlineAdCacheService,
401402
);
402403
},
403404
),
@@ -615,6 +616,7 @@ GoRouter createRouter({
615616
final settingsBloc = SettingsBloc(
616617
userAppSettingsRepository: context
617618
.read<DataRepository<UserAppSettings>>(),
619+
inlineAdCacheService: inlineAdCacheService,
618620
);
619621
// Only load settings if a userId is available
620622
if (userId != null) {

0 commit comments

Comments
 (0)