Skip to content

armgit / ente

Public Imported from GitHub
0

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

Only update when notification is sent

laurenspriem42d44c324b3c
diff --git a/mobile/apps/photos/lib/services/social_notification_coordinator.dart b/mobile/apps/photos/lib/services/social_notification_coordinator.dart
index 1db3851ef0..0194238708 100644
--- a/mobile/apps/photos/lib/services/social_notification_coordinator.dart
+++ b/mobile/apps/photos/lib/services/social_notification_coordinator.dart
@@ -260,6 +260,7 @@ class SocialNotificationCoordinator {
..sort((a, b) => b.createdAt.compareTo(a.createdAt));
final s = await LanguageService.locals;
+ int? latestSentNotificationTime;
for (final candidate in candidates) {
final fileID = candidate.fileID;
if (fileID == null) {
@@ -279,6 +280,7 @@ class SocialNotificationCoordinator {
_notificationGroupForType(candidate.type),
),
);
+ latestSentNotificationTime ??= candidate.createdAt;
} catch (e, stackTrace) {
_logger.severe(
'Failed to prepare social notification',
@@ -288,10 +290,12 @@ class SocialNotificationCoordinator {
}
}
- await prefs.setInt(
- kLastSocialActivityNotificationTime,
- candidates.first.createdAt,
- );
+ if (latestSentNotificationTime != null) {
+ await prefs.setInt(
+ kLastSocialActivityNotificationTime,
+ latestSentNotificationTime,
+ );
+ }
}
bool _isSocialNotificationEnabledForType(FeedItemType type) {