mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-30 16:29:30 +01:00
Merge branch 'soru/fix-null-check-on-notifs' into 'main'
fix: Missing null check in background push See merge request famedly/fluffychat!521
This commit is contained in:
commit
310c64fe8e
@ -519,7 +519,8 @@ class BackgroundPush {
|
|||||||
});
|
});
|
||||||
if (!syncErrored) {
|
if (!syncErrored) {
|
||||||
emptyRooms = client.rooms
|
emptyRooms = client.rooms
|
||||||
.where((r) => r.notificationCount == 0)
|
.where((r) =>
|
||||||
|
r.notificationCount == 0 || r.notificationCount == null)
|
||||||
.map((r) => r.id);
|
.map((r) => r.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -538,13 +539,15 @@ class BackgroundPush {
|
|||||||
'[Push] failed to fetch pending notifications for clearing push, falling back...',
|
'[Push] failed to fetch pending notifications for clearing push, falling back...',
|
||||||
e);
|
e);
|
||||||
emptyRooms = client.rooms
|
emptyRooms = client.rooms
|
||||||
.where((r) => r.notificationCount == 0)
|
.where((r) =>
|
||||||
|
r.notificationCount == 0 || r.notificationCount == null)
|
||||||
.map((r) => r.id);
|
.map((r) => r.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
emptyRooms = client.rooms
|
emptyRooms = client.rooms
|
||||||
.where((r) => r.notificationCount == 0)
|
.where(
|
||||||
|
(r) => r.notificationCount == 0 || r.notificationCount == null)
|
||||||
.map((r) => r.id);
|
.map((r) => r.id);
|
||||||
}
|
}
|
||||||
await _loadIdMap();
|
await _loadIdMap();
|
||||||
@ -580,7 +583,8 @@ class BackgroundPush {
|
|||||||
if (((activeRoomId?.isNotEmpty ?? false) &&
|
if (((activeRoomId?.isNotEmpty ?? false) &&
|
||||||
activeRoomId == room.id &&
|
activeRoomId == room.id &&
|
||||||
client.syncPresence == null) ||
|
client.syncPresence == null) ||
|
||||||
(event != null && room.notificationCount == 0)) {
|
(event != null &&
|
||||||
|
(room.notificationCount == 0 || room.notificationCount == null))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -589,10 +593,11 @@ class BackgroundPush {
|
|||||||
|
|
||||||
// Count all unread events
|
// Count all unread events
|
||||||
var unreadEvents = 0;
|
var unreadEvents = 0;
|
||||||
client.rooms.forEach((Room room) => unreadEvents += room.notificationCount);
|
client.rooms
|
||||||
|
.forEach((Room room) => unreadEvents += room.notificationCount ?? 0);
|
||||||
|
|
||||||
// Calculate title
|
// Calculate title
|
||||||
final title = l10n.unreadMessages(room.notificationCount);
|
final title = l10n.unreadMessages(room.notificationCount ?? 0);
|
||||||
|
|
||||||
// Calculate the body
|
// Calculate the body
|
||||||
final body = event.getLocalizedBody(
|
final body = event.getLocalizedBody(
|
||||||
|
Loading…
Reference in New Issue
Block a user