Skip to content

Commit 1349628

Browse files
committed
refactor(push-notification): update notification payload structure
- Corrected the structure of the PushNotificationPayload - Removed unnecessary fields (body, data) - Added new fields (notificationId, notificationType, contentType, contentId) - Simplified the payload object to improve readability and maintainability
1 parent 7e4e077 commit 1349628

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

lib/src/services/push_notification_service.dart

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -211,16 +211,14 @@ class DefaultPushNotificationService implements IPushNotificationService {
211211
id: notificationId.oid,
212212
userId: userId,
213213
payload: PushNotificationPayload(
214+
// Corrected payload structure
214215
title: headline.title,
215-
body: headline.excerpt,
216216
imageUrl: headline.imageUrl,
217-
data: {
218-
'notificationType':
219-
PushNotificationSubscriptionDeliveryType.breakingOnly.name,
220-
'contentType': 'headline',
221-
'headlineId': headline.id,
222-
'notificationId': notificationId.oid,
223-
},
217+
notificationId: notificationId.oid,
218+
notificationType:
219+
PushNotificationSubscriptionDeliveryType.breakingOnly,
220+
contentType: ContentType.headline,
221+
contentId: headline.id,
224222
),
225223
createdAt: DateTime.now(),
226224
);

0 commit comments

Comments
 (0)