Skip to content

Commit f13ac57

Browse files
committed
refactor(feed): add comments explaining ad placeholder injection
- Added comments in HeadlinesFeedBloc to clarify the process of injecting ad placeholders in different feed loading scenarios. - Explained that the full ad loading and lifecycle are managed by the UI layer. - Provided references to FeedDecoratorService for more detailed explanations of the ad architecture and feed decoration pipeline.
1 parent cc72c9d commit f13ac57

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

lib/headlines-feed/bloc/headlines_feed_bloc.dart

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ class HeadlinesFeedBloc extends Bloc<HeadlinesFeedEvent, HeadlinesFeedState> {
111111
);
112112

113113
// For pagination, only inject ad placeholders, not feed actions.
114+
// This method injects stateless `AdPlaceholder` markers into the feed.
115+
// The full ad loading and lifecycle is managed by the UI layer.
116+
// See `FeedDecoratorService` for a detailed explanation.
114117
final newProcessedFeedItems =
115118
await _feedDecoratorService.injectAdPlaceholders(
116119
feedItems: headlineResponse.items,
@@ -164,7 +167,9 @@ class HeadlinesFeedBloc extends Bloc<HeadlinesFeedEvent, HeadlinesFeedState> {
164167
? await _userContentPreferencesRepository.read(id: currentUser!.id)
165168
: null;
166169

167-
// For a major load, use the full decoration pipeline.
170+
// For a major load, use the full decoration pipeline, which includes
171+
// injecting a high-priority decorator and stateless ad placeholders.
172+
// See `FeedDecoratorService` for a detailed explanation of the ad architecture.
168173
final decorationResult = await _feedDecoratorService.decorateFeed(
169174
headlines: headlineResponse.items,
170175
user: currentUser,
@@ -249,6 +254,9 @@ class HeadlinesFeedBloc extends Bloc<HeadlinesFeedEvent, HeadlinesFeedState> {
249254
? await _userContentPreferencesRepository.read(id: currentUser!.id)
250255
: null;
251256

257+
// Use the full decoration pipeline, which includes injecting a
258+
// high-priority decorator and stateless ad placeholders.
259+
// See `FeedDecoratorService` for a detailed explanation of the ad architecture.
252260
final decorationResult = await _feedDecoratorService.decorateFeed(
253261
headlines: headlineResponse.items,
254262
user: currentUser,
@@ -329,6 +337,9 @@ class HeadlinesFeedBloc extends Bloc<HeadlinesFeedEvent, HeadlinesFeedState> {
329337
? await _userContentPreferencesRepository.read(id: currentUser!.id)
330338
: null;
331339

340+
// Use the full decoration pipeline, which includes injecting a
341+
// high-priority decorator and stateless ad placeholders.
342+
// See `FeedDecoratorService` for a detailed explanation of the ad architecture.
332343
final decorationResult = await _feedDecoratorService.decorateFeed(
333344
headlines: headlineResponse.items,
334345
user: currentUser,

0 commit comments

Comments
 (0)