Skip to content

Commit 2bed469

Browse files
committed
style: format
1 parent 4ca732e commit 2bed469

File tree

3 files changed

+40
-40
lines changed

3 files changed

+40
-40
lines changed

lib/src/rbac/permissions.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ abstract class Permissions {
8989
'push_notification_device.create_owned';
9090
static const String pushNotificationDeviceDeleteOwned =
9191
'push_notification_device.delete_owned';
92-
// Allows reading the user's own push notification devices.
9392
static const String pushNotificationDeviceReadOwned =
9493
'push_notification_device.read_owned';
9594

lib/src/registry/data_operation_registry.dart

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -186,11 +186,11 @@ class DataOperationRegistry {
186186
),
187187
'push_notification_device': (c, uid, f, s, p) =>
188188
c.read<DataRepository<PushNotificationDevice>>().readAll(
189-
userId: uid,
190-
filter: f,
191-
sort: s,
192-
pagination: p,
193-
),
189+
userId: uid,
190+
filter: f,
191+
sort: s,
192+
pagination: p,
193+
),
194194
});
195195

196196
// --- Register Item Creators ---
@@ -437,9 +437,9 @@ class DataOperationRegistry {
437437
.update(id: id, item: item as RemoteConfig, userId: uid),
438438
'in_app_notification': (c, id, item, uid) =>
439439
c.read<DataRepository<InAppNotification>>().update(
440-
id: id,
441-
item: item as InAppNotification,
442-
),
440+
id: id,
441+
item: item as InAppNotification,
442+
),
443443
});
444444

445445
// --- Register Item Deleters ---

lib/src/services/push_notification_service.dart

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -32,26 +32,26 @@ class DefaultPushNotificationService implements IPushNotificationService {
3232
/// {@macro default_push_notification_service}
3333
DefaultPushNotificationService({
3434
required DataRepository<PushNotificationDevice>
35-
pushNotificationDeviceRepository,
35+
pushNotificationDeviceRepository,
3636
required DataRepository<UserContentPreferences>
37-
userContentPreferencesRepository,
37+
userContentPreferencesRepository,
3838
required DataRepository<RemoteConfig> remoteConfigRepository,
3939
required DataRepository<InAppNotification> inAppNotificationRepository,
4040
required IPushNotificationClient? firebaseClient,
4141
required IPushNotificationClient? oneSignalClient,
4242
required Logger log,
43-
}) : _pushNotificationDeviceRepository = pushNotificationDeviceRepository,
44-
_userContentPreferencesRepository = userContentPreferencesRepository,
45-
_remoteConfigRepository = remoteConfigRepository,
46-
_inAppNotificationRepository = inAppNotificationRepository,
47-
_firebaseClient = firebaseClient,
48-
_oneSignalClient = oneSignalClient,
49-
_log = log;
43+
}) : _pushNotificationDeviceRepository = pushNotificationDeviceRepository,
44+
_userContentPreferencesRepository = userContentPreferencesRepository,
45+
_remoteConfigRepository = remoteConfigRepository,
46+
_inAppNotificationRepository = inAppNotificationRepository,
47+
_firebaseClient = firebaseClient,
48+
_oneSignalClient = oneSignalClient,
49+
_log = log;
5050

5151
final DataRepository<PushNotificationDevice>
52-
_pushNotificationDeviceRepository;
52+
_pushNotificationDeviceRepository;
5353
final DataRepository<UserContentPreferences>
54-
_userContentPreferencesRepository;
54+
_userContentPreferencesRepository;
5555
final DataRepository<RemoteConfig> _remoteConfigRepository;
5656
final DataRepository<InAppNotification> _inAppNotificationRepository;
5757
final IPushNotificationClient? _firebaseClient;
@@ -113,8 +113,8 @@ class DefaultPushNotificationService implements IPushNotificationService {
113113
// Check if breaking news notifications are enabled.
114114
final isBreakingNewsEnabled =
115115
pushConfig.deliveryConfigs[PushNotificationSubscriptionDeliveryType
116-
.breakingOnly] ??
117-
false;
116+
.breakingOnly] ??
117+
false;
118118

119119
if (!isBreakingNewsEnabled) {
120120
_log.info('Breaking news notifications are disabled. Aborting.');
@@ -123,16 +123,16 @@ class DefaultPushNotificationService implements IPushNotificationService {
123123

124124
// 2. Find all user preferences that contain a saved headline filter
125125
// subscribed to breaking news. This query targets the embedded 'savedHeadlineFilters' array.
126-
final subscribedUserPreferences =
127-
await _userContentPreferencesRepository.readAll(
128-
filter: {
129-
'savedHeadlineFilters.deliveryTypes': {
130-
r'$in': [
131-
PushNotificationSubscriptionDeliveryType.breakingOnly.name,
132-
],
133-
},
134-
},
135-
);
126+
final subscribedUserPreferences = await _userContentPreferencesRepository
127+
.readAll(
128+
filter: {
129+
'savedHeadlineFilters.deliveryTypes': {
130+
r'$in': [
131+
PushNotificationSubscriptionDeliveryType.breakingOnly.name,
132+
],
133+
},
134+
},
135+
);
136136

137137
if (subscribedUserPreferences.items.isEmpty) {
138138
_log.info('No users subscribed to breaking news. Aborting.');
@@ -142,21 +142,22 @@ class DefaultPushNotificationService implements IPushNotificationService {
142142
// 3. Collect all unique user IDs from the preference documents.
143143
// Using a Set automatically handles deduplication.
144144
// The ID of the UserContentPreferences document is the user's ID.
145-
final userIds =
146-
subscribedUserPreferences.items.map((preference) => preference.id).toSet();
145+
final userIds = subscribedUserPreferences.items
146+
.map((preference) => preference.id)
147+
.toSet();
147148

148149
_log.info(
149150
'Found ${subscribedUserPreferences.items.length} users with '
150151
'subscriptions to breaking news.',
151152
);
152153

153154
// 4. Fetch all devices for all subscribed users in a single bulk query.
154-
final allDevicesResponse =
155-
await _pushNotificationDeviceRepository.readAll(
156-
filter: {
157-
'userId': {r'$in': userIds.toList()},
158-
},
159-
);
155+
final allDevicesResponse = await _pushNotificationDeviceRepository
156+
.readAll(
157+
filter: {
158+
'userId': {r'$in': userIds.toList()},
159+
},
160+
);
160161

161162
final allDevices = allDevicesResponse.items;
162163
if (allDevices.isEmpty) {

0 commit comments

Comments
 (0)