Skip to content

Commit 3d2d1c2

Browse files
committed
feat(ads): enhance local ad provider consistency
- Add HeadlineImageStyle parameter for interface consistency - Adjust native ad template type based on HeadlineImageStyle - Update imports for BannerAd and NativeAd models
1 parent 212b5ea commit 3d2d1c2

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/ads/local_ad_provider.dart

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import 'package:core/core.dart';
22
import 'package:data_repository/data_repository.dart';
33
import 'package:flutter_news_app_mobile_client_full_source_code/ads/ad_provider.dart';
44
import 'package:flutter_news_app_mobile_client_full_source_code/ads/models/ad_theme_style.dart';
5-
import 'package:flutter_news_app_mobile_client_full_source_code/ads/models/banner_ad.dart'; // Import the new BannerAd model
5+
import 'package:flutter_news_app_mobile_client_full_source_code/ads/models/banner_ad.dart';
66
import 'package:flutter_news_app_mobile_client_full_source_code/ads/models/interstitial_ad.dart';
7-
import 'package:flutter_news_app_mobile_client_full_source_code/ads/models/native_ad.dart'; // Import the refactored NativeAd model
7+
import 'package:flutter_news_app_mobile_client_full_source_code/ads/models/native_ad.dart';
88
import 'package:logging/logging.dart';
99
import 'package:uuid/uuid.dart';
1010

@@ -41,6 +41,7 @@ class LocalAdProvider implements AdProvider {
4141
required AdPlatformIdentifiers adPlatformIdentifiers,
4242
required String? adId,
4343
required AdThemeStyle adThemeStyle,
44+
HeadlineImageStyle? headlineImageStyle, // Added for interface consistency
4445
}) async {
4546
if (adId == null || adId.isEmpty) {
4647
_logger.warning('No local native ad ID provided.');
@@ -58,7 +59,9 @@ class LocalAdProvider implements AdProvider {
5859
id: _uuid.v4(),
5960
provider: AdPlatformType.local,
6061
adObject: localNativeAd,
61-
templateType: NativeAdTemplateType.medium, // Default for local native
62+
templateType: headlineImageStyle == HeadlineImageStyle.largeThumbnail
63+
? NativeAdTemplateType.medium
64+
: NativeAdTemplateType.small,
6265
);
6366
} else {
6467
_logger.warning(
@@ -85,6 +88,7 @@ class LocalAdProvider implements AdProvider {
8588
required AdPlatformIdentifiers adPlatformIdentifiers,
8689
required String? adId,
8790
required AdThemeStyle adThemeStyle,
91+
HeadlineImageStyle? headlineImageStyle, // Added for interface consistency
8892
}) async {
8993
if (adId == null || adId.isEmpty) {
9094
_logger.warning('No local banner ad ID provided.');

0 commit comments

Comments
 (0)