Skip to content

armgit / ente

Public Imported from GitHub
0

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

Merge branch 'main' into comments_notifications

laurenspriem1b4779f6b254
diff --cc mobile/apps/photos/lib/services/sync/remote_sync_service.dart
index e953f3970a,31b5e81019..2b037aec3c
--- a/mobile/apps/photos/lib/services/sync/remote_sync_service.dart
+++ b/mobile/apps/photos/lib/services/sync/remote_sync_service.dart
@@@ -1268,42 -1186,23 +1268,42 @@@ class RemoteSyncService
return;
}
+ final candidates = latestByKey.values.toList()
+ ..sort((a, b) => b.createdAt.compareTo(a.createdAt));
final s = await LanguageService.locals;
- final message = _getSocialNotificationMessage(latest!.type, s);
- final collection = _collectionsService.getCollectionByID(
- latest!.collectionID,
- );
- final title = collection?.displayName ?? "ente";
-
- await NotificationService.instance.showNotification(
- title,
- message,
- channelID: "social_activity",
- channelName: "EnteFeed",
- payload: "ente://feed",
- );
+
+ for (final candidate in candidates) {
+ final fileID = candidate.fileID;
+ if (fileID == null) {
+ continue;
+ }
+ try {
+ final title = await _getSocialNotificationTitle(candidate);
+ await _showNotificationSafely(
+ title: title,
+ message: _getSocialNotificationBody(candidate.type, s),
+ channelID: "social_activity",
- channelName: "Activity",
++ channelName: "Ente Feed",
+ payload: _buildSocialNotificationPayload(candidate),
+ id: _buildSocialNotificationId(
+ candidate.collectionID,
+ fileID,
+ _notificationGroupForType(candidate.type),
+ ),
+ context:
+ 'social type=${candidate.type.name} collection=${candidate.collectionID} file=$fileID',
+ );
+ } catch (e, stackTrace) {
+ _logger.severe(
+ "Failed to prepare social notification",
+ e,
+ stackTrace,
+ );
+ }
+ }
await _prefs.setInt(
kLastSocialActivityNotificationTime,
- latest!.createdAt,
+ candidates.first.createdAt,
);
}