Skip to content

Commit 1a68956

Browse files
committed
refactor(ads): replace headlineImageStyle with bannerAdShape in widgets
- Remove usage of headlineImageStyle in AdmobInlineAdWidget, LocalBannerAdWidget, and DemoBannerAdWidget - Add bannerAdShape parameter to AdmobInlineAdWidget and LocalBannerAdWidget - Update DemoBannerAdWidget to use bannerAdShape - Remove code related to obtaining headlineImageStyle from AppBloc
1 parent 582335a commit 1a68956

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

lib/ads/widgets/in_article_ad_loader_widget.dart

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -145,19 +145,10 @@ class _InArticleAdLoaderWidgetState extends State<InArticleAdLoaderWidget> {
145145
'Loading new in-article ad for slot: ${widget.slotConfiguration.slotType.name}',
146146
);
147147
try {
148-
// Get the current HeadlineImageStyle from AppBloc
149-
final headlineImageStyle = context
150-
.read<AppBloc>()
151-
.state
152-
.settings
153-
.feedPreferences
154-
.headlineImageStyle;
155-
156148
// Call AdService.getInArticleAd with the full AdConfig.
157149
final loadedAd = await widget.adService.getInArticleAd(
158150
adConfig: widget.adConfig,
159151
adThemeStyle: widget.adThemeStyle,
160-
headlineImageStyle: headlineImageStyle,
161152
);
162153

163154
if (loadedAd != null) {
@@ -238,6 +229,7 @@ class _InArticleAdLoaderWidgetState extends State<InArticleAdLoaderWidget> {
238229
return AdmobInlineAdWidget(
239230
inlineAd: _loadedAd!,
240231
headlineImageStyle: headlineImageStyle,
232+
bannerAdShape: widget.adConfig.articleAdConfiguration.bannerAdShape,
241233
);
242234
case AdPlatformType.local:
243235
if (_loadedAd is NativeAd && _loadedAd!.adObject is LocalNativeAd) {
@@ -249,15 +241,17 @@ class _InArticleAdLoaderWidgetState extends State<InArticleAdLoaderWidget> {
249241
_loadedAd!.adObject is LocalBannerAd) {
250242
return LocalBannerAdWidget(
251243
localBannerAd: _loadedAd!.adObject as LocalBannerAd,
252-
headlineImageStyle: headlineImageStyle,
244+
bannerAdShape: widget.adConfig.articleAdConfiguration.bannerAdShape,
253245
);
254246
}
255247
// Fallback for unsupported local ad types or errors
256248
return const SizedBox.shrink();
257249
case AdPlatformType.demo:
258250
// In demo environment, display placeholder ads directly.
259251
// In-article ads are now always banners, so we use DemoBannerAdWidget.
260-
return DemoBannerAdWidget(headlineImageStyle: headlineImageStyle);
252+
return DemoBannerAdWidget(
253+
bannerAdShape: widget.adConfig.articleAdConfiguration.bannerAdShape,
254+
);
261255
}
262256
}
263257
}

0 commit comments

Comments
 (0)