Skip to content

Commit

Permalink
fix: notification debug
Browse files Browse the repository at this point in the history
  • Loading branch information
johannesvedder committed Feb 17, 2023
1 parent 61f27b3 commit 483120f
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions app/lib/util/schedule_notifications.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,13 @@ extension Reminders on FlutterLocalNotificationsPlugin {
for (final reminder in task.schedule.reminders) {
if (date.isSameDate(DateTime.now()) &&
!StudyUTimeOfDay(hour: date.hour, minute: date.minute).earlierThan(reminder, exact: true)) {
print(
'${DateTime.now()} NOT Scheduled Notification #$currentId: ${task.title}, ${date.day}, $reminder, $notificationDetails, ${task.id}',
);
print(task.schedule.reminders);
if (StudyNotifications.debug) {
print(
'${DateTime.now()} Skip Notification #$currentId: '
'${task.title}, ${date.day}, $reminder, $notificationDetails, '
'${task.id}',
);
}
continue;
}
// unlock time: ${task.schedule.completionPeriods.firstWhere((cp) => cp.unlockTime.earlierThan(reminder)).lockTime}
Expand All @@ -42,7 +45,6 @@ extension Reminders on FlutterLocalNotificationsPlugin {
uiLocalNotificationDateInterpretation: UILocalNotificationDateInterpretation.wallClockTime,
androidAllowWhileIdle: true,
);

// DEBUG: Show test notifications
/*if (StudyNotifications.debug && (currentId == 0 || currentId == 1 || currentId == 2)) {
await show(
Expand All @@ -56,11 +58,12 @@ extension Reminders on FlutterLocalNotificationsPlugin {
);
}*/
// DEBUG: List scheduled notifications
//if (StudyNotifications.debug) {
print(
'${DateTime.now()} Scheduled Notification #$currentId: ${task.title}, $reminderTime, $notificationDetails, ${task.id}',
if (StudyNotifications.debug) {
print(
'${DateTime.now()} Scheduled Notification #$currentId: ${task.title}, '
'$reminderTime, $notificationDetails, ${task.id}',
);
//}
}
currentId++;
}
return currentId;
Expand Down

0 comments on commit 483120f

Please sign in to comment.