Skip to content

Commit 50285ef

Browse files
committed
feat(entity_details): Track account action shown
- Track account action shown - Dispatch event to app bloc
1 parent 5489427 commit 50285ef

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lib/entity_details/bloc/entity_details_bloc.dart

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,12 @@ class EntityDetailsBloc extends Bloc<EntityDetailsEvent, EntityDetailsState> {
168168
clearErrorMessage: true,
169169
),
170170
);
171+
172+
// Dispatch event if AccountAction was injected in the initial load
173+
if (processedFeedItems.any((item) => item is AccountAction) &&
174+
_appBloc.state.user?.id != null) {
175+
_appBloc.add(AppUserAccountActionShown(userId: _appBloc.state.user!.id));
176+
}
171177
} on HtHttpException catch (e) {
172178
emit(
173179
state.copyWith(
@@ -292,6 +298,12 @@ class EntityDetailsBloc extends Bloc<EntityDetailsEvent, EntityDetailsState> {
292298
clearHeadlinesCursor: !headlineResponse.hasMore,
293299
),
294300
);
301+
302+
// Dispatch event if AccountAction was injected in the newly loaded items
303+
if (newProcessedFeedItems.any((item) => item is AccountAction) &&
304+
_appBloc.state.user?.id != null) {
305+
_appBloc.add(AppUserAccountActionShown(userId: _appBloc.state.user!.id));
306+
}
295307
} on HtHttpException catch (e) {
296308
emit(
297309
state.copyWith(

0 commit comments

Comments
 (0)