Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[mob][photos] Fix social notification ID collision across activity types

ashilknd6f721c4ff2e
diff --git a/mobile/apps/photos/lib/services/social_notification_coordinator.dart b/mobile/apps/photos/lib/services/social_notification_coordinator.dart
index d6631f072e..10cf23dea4 100644
--- a/mobile/apps/photos/lib/services/social_notification_coordinator.dart
+++ b/mobile/apps/photos/lib/services/social_notification_coordinator.dart
@@ -288,6 +288,7 @@ class SocialNotificationCoordinator {
id: _buildSocialNotificationId(
candidate.collectionID,
fileID,
+ candidate.type,
_notificationGroupForType(candidate.type),
),
);
@@ -347,11 +348,13 @@ class SocialNotificationCoordinator {
int _buildSocialNotificationId(
int collectionID,
int? fileID,
+ FeedItemType type,
_SocialNotificationGroup group,
) {
const int base = 0x10000000;
int hash = collectionID & 0x7fffffff;
hash = ((hash * 31) ^ (fileID ?? 0)) & 0x7fffffff;
+ hash = ((hash * 31) ^ type.index) & 0x7fffffff;
hash = ((hash * 31) ^ group.index) & 0x7fffffff;
return base | (hash & 0x0fffffff);
}