Skip to content

Commit 5cdc380

Browse files
committed
refactor(notifications): update notification tap to use HeadlineTapHandler
Updates the `InAppNotificationCenterPage` to use the `HeadlineTapHandler` when a notification for a headline is tapped. This replaces the previous direct navigation to the details page, ensuring that opening articles from the notification center follows the new external navigation flow.
1 parent 9812a57 commit 5cdc380

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

lib/account/view/in_app_notification_center_page.dart

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@ import 'package:core/core.dart';
22
import 'package:flutter/material.dart';
33
import 'package:flutter_bloc/flutter_bloc.dart';
44
import 'package:flutter_news_app_mobile_client_full_source_code/account/bloc/in_app_notification_center_bloc.dart';
5-
import 'package:flutter_news_app_mobile_client_full_source_code/account/widgets/in_app_notification_list_item.dart';
6-
import 'package:flutter_news_app_mobile_client_full_source_code/ads/services/interstitial_ad_manager.dart';
5+
import 'package:flutter_news_app_mobile_client_full_source_code/account/widgets/in_app_notification_list_item.dart';
76
import 'package:flutter_news_app_mobile_client_full_source_code/l10n/l10n.dart';
8-
import 'package:flutter_news_app_mobile_client_full_source_code/router/routes.dart';
9-
import 'package:go_router/go_router.dart';
7+
import 'package:flutter_news_app_mobile_client_full_source_code/shared/widgets/feed_core/headline_tap_handler.dart';
108
import 'package:ui_kit/ui_kit.dart';
119

1210
/// {@template in_app_notification_center_page}
@@ -299,15 +297,10 @@ class _NotificationListState extends State<_NotificationList> {
299297
final contentId = payload.contentId;
300298

301299
if (contentType == ContentType.headline && contentId.isNotEmpty) {
302-
await context
303-
.read<InterstitialAdManager>()
304-
.onPotentialAdTrigger();
305-
306-
if (!context.mounted) return;
307-
308-
await context.pushNamed(
309-
Routes.globalArticleDetailsName,
310-
pathParameters: {'id': contentId},
300+
// Use the handler to fetch the headline by ID and open it.
301+
await HeadlineTapHandler.handleHeadlineTapById(
302+
context,
303+
contentId,
311304
);
312305
}
313306
},

0 commit comments

Comments
 (0)