Skip to content

armgit / ente

Public Imported from GitHub
0

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

Reduce logging for notifications schedule

laurenspriem276fcebb943b
diff --git a/mobile/apps/photos/lib/services/activity/activity_service.dart b/mobile/apps/photos/lib/services/activity/activity_service.dart
index a33947c98c..fd9d5fc15c 100644
--- a/mobile/apps/photos/lib/services/activity/activity_service.dart
+++ b/mobile/apps/photos/lib/services/activity/activity_service.dart
@@ -83,6 +83,9 @@ class ActivityService {
);
final rituals = await _loadRituals();
if (scheduleAllRituals) {
+ _logger.info(
+ "Scheduling ritual reminders for ${rituals.length} rituals (startup refresh)",
+ );
for (final ritual in rituals) {
await _scheduleRitualNotifications(ritual);
}
@@ -305,6 +308,9 @@ class ActivityService {
}
Future<void> _scheduleRitualNotifications(Ritual ritual) async {
+ _logger.info(
+ "Scheduling ritual reminders for ritual ${ritual.id} (save path)",
+ );
await NotificationService.instance.clearAllScheduledNotifications(
containingPayload: ritual.id,
);
@@ -344,6 +350,7 @@ class ActivityService {
},
).toString(),
dateTime: scheduledDate,
+ logSchedule: false,
);
scheduled += 1;
}
diff --git a/mobile/apps/photos/lib/services/notification_service.dart b/mobile/apps/photos/lib/services/notification_service.dart
index 285d30dcab..37f6fd381d 100644
--- a/mobile/apps/photos/lib/services/notification_service.dart
+++ b/mobile/apps/photos/lib/services/notification_service.dart
@@ -151,11 +151,14 @@ class NotificationService {
String payload = "ente://home",
required DateTime dateTime,
Duration? timeoutDurationAndroid,
+ bool logSchedule = true,
}) async {
try {
- _logger.info(
- "Scheduling notification with: $title, $message, $channelID, $channelName, $payload",
- );
+ if (logSchedule) {
+ _logger.info(
+ "Scheduling notification with: $title, $message, $channelID, $channelName, $payload",
+ );
+ }
await initTimezones();
if (!hasGrantedPermissions()) {
_logger.warning("Notification permissions not granted");
@@ -165,7 +168,9 @@ class NotificationService {
return;
}
} else {
- _logger.info("Notification permissions already granted");
+ if (logSchedule) {
+ _logger.info("Notification permissions already granted");
+ }
}
final androidSpecs = AndroidNotificationDetails(
channelID,
@@ -198,9 +203,11 @@ class NotificationService {
androidScheduleMode: AndroidScheduleMode.inexactAllowWhileIdle,
payload: payload,
);
- _logger.info(
- "Scheduled notification with: $title, $message, $channelID, $channelName, $payload for $dateTime",
- );
+ if (logSchedule) {
+ _logger.info(
+ "Scheduled notification with: $title, $message, $channelID, $channelName, $payload for $dateTime",
+ );
+ }
} catch (e, s) {
// For now we're swallowing any exceptions here because we don't want the memories logic to get disturbed
_logger.severe(