Skip to content

Commit 8129997

Browse files
committed
refactor(feed): replace ThemeData with AdThemeStyle in FeedDecoratorService
- Update FeedDecoratorService to use AdThemeStyle instead of ThemeData - Modify related methods and parameters to accommodate the new AdThemeStyle - Update ad injection process to use the new theme style
1 parent 4284c1b commit 8129997

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

lib/shared/services/feed_decorator_service.dart

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import 'dart:math';
22

33
import 'package:core/core.dart';
44
import 'package:data_repository/data_repository.dart';
5-
import 'package:flutter/material.dart';
65
import 'package:flutter_news_app_mobile_client_full_source_code/ads/ad_service.dart';
6+
import 'package:flutter_news_app_mobile_client_full_source_code/ads/models/ad_theme_style.dart';
77
import 'package:flutter_news_app_mobile_client_full_source_code/router/routes.dart';
88
import 'package:uuid/uuid.dart';
99

@@ -110,7 +110,7 @@ class FeedDecoratorService {
110110
required List<String> followedTopicIds,
111111
required List<String> followedSourceIds,
112112
required HeadlineImageStyle imageStyle,
113-
required ThemeData theme,
113+
required AdThemeStyle adThemeStyle,
114114
}) async {
115115
// The final list of items to be returned.
116116
final feedWithDecorators = <FeedItem>[...headlines];
@@ -154,7 +154,7 @@ class FeedDecoratorService {
154154
user: user,
155155
adConfig: remoteConfig.adConfig,
156156
imageStyle: imageStyle,
157-
theme: theme,
157+
adThemeStyle: adThemeStyle,
158158
);
159159

160160
// --- Step 3: Return the comprehensive result ---
@@ -175,7 +175,7 @@ class FeedDecoratorService {
175175
required User? user,
176176
required AdConfig adConfig,
177177
required HeadlineImageStyle imageStyle,
178-
required ThemeData theme,
178+
required AdThemeStyle adThemeStyle,
179179
int processedContentItemCount = 0,
180180
}) async {
181181
return _injectAds(
@@ -184,7 +184,7 @@ class FeedDecoratorService {
184184
adConfig: adConfig,
185185
processedContentItemCount: processedContentItemCount,
186186
imageStyle: imageStyle,
187-
theme: theme,
187+
adThemeStyle: adThemeStyle,
188188
);
189189
}
190190

@@ -376,7 +376,7 @@ class FeedDecoratorService {
376376
required User? user,
377377
required AdConfig adConfig,
378378
required HeadlineImageStyle imageStyle,
379-
required ThemeData theme,
379+
required AdThemeStyle adThemeStyle,
380380
int processedContentItemCount = 0,
381381
}) async {
382382
final userRole = user?.appRole ?? AppUserRole.guestUser;
@@ -428,11 +428,11 @@ class FeedDecoratorService {
428428
// multiple of the ad frequency.
429429
if (currentContentItemCount >= adPlacementInterval &&
430430
(currentContentItemCount - adPlacementInterval) % adFrequency == 0) {
431-
// Request an ad from the AdService.
432-
final adToInject = await _adService.getAd(
433-
imageStyle: imageStyle,
434-
theme: theme,
435-
);
431+
// Request an ad from the AdService.
432+
final adToInject = await _adService.getAd(
433+
imageStyle: imageStyle,
434+
adThemeStyle: adThemeStyle,
435+
);
436436
if (adToInject != null) {
437437
result.add(adToInject);
438438
}

0 commit comments

Comments
 (0)