Preserve notifications when tapping or clearing notifications from a channel (#6209)

This commit is contained in:
Elias Nahum
2022-05-04 09:12:37 -04:00
committed by GitHub
parent bd50422167
commit 3aa0425fdd

View File

@@ -80,10 +80,12 @@ class PushNotifications {
NativeNotifications.removeDeliveredNotifications(ids);
}
let badgeCount = notifications.length - ids.length;
const serversUrl = Object.keys(DatabaseManager.serverDatabases);
const mentionPromises = serversUrl.map((url) => getTotalMentionsForServer(url));
Promise.all(mentionPromises).then((result) => {
let badgeCount = result.reduce((acc, count) => (acc + count), 0);
badgeCount += result.reduce((acc, count) => (acc + count), 0);
badgeCount = badgeCount <= 0 ? 0 : badgeCount;
Notifications.ios.setBadgeCount(badgeCount);
});