Skip to content

Commit 934323e

Browse files
committed
feat(notification): handle notification payload in app routing
- Add handling for 'notificationId' in notification payload - Use pushNamed instead of goNamed for navigation to ensure correct context - Pass 'notificationId' as extra data when navigating to article details
1 parent 5411896 commit 934323e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/app/view/app.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,17 +222,19 @@ class _AppViewState extends State<_AppView> {
222222
final contentType =
223223
payload.data['contentType'] as String?; // e.g., 'headline'
224224
final id = payload.data['headlineId'] as String?;
225+
final notificationId = payload.data['notificationId'] as String?;
225226

226227
if (contentType == 'headline' && id != null) {
227228
// Use pushNamed instead of goNamed.
228229
// goNamed replaces the entire navigation stack, which causes issues
229230
// when the app is launched from a terminated state. The new page
230231
// would lack the necessary ancestor widgets (like RepositoryProviders).
231-
// pushNamed correctly pushes the details page on top of the
232-
// existing stack (e.g., the feed), ensuring a valid context.
232+
// pushNamed correctly pushes the details page on top of the existing
233+
// stack (e.g., the feed), ensuring a valid context.
233234
_router.pushNamed(
234235
Routes.globalArticleDetailsName,
235236
pathParameters: {'id': id},
237+
extra: {'notificationId': notificationId},
236238
);
237239
}
238240
});

0 commit comments

Comments
 (0)