Skip to content

Commit bf2d5c7

Browse files
committed
feat(HeadlineTapHandler): add notification ID handling
- Add optional notificationId parameter to handleTapFromSystemNotification method - Dispatch AppNotificationTapped event if notificationId is provided - Import ui_kit package for additional functionality
1 parent 956707b commit bf2d5c7

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

lib/shared/widgets/feed_core/headline_tap_handler.dart

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
44
import 'package:flutter_bloc/flutter_bloc.dart';
55
import 'package:flutter_news_app_mobile_client_full_source_code/ads/services/interstitial_ad_manager.dart';
66
import 'package:flutter_news_app_mobile_client_full_source_code/app/bloc/app_bloc.dart';
7+
import 'package:ui_kit/ui_kit.dart';
78
import 'package:url_launcher/url_launcher_string.dart';
89

910
/// {@template headline_tap_handler}
@@ -97,10 +98,18 @@ abstract final class HeadlineTapHandler {
9798
///
9899
/// - [context]: The current [BuildContext] to access BLoCs and for navigation.
99100
/// - [headlineId]: The ID of the [Headline] item that was tapped.
101+
/// - [notificationId]: The optional ID of the notification itself, used to
102+
/// mark it as read.
100103
static Future<void> handleTapFromSystemNotification(
101104
BuildContext context,
102-
String headlineId,
103-
) async {
105+
String headlineId, {
106+
String? notificationId,
107+
}) async {
108+
// If a notificationId is provided, dispatch an event to mark it as read.
109+
if (notificationId != null) {
110+
context.read<AppBloc>().add(AppNotificationTapped(notificationId));
111+
}
112+
104113
if (context.mounted) {
105114
showDialog<void>(
106115
context: context,

0 commit comments

Comments
 (0)