Skip to content

Commit 612005a

Browse files
committed
chore: misc
1 parent 4896e85 commit 612005a

File tree

8 files changed

+28
-22
lines changed

8 files changed

+28
-22
lines changed

lib/ads/widgets/widgets.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export 'ad_loader_widget.dart';
1+
export 'feed_ad_loader_widget.dart';
22
export 'admob_inline_ad_widget.dart';
33
export 'in_article_ad_loader_widget.dart';
44
export 'local_banner_ad_widget.dart';

lib/entity_details/bloc/entity_details_bloc.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import 'package:core/core.dart';
77
import 'package:data_repository/data_repository.dart';
88
import 'package:equatable/equatable.dart';
99
import 'package:flutter_news_app_mobile_client_full_source_code/account/bloc/account_bloc.dart';
10-
import 'package:flutter_news_app_mobile_client_full_source_code/ads/ad_cache_service.dart';
10+
import 'package:flutter_news_app_mobile_client_full_source_code/ads/inline_ad_cache_service.dart';
1111
import 'package:flutter_news_app_mobile_client_full_source_code/ads/models/ad_theme_style.dart';
1212
import 'package:flutter_news_app_mobile_client_full_source_code/app/bloc/app_bloc.dart';
1313
import 'package:flutter_news_app_mobile_client_full_source_code/shared/services/feed_decorator_service.dart';
@@ -68,7 +68,7 @@ class EntityDetailsBloc extends Bloc<EntityDetailsEvent, EntityDetailsState> {
6868
) async {
6969
// When loading a new entity's details, clear any previously cached ads
7070
// to ensure a fresh set of ads is displayed for the new content.
71-
AdCacheService().clearAllAds();
71+
InlineAdCacheService().clearAllAds();
7272
emit(
7373
state.copyWith(status: EntityDetailsStatus.loading, clearEntity: true),
7474
);

lib/entity_details/view/entity_details_page.dart

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
66
import 'package:flutter_news_app_mobile_client_full_source_code/ads/ad_service.dart';
77
import 'package:flutter_news_app_mobile_client_full_source_code/ads/models/ad_placeholder.dart';
88
import 'package:flutter_news_app_mobile_client_full_source_code/ads/models/ad_theme_style.dart';
9-
import 'package:flutter_news_app_mobile_client_full_source_code/ads/widgets/ad_loader_widget.dart';
9+
import 'package:flutter_news_app_mobile_client_full_source_code/ads/widgets/feed_ad_loader_widget.dart';
1010
import 'package:flutter_news_app_mobile_client_full_source_code/app/bloc/app_bloc.dart';
1111
import 'package:flutter_news_app_mobile_client_full_source_code/entity_details/bloc/entity_details_bloc.dart';
1212
import 'package:flutter_news_app_mobile_client_full_source_code/l10n/app_localizations.dart';
@@ -354,16 +354,19 @@ class _EntityDetailsViewState extends State<EntityDetailsView> {
354354
// Retrieve the user's preferred headline image style from the AppBloc.
355355
// This is the single source of truth for this setting.
356356
// Access the AppBloc to get the remoteConfig for ads.
357-
final adConfig =
358-
context.read<AppBloc>().state.remoteConfig?.adConfig;
357+
final adConfig = context
358+
.read<AppBloc>()
359+
.state
360+
.remoteConfig
361+
?.adConfig;
359362

360363
// Ensure adConfig is not null before building the AdLoaderWidget.
361364
if (adConfig == null) {
362365
// Return an empty widget or a placeholder if adConfig is not available.
363366
return const SizedBox.shrink();
364367
}
365368

366-
return AdLoaderWidget(
369+
return FeedAdLoaderWidget(
367370
adPlaceholder: item,
368371
adService: context.read<AdService>(),
369372
adThemeStyle: AdThemeStyle.fromTheme(

lib/headlines-feed/bloc/headlines_feed_bloc.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import 'package:bloc_concurrency/bloc_concurrency.dart';
55
import 'package:core/core.dart';
66
import 'package:data_repository/data_repository.dart';
77
import 'package:equatable/equatable.dart';
8-
import 'package:flutter_news_app_mobile_client_full_source_code/ads/ad_cache_service.dart';
8+
import 'package:flutter_news_app_mobile_client_full_source_code/ads/inline_ad_cache_service.dart';
99
import 'package:flutter_news_app_mobile_client_full_source_code/ads/models/ad_theme_style.dart';
1010
import 'package:flutter_news_app_mobile_client_full_source_code/app/bloc/app_bloc.dart';
1111
import 'package:flutter_news_app_mobile_client_full_source_code/headlines-feed/models/headline_filter.dart';
@@ -154,7 +154,7 @@ class HeadlinesFeedBloc extends Bloc<HeadlinesFeedEvent, HeadlinesFeedState> {
154154
Emitter<HeadlinesFeedState> emit,
155155
) async {
156156
// On a full refresh, clear the ad cache to ensure fresh ads are loaded.
157-
AdCacheService().clearAllAds();
157+
InlineAdCacheService().clearAllAds();
158158
emit(state.copyWith(status: HeadlinesFeedStatus.loading));
159159
try {
160160
final currentUser = _appBloc.state.user;
@@ -236,7 +236,7 @@ class HeadlinesFeedBloc extends Bloc<HeadlinesFeedEvent, HeadlinesFeedState> {
236236
) async {
237237
// When applying new filters, this is considered a major feed change,
238238
// so we clear the ad cache to get a fresh set of relevant ads.
239-
AdCacheService().clearAllAds();
239+
InlineAdCacheService().clearAllAds();
240240
emit(
241241
state.copyWith(
242242
status: HeadlinesFeedStatus.loading,
@@ -323,7 +323,7 @@ class HeadlinesFeedBloc extends Bloc<HeadlinesFeedEvent, HeadlinesFeedState> {
323323
Emitter<HeadlinesFeedState> emit,
324324
) async {
325325
// Clearing filters is a major feed change, so clear the ad cache.
326-
AdCacheService().clearAllAds();
326+
InlineAdCacheService().clearAllAds();
327327
emit(
328328
state.copyWith(
329329
status: HeadlinesFeedStatus.loading,

lib/headlines-feed/view/headlines_feed_page.dart

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import 'package:flutter_news_app_mobile_client_full_source_code/account/bloc/acc
88
import 'package:flutter_news_app_mobile_client_full_source_code/ads/ad_service.dart';
99
import 'package:flutter_news_app_mobile_client_full_source_code/ads/models/ad_placeholder.dart';
1010
import 'package:flutter_news_app_mobile_client_full_source_code/ads/models/ad_theme_style.dart';
11-
import 'package:flutter_news_app_mobile_client_full_source_code/ads/widgets/ad_loader_widget.dart';
11+
import 'package:flutter_news_app_mobile_client_full_source_code/ads/widgets/feed_ad_loader_widget.dart';
1212
import 'package:flutter_news_app_mobile_client_full_source_code/app/bloc/app_bloc.dart';
1313
import 'package:flutter_news_app_mobile_client_full_source_code/headlines-feed/bloc/headlines_feed_bloc.dart';
1414
import 'package:flutter_news_app_mobile_client_full_source_code/l10n/l10n.dart';
@@ -324,16 +324,19 @@ class _HeadlinesFeedPageState extends State<HeadlinesFeedPage> {
324324
return tile;
325325
} else if (item is AdPlaceholder) {
326326
// Access the AppBloc to get the remoteConfig for ads.
327-
final adConfig =
328-
context.read<AppBloc>().state.remoteConfig?.adConfig;
327+
final adConfig = context
328+
.read<AppBloc>()
329+
.state
330+
.remoteConfig
331+
?.adConfig;
329332

330333
// Ensure adConfig is not null before building the AdLoaderWidget.
331334
if (adConfig == null) {
332335
// Return an empty widget or a placeholder if adConfig is not available.
333336
return const SizedBox.shrink();
334337
}
335338

336-
return AdLoaderWidget(
339+
return FeedAdLoaderWidget(
337340
adPlaceholder: item,
338341
adService: context.read<AdService>(),
339342
adThemeStyle: AdThemeStyle.fromTheme(Theme.of(context)),

lib/headlines-search/bloc/headlines_search_bloc.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import 'package:bloc_concurrency/bloc_concurrency.dart';
55
import 'package:core/core.dart';
66
import 'package:data_repository/data_repository.dart';
77
import 'package:equatable/equatable.dart';
8-
import 'package:flutter_news_app_mobile_client_full_source_code/ads/ad_cache_service.dart';
8+
import 'package:flutter_news_app_mobile_client_full_source_code/ads/inline_ad_cache_service.dart';
99
import 'package:flutter_news_app_mobile_client_full_source_code/ads/models/ad_theme_style.dart';
1010
import 'package:flutter_news_app_mobile_client_full_source_code/app/bloc/app_bloc.dart';
1111
import 'package:flutter_news_app_mobile_client_full_source_code/shared/services/feed_decorator_service.dart';
@@ -201,7 +201,7 @@ class HeadlinesSearchBloc
201201
}
202202

203203
// New search, clear previous ad cache.
204-
AdCacheService().clearAllAds();
204+
InlineAdCacheService().clearAllAds();
205205
emit(
206206
HeadlinesSearchLoading(
207207
lastSearchTerm: searchTerm,

lib/headlines-search/view/headlines_search_page.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
88
import 'package:flutter_news_app_mobile_client_full_source_code/ads/ad_service.dart';
99
import 'package:flutter_news_app_mobile_client_full_source_code/ads/models/ad_placeholder.dart';
1010
import 'package:flutter_news_app_mobile_client_full_source_code/ads/models/ad_theme_style.dart';
11-
import 'package:flutter_news_app_mobile_client_full_source_code/ads/widgets/ad_loader_widget.dart';
11+
import 'package:flutter_news_app_mobile_client_full_source_code/ads/widgets/feed_ad_loader_widget.dart';
1212
import 'package:flutter_news_app_mobile_client_full_source_code/app/bloc/app_bloc.dart';
1313
// HeadlineItemWidget import removed
1414
import 'package:flutter_news_app_mobile_client_full_source_code/headlines-search/bloc/headlines_search_bloc.dart';
@@ -359,7 +359,7 @@ class _HeadlinesSearchViewState extends State<_HeadlinesSearchView> {
359359
return const SizedBox.shrink();
360360
}
361361

362-
return AdLoaderWidget(
362+
return FeedAdLoaderWidget(
363363
adPlaceholder: feedItem,
364364
adService: context.read<AdService>(),
365365
adThemeStyle: AdThemeStyle.fromTheme(

lib/settings/bloc/settings_bloc.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import 'package:bloc_concurrency/bloc_concurrency.dart';
55
import 'package:core/core.dart';
66
import 'package:data_repository/data_repository.dart';
77
import 'package:equatable/equatable.dart';
8-
import 'package:flutter_news_app_mobile_client_full_source_code/ads/ad_cache_service.dart';
8+
import 'package:flutter_news_app_mobile_client_full_source_code/ads/inline_ad_cache_service.dart';
99

1010
part 'settings_event.dart';
1111
part 'settings_state.dart';
@@ -167,7 +167,7 @@ class SettingsBloc extends Bloc<SettingsEvent, SettingsState> {
167167
// When the theme's accent color changes, ads must be reloaded to reflect
168168
// the new styling. Clearing the cache ensures that any visible or
169169
// soon-to-be-visible ads are fetched again with the updated theme.
170-
AdCacheService().clearAllAds();
170+
InlineAdCacheService().clearAllAds();
171171
await _persistSettings(updatedSettings, emit);
172172
}
173173

@@ -232,7 +232,7 @@ class SettingsBloc extends Bloc<SettingsEvent, SettingsState> {
232232
// (small or medium) is requested. To ensure the correct ad format is
233233
// displayed, the cache must be cleared, forcing a new ad load with the
234234
// appropriate template.
235-
AdCacheService().clearAllAds();
235+
InlineAdCacheService().clearAllAds();
236236
await _persistSettings(updatedSettings, emit);
237237
}
238238

0 commit comments

Comments
 (0)