Skip to content

Commit 3587199

Browse files
committed
refactor(notifications): simplify token mapping and remove redundant map
1 parent 0634a76 commit 3587199

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

lib/src/services/push_notification_service.dart

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,6 @@ class DefaultPushNotificationService implements IPushNotificationService {
202202
// 7. Iterate through each subscribed user to create and send a
203203
// personalized notification.
204204
final notificationsToCreate = <InAppNotification>[];
205-
final userDeviceTokensMapForSending = <String, List<String>>{};
206205

207206
for (final userId in userIds) {
208207
final userDeviceTokens = userDeviceTokensMap[userId];
@@ -226,7 +225,6 @@ class DefaultPushNotificationService implements IPushNotificationService {
226225
createdAt: DateTime.now(),
227226
);
228227
notificationsToCreate.add(notification);
229-
userDeviceTokensMapForSending[userId] = userDeviceTokens;
230228
}
231229
}
232230

@@ -242,8 +240,7 @@ class DefaultPushNotificationService implements IPushNotificationService {
242240

243241
// 9. Dispatch all push notifications in parallel.
244242
final sendFutures = notificationsToCreate.map((notification) {
245-
final userDeviceTokens =
246-
userDeviceTokensMapForSending[notification.userId] ?? [];
243+
final userDeviceTokens = userDeviceTokensMap[notification.userId] ?? [];
247244
return client!
248245
.sendBulkNotifications(
249246
deviceTokens: userDeviceTokens,

0 commit comments

Comments
 (0)